Ticket #18502: patch-kerncompat.h.diff
File patch-kerncompat.h.diff, 2.0 KB (added by 0xffea@…, 16 years ago) |
---|
-
kerncompat.h
old new 22 22 #include <stdlib.h> 23 23 #include <errno.h> 24 24 #include <string.h> 25 #ifdef __APPLE__ 26 #include <stdint.h> 27 #include <libkern/OSByteOrder.h> 28 #else 25 29 #include <endian.h> 26 30 #include <byteswap.h> 31 #endif 27 32 #include <assert.h> 28 33 29 34 #ifndef READ … … 42 47 #define GFP_NOFS 0 43 48 #define __read_mostly 44 49 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 45 #define ULONG_MAX (~0UL)50 //#define ULONG_MAX (~0UL) 46 51 #define BUG() abort() 47 52 #ifdef __CHECKER__ 48 53 #define __force __attribute__((force)) … … 53 58 #endif 54 59 55 60 #ifndef __CHECKER__ 61 #ifdef __APPLE__ 62 typedef uint32_t u32; 63 typedef uint64_t u64; 64 typedef uint16_t u16; 65 typedef uint8_t u8; 66 #else 56 67 #include <asm/types.h> 57 68 typedef __u32 u32; 58 69 typedef __u64 u64; 59 70 typedef __u16 u16; 60 71 typedef __u8 u8; 72 #endif /* __APPLE__ */ 61 73 #else 62 74 typedef unsigned int u32; 63 75 typedef unsigned int __u32; … … 236 248 #define __le8 u8 237 249 238 250 #if __BYTE_ORDER == __BIG_ENDIAN 251 #ifdef __APPLE__ 252 #define cpu_to_le64(x) ((__force __le64)(u64)(OSSwapHostToLittleInt64(x))) 253 #define le64_to_cpu(x) ((__force u64)(__le64)(OSSwapLittleToHostInt64(x))) 254 #define cpu_to_le32(x) ((__force __le32)(u32)(OSSwapHostToLittleInt32(x))) 255 #define le32_to_cpu(x) ((__force u32)(__le32)(OSSwapLittleToHostInt32(x))) 256 #define cpu_to_le16(x) ((__force __le16)(u16)(OSSwapHostToLittleInt16(x))) 257 #define le16_to_cpu(x) ((__force u16)(__le16)(OSSwapLittleToHostInt16(x))) 258 #else 239 259 #define cpu_to_le64(x) ((__force __le64)(u64)(bswap_64(x))) 240 260 #define le64_to_cpu(x) ((__force u64)(__le64)(bswap_64(x))) 241 261 #define cpu_to_le32(x) ((__force __le32)(u32)(bswap_32(x))) 242 262 #define le32_to_cpu(x) ((__force u32)(__le32)(bswap_32(x))) 243 263 #define cpu_to_le16(x) ((__force __le16)(u16)(bswap_16(x))) 244 264 #define le16_to_cpu(x) ((__force u16)(__le16)(bswap_16(x))) 265 #endif /* __APPLE__ */ 245 266 #else 246 267 #define cpu_to_le64(x) ((__force __le64)(u64)(x)) 247 268 #define le64_to_cpu(x) ((__force u64)(__le64)(x))