btrfs-progs: add more checks to btrfs_read_sys_array
[platform/upstream/btrfs-progs.git] / kerncompat.h
index 8afadc8..7c627ba 100644 (file)
@@ -16,8 +16,8 @@
  * Boston, MA 021110-1307, USA.
  */
 
-#ifndef __KERNCOMPAT
-#define __KERNCOMPAT
+#ifndef __KERNCOMPAT_H__
+#define __KERNCOMPAT_H__
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <linux/types.h>
 #include <stdint.h>
+
+#include <features.h>
+
+#ifndef __GLIBC__
+#ifndef BTRFS_DISABLE_BACKTRACE
+#define BTRFS_DISABLE_BACKTRACE
+#endif
+#define __always_inline __inline __attribute__ ((__always_inline__))
+#endif
+
 #ifndef BTRFS_DISABLE_BACKTRACE
 #include <execinfo.h>
 #endif
@@ -123,7 +133,7 @@ typedef unsigned long long u64;
 typedef unsigned char u8;
 typedef unsigned short u16;
 typedef long long s64;
-typedef int s32
+typedef int s32;
 #endif
 
 
@@ -343,7 +353,6 @@ struct __una_u64 { __le64 x; } __attribute__((__packed__));
 #define put_unaligned_le32(val,p) (((struct __una_u32 *)(p))->x = cpu_to_le32(val))
 #define get_unaligned_le64(p) le64_to_cpu(((const struct __una_u64 *)(p))->x)
 #define put_unaligned_le64(val,p) (((struct __una_u64 *)(p))->x = cpu_to_le64(val))
-#endif
 
 #ifndef true
 #define true 1
@@ -353,3 +362,5 @@ struct __una_u64 { __le64 x; } __attribute__((__packed__));
 #ifndef noinline
 #define noinline
 #endif
+
+#endif