Linux 2.6.17.7
[linux/fpc-iii.git] / fs / udf / udfend.h
blob17d378879561c7eb6428cc106ba1b2591940423b
1 #ifndef __UDF_ENDIAN_H
2 #define __UDF_ENDIAN_H
4 #include <asm/byteorder.h>
5 #include <linux/string.h>
7 static inline kernel_lb_addr lelb_to_cpu(lb_addr in)
9 kernel_lb_addr out;
10 out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
11 out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);
12 return out;
15 static inline lb_addr cpu_to_lelb(kernel_lb_addr in)
17 lb_addr out;
18 out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
19 out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);
20 return out;
23 static inline kernel_timestamp lets_to_cpu(timestamp in)
25 kernel_timestamp out;
26 memcpy(&out, &in, sizeof(timestamp));
27 out.typeAndTimezone = le16_to_cpu(in.typeAndTimezone);
28 out.year = le16_to_cpu(in.year);
29 return out;
32 static inline short_ad lesa_to_cpu(short_ad in)
34 short_ad out;
35 out.extLength = le32_to_cpu(in.extLength);
36 out.extPosition = le32_to_cpu(in.extPosition);
37 return out;
40 static inline short_ad cpu_to_lesa(short_ad in)
42 short_ad out;
43 out.extLength = cpu_to_le32(in.extLength);
44 out.extPosition = cpu_to_le32(in.extPosition);
45 return out;
48 static inline kernel_long_ad lela_to_cpu(long_ad in)
50 kernel_long_ad out;
51 out.extLength = le32_to_cpu(in.extLength);
52 out.extLocation = lelb_to_cpu(in.extLocation);
53 return out;
56 static inline long_ad cpu_to_lela(kernel_long_ad in)
58 long_ad out;
59 out.extLength = cpu_to_le32(in.extLength);
60 out.extLocation = cpu_to_lelb(in.extLocation);
61 return out;
64 static inline kernel_extent_ad leea_to_cpu(extent_ad in)
66 kernel_extent_ad out;
67 out.extLength = le32_to_cpu(in.extLength);
68 out.extLocation = le32_to_cpu(in.extLocation);
69 return out;
72 static inline timestamp cpu_to_lets(kernel_timestamp in)
74 timestamp out;
75 memcpy(&out, &in, sizeof(timestamp));
76 out.typeAndTimezone = cpu_to_le16(in.typeAndTimezone);
77 out.year = cpu_to_le16(in.year);
78 return out;
81 #endif /* __UDF_ENDIAN_H */