Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __UDF_ENDIAN_H
0003 #define __UDF_ENDIAN_H
0004 
0005 #include <asm/byteorder.h>
0006 #include <linux/string.h>
0007 
0008 static inline struct kernel_lb_addr lelb_to_cpu(struct lb_addr in)
0009 {
0010     struct kernel_lb_addr out;
0011 
0012     out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
0013     out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);
0014 
0015     return out;
0016 }
0017 
0018 static inline struct lb_addr cpu_to_lelb(struct kernel_lb_addr in)
0019 {
0020     struct lb_addr out;
0021 
0022     out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
0023     out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);
0024 
0025     return out;
0026 }
0027 
0028 static inline struct short_ad lesa_to_cpu(struct short_ad in)
0029 {
0030     struct short_ad out;
0031 
0032     out.extLength = le32_to_cpu(in.extLength);
0033     out.extPosition = le32_to_cpu(in.extPosition);
0034 
0035     return out;
0036 }
0037 
0038 static inline struct short_ad cpu_to_lesa(struct short_ad in)
0039 {
0040     struct short_ad out;
0041 
0042     out.extLength = cpu_to_le32(in.extLength);
0043     out.extPosition = cpu_to_le32(in.extPosition);
0044 
0045     return out;
0046 }
0047 
0048 static inline struct kernel_long_ad lela_to_cpu(struct long_ad in)
0049 {
0050     struct kernel_long_ad out;
0051 
0052     out.extLength = le32_to_cpu(in.extLength);
0053     out.extLocation = lelb_to_cpu(in.extLocation);
0054 
0055     return out;
0056 }
0057 
0058 static inline struct long_ad cpu_to_lela(struct kernel_long_ad in)
0059 {
0060     struct long_ad out;
0061 
0062     out.extLength = cpu_to_le32(in.extLength);
0063     out.extLocation = cpu_to_lelb(in.extLocation);
0064 
0065     return out;
0066 }
0067 
0068 static inline struct kernel_extent_ad leea_to_cpu(struct extent_ad in)
0069 {
0070     struct kernel_extent_ad out;
0071 
0072     out.extLength = le32_to_cpu(in.extLength);
0073     out.extLocation = le32_to_cpu(in.extLocation);
0074 
0075     return out;
0076 }
0077 
0078 #endif /* __UDF_ENDIAN_H */