Support __le* and __be* types used in the most recent kernels
diff --git a/include/klibc/compiler.h b/include/klibc/compiler.h
index a463724..823996e 100644
--- a/include/klibc/compiler.h
+++ b/include/klibc/compiler.h
@@ -7,8 +7,6 @@
#ifndef _KLIBC_COMPILER_H
#define _KLIBC_COMPILER_H
-#define __user
-
/* Specific calling conventions */
/* __cdecl is used when we want varadic and non-varadic functions to have
the same binary calling convention. */
@@ -108,4 +106,14 @@
# define __unusedfunc
#endif
+/* It's all user space... */
+#define __user
+
+/* The bitwise attribute: disallow arithmetric operations */
+#ifdef __CHECKER__ /* sparse only */
+# define __bitwise __attribute__((bitwise))
+#else
+# define __bitwise
+#endif
+
#endif
diff --git a/include/sys/types.h b/include/sys/types.h
index 2e8a4cb..ddec242 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -5,6 +5,7 @@
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
+#include <klibc/compiler.h>
#include <stddef.h>
#include <stdint.h>
@@ -88,6 +89,13 @@
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
+typedef uint16_t __bitwise __le16;
+typedef uint16_t __bitwise __be16;
+typedef uint32_t __bitwise __le32;
+typedef uint32_t __bitwise __be32;
+typedef uint64_t __bitwise __le64;
+typedef uint64_t __bitwise __be64;
+
/*
* Some apps want this in <sys/types.h>
*/
diff --git a/klibc/include/klibc/compiler.h b/klibc/include/klibc/compiler.h
index a463724..823996e 100644
--- a/klibc/include/klibc/compiler.h
+++ b/klibc/include/klibc/compiler.h
@@ -7,8 +7,6 @@
#ifndef _KLIBC_COMPILER_H
#define _KLIBC_COMPILER_H
-#define __user
-
/* Specific calling conventions */
/* __cdecl is used when we want varadic and non-varadic functions to have
the same binary calling convention. */
@@ -108,4 +106,14 @@
# define __unusedfunc
#endif
+/* It's all user space... */
+#define __user
+
+/* The bitwise attribute: disallow arithmetric operations */
+#ifdef __CHECKER__ /* sparse only */
+# define __bitwise __attribute__((bitwise))
+#else
+# define __bitwise
+#endif
+
#endif
diff --git a/klibc/include/sys/types.h b/klibc/include/sys/types.h
index 2e8a4cb..ddec242 100644
--- a/klibc/include/sys/types.h
+++ b/klibc/include/sys/types.h
@@ -5,6 +5,7 @@
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
+#include <klibc/compiler.h>
#include <stddef.h>
#include <stdint.h>
@@ -88,6 +89,13 @@
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
+typedef uint16_t __bitwise __le16;
+typedef uint16_t __bitwise __be16;
+typedef uint32_t __bitwise __le32;
+typedef uint32_t __bitwise __be32;
+typedef uint64_t __bitwise __le64;
+typedef uint64_t __bitwise __be64;
+
/*
* Some apps want this in <sys/types.h>
*/