Remove references to CONFIG_PROFILE. Kernel profiling is no longer a
[linux-2.6/linux-mips.git] / fs / udf / udfend.h
blob67161d7aea711fcf8853c8c437b101d84caa7242
1 #ifndef __UDF_ENDIAN_H
2 #define __UDF_ENDIAN_H
4 #ifndef __KERNEL__
6 #include <sys/types.h>
8 #if __BYTE_ORDER == 0
10 #error "__BYTE_ORDER must be defined"
12 #elif __BYTE_ORDER == __BIG_ENDIAN
14 #define le16_to_cpu(x) \
15 ((Uint16)((((Uint16)(x) & 0x00FFU) << 8) | \
16 (((Uint16)(x) & 0xFF00U) >> 8)))
18 #define le32_to_cpu(x) \
19 ((Uint32)((((Uint32)(x) & 0x000000FFU) << 24) | \
20 (((Uint32)(x) & 0x0000FF00U) << 8) | \
21 (((Uint32)(x) & 0x00FF0000U) >> 8) | \
22 (((Uint32)(x) & 0xFF000000U) >> 24)))
24 #define le64_to_cpu(x) \
25 ((Uint64)((((Uint64)(x) & 0x00000000000000FFULL) << 56) | \
26 (((Uint64)(x) & 0x000000000000FF00ULL) << 40) | \
27 (((Uint64)(x) & 0x0000000000FF0000ULL) << 24) | \
28 (((Uint64)(x) & 0x00000000FF000000ULL) << 8) | \
29 (((Uint64)(x) & 0x000000FF00000000ULL) >> 8) | \
30 (((Uint64)(x) & 0x0000FF0000000000ULL) >> 24) | \
31 (((Uint64)(x) & 0x00FF000000000000ULL) >> 40) | \
32 (((Uint64)(x) & 0xFF00000000000000ULL) >> 56)))
34 #define cpu_to_le16(x) (le16_to_cpu(x))
35 #define cpu_to_le32(x) (le32_to_cpu(x))
36 #define cpu_to_le64(x) (le64_to_cpu(x))
38 #else /* __BYTE_ORDER == __LITTLE_ENDIAN */
40 #define le16_to_cpu(x) (x)
41 #define le32_to_cpu(x) (x)
42 #define le64_to_cpu(x) (x)
43 #define cpu_to_le16(x) (x)
44 #define cpu_to_le32(x) (x)
45 #define cpu_to_le64(x) (x)
47 #endif /* __BYTE_ORDER == 0 */
49 #include <string.h>
51 #else /* __KERNEL__ */
53 #include <asm/byteorder.h>
54 #include <linux/string.h>
56 #endif /* ! __KERNEL__ */
58 static inline lb_addr lelb_to_cpu(lb_addr in)
60 lb_addr out;
61 out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
62 out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);
63 return out;
66 static inline lb_addr cpu_to_lelb(lb_addr in)
68 lb_addr out;
69 out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
70 out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);
71 return out;
74 static inline timestamp lets_to_cpu(timestamp in)
76 timestamp out;
77 memcpy(&out, &in, sizeof(timestamp));
78 out.typeAndTimezone = le16_to_cpu(in.typeAndTimezone);
79 out.year = le16_to_cpu(in.year);
80 return out;
83 static inline long_ad lela_to_cpu(long_ad in)
85 long_ad out;
86 out.extLength = le32_to_cpu(in.extLength);
87 out.extLocation = lelb_to_cpu(in.extLocation);
88 return out;
91 static inline long_ad cpu_to_lela(long_ad in)
93 long_ad out;
94 out.extLength = cpu_to_le32(in.extLength);
95 out.extLocation = cpu_to_lelb(in.extLocation);
96 return out;
99 static inline extent_ad leea_to_cpu(extent_ad in)
101 extent_ad out;
102 out.extLength = le32_to_cpu(in.extLength);
103 out.extLocation = le32_to_cpu(in.extLocation);
104 return out;
107 static inline timestamp cpu_to_lets(timestamp in)
109 timestamp out;
110 memcpy(&out, &in, sizeof(timestamp));
111 out.typeAndTimezone = cpu_to_le16(in.typeAndTimezone);
112 out.year = cpu_to_le16(in.year);
113 return out;
116 #endif /* __UDF_ENDIAN_H */