diff options
Diffstat (limited to 'arch/um/drivers/cow.h')
-rw-r--r-- | arch/um/drivers/cow.h | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h index 4fcf3a8d13f4..dc36b222100b 100644 --- a/arch/um/drivers/cow.h +++ b/arch/um/drivers/cow.h | |||
@@ -3,15 +3,40 @@ | |||
3 | 3 | ||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | #if defined(__BIG_ENDIAN) | 6 | #if defined(__KERNEL__) |
7 | # define ntohll(x) (x) | 7 | |
8 | # define htonll(x) (x) | 8 | # include <asm/byteorder.h> |
9 | #elif defined(__LITTLE_ENDIAN) | 9 | |
10 | # define ntohll(x) bswap_64(x) | 10 | # if defined(__BIG_ENDIAN) |
11 | # define htonll(x) bswap_64(x) | 11 | # define ntohll(x) (x) |
12 | # define htonll(x) (x) | ||
13 | # elif defined(__LITTLE_ENDIAN) | ||
14 | # define ntohll(x) be64_to_cpu(x) | ||
15 | # define htonll(x) cpu_to_be64(x) | ||
16 | # else | ||
17 | # error "Could not determine byte order" | ||
18 | # endif | ||
19 | |||
12 | #else | 20 | #else |
13 | #error "__BYTE_ORDER not defined" | 21 | /* For the definition of ntohl, htonl and __BYTE_ORDER */ |
22 | #include <endian.h> | ||
23 | #include <netinet/in.h> | ||
24 | #if defined(__BYTE_ORDER) | ||
25 | |||
26 | # if __BYTE_ORDER == __BIG_ENDIAN | ||
27 | # define ntohll(x) (x) | ||
28 | # define htonll(x) (x) | ||
29 | # elif __BYTE_ORDER == __LITTLE_ENDIAN | ||
30 | # define ntohll(x) bswap_64(x) | ||
31 | # define htonll(x) bswap_64(x) | ||
32 | # else | ||
33 | # error "Could not determine byte order: __BYTE_ORDER uncorrectly defined" | ||
34 | # endif | ||
35 | |||
36 | #else /* ! defined(__BYTE_ORDER) */ | ||
37 | # error "Could not determine byte order: __BYTE_ORDER not defined" | ||
14 | #endif | 38 | #endif |
39 | #endif /* ! defined(__KERNEL__) */ | ||
15 | 40 | ||
16 | extern int init_cow_file(int fd, char *cow_file, char *backing_file, | 41 | extern int init_cow_file(int fd, char *cow_file, char *backing_file, |
17 | int sectorsize, int alignment, int *bitmap_offset_out, | 42 | int sectorsize, int alignment, int *bitmap_offset_out, |