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