• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __TYPE_COMPAT_H
2 #define __TYPE_COMPAT_H
3 
4 #ifndef DOC_HIDDEN
5 #include <stdint.h>
6 #ifdef __linux__
7 #include <linux/types.h>
8 #else
9 typedef uint8_t __u8;
10 typedef uint16_t __u16;
11 typedef uint32_t __u32;
12 typedef uint64_t __u64;
13 typedef int8_t __s8;
14 typedef int16_t __s16;
15 typedef int32_t __s32;
16 typedef int64_t __s64;
17 
18 #include <endian.h>
19 #include <byteswap.h>
20 #if __BYTE_ORDER == __LITTLE_ENDIAN
21 #define __cpu_to_le32(x) (x)
22 #define __cpu_to_be32(x) bswap_32(x)
23 #define __cpu_to_le16(x) (x)
24 #define __cpu_to_be16(x) bswap_16(x)
25 #else
26 #define __cpu_to_le32(x) bswap_32(x)
27 #define __cpu_to_be32(x) (x)
28 #define __cpu_to_le16(x) bswap_16(x)
29 #define __cpu_to_be16(x) (x)
30 #endif
31 
32 #define __le32_to_cpu __cpu_to_le32
33 #define __be32_to_cpu __cpu_to_be32
34 #define __le16_to_cpu __cpu_to_le16
35 #define __be16_to_cpu __cpu_to_be16
36 
37 #define __le64 __u64
38 #define __le32 __u32
39 #define __le16 __u16
40 #define __le8  __u8
41 #define __be64 __u64
42 #define __be32 __u32
43 #define __be16 __u16
44 #define __be8  __u8
45 #endif
46 
47 #ifndef __kernel_long_t
48 #define __kernel_long_t long
49 #endif
50 
51 #ifndef __user
52 #define __user
53 #endif
54 
55 #ifndef __packed
56 #define __packed __attribute__((__packed__))
57 #endif
58 
59 #endif /* DOC_HIDDEN */
60 
61 #endif /* __TYPE_COMPAT_H */
62