1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <asm/byteorder.h>
6 #include <linux/string.h>
8 static inline struct kernel_lb_addr lelb_to_cpu(struct lb_addr in)
10 struct kernel_lb_addr out;
12 out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
13 out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);
18 static inline struct lb_addr cpu_to_lelb(struct kernel_lb_addr in)
22 out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
23 out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);
28 static inline struct short_ad lesa_to_cpu(struct short_ad in)
32 out.extLength = le32_to_cpu(in.extLength);
33 out.extPosition = le32_to_cpu(in.extPosition);
38 static inline struct short_ad cpu_to_lesa(struct short_ad in)
42 out.extLength = cpu_to_le32(in.extLength);
43 out.extPosition = cpu_to_le32(in.extPosition);
48 static inline struct kernel_long_ad lela_to_cpu(struct long_ad in)
50 struct kernel_long_ad out;
52 out.extLength = le32_to_cpu(in.extLength);
53 out.extLocation = lelb_to_cpu(in.extLocation);
58 static inline struct long_ad cpu_to_lela(struct kernel_long_ad in)
62 out.extLength = cpu_to_le32(in.extLength);
63 out.extLocation = cpu_to_lelb(in.extLocation);
68 static inline struct kernel_extent_ad leea_to_cpu(struct extent_ad in)
70 struct kernel_extent_ad out;
72 out.extLength = le32_to_cpu(in.extLength);
73 out.extLocation = le32_to_cpu(in.extLocation);
78 #endif /* __UDF_ENDIAN_H */