2005-04-17 02:20:36 +04:00
# ifndef __UDF_ENDIAN_H
# define __UDF_ENDIAN_H
# include <asm/byteorder.h>
# include <linux/string.h>
static inline kernel_lb_addr lelb_to_cpu ( lb_addr in )
{
kernel_lb_addr out ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
out . logicalBlockNum = le32_to_cpu ( in . logicalBlockNum ) ;
out . partitionReferenceNum = le16_to_cpu ( in . partitionReferenceNum ) ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
return out ;
}
static inline lb_addr cpu_to_lelb ( kernel_lb_addr in )
{
lb_addr out ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
out . logicalBlockNum = cpu_to_le32 ( in . logicalBlockNum ) ;
out . partitionReferenceNum = cpu_to_le16 ( in . partitionReferenceNum ) ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
return out ;
}
static inline short_ad lesa_to_cpu ( short_ad in )
{
short_ad out ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
out . extLength = le32_to_cpu ( in . extLength ) ;
out . extPosition = le32_to_cpu ( in . extPosition ) ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
return out ;
}
static inline short_ad cpu_to_lesa ( short_ad in )
{
short_ad out ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
out . extLength = cpu_to_le32 ( in . extLength ) ;
out . extPosition = cpu_to_le32 ( in . extPosition ) ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
return out ;
}
static inline kernel_long_ad lela_to_cpu ( long_ad in )
{
kernel_long_ad out ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
out . extLength = le32_to_cpu ( in . extLength ) ;
out . extLocation = lelb_to_cpu ( in . extLocation ) ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
return out ;
}
static inline long_ad cpu_to_lela ( kernel_long_ad in )
{
long_ad out ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
out . extLength = cpu_to_le32 ( in . extLength ) ;
out . extLocation = cpu_to_lelb ( in . extLocation ) ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
return out ;
}
static inline kernel_extent_ad leea_to_cpu ( extent_ad in )
{
kernel_extent_ad out ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
out . extLength = le32_to_cpu ( in . extLength ) ;
out . extLocation = le32_to_cpu ( in . extLocation ) ;
2007-07-21 15:37:18 +04:00
2005-04-17 02:20:36 +04:00
return out ;
}
2007-07-21 15:37:18 +04:00
# endif /* __UDF_ENDIAN_H */