Blame view

fs/udf/udfend.h 1.57 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
  #ifndef __UDF_ENDIAN_H
  #define __UDF_ENDIAN_H
  
  #include <asm/byteorder.h>
  #include <linux/string.h>
5ca4e4be8   Pekka Enberg   Remove struct typ...
6
  static inline struct kernel_lb_addr lelb_to_cpu(struct lb_addr in)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
  {
5ca4e4be8   Pekka Enberg   Remove struct typ...
8
  	struct kernel_lb_addr out;
28de7948a   Cyrill Gorcunov   UDF: coding style...
9

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
  	out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
  	out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);
28de7948a   Cyrill Gorcunov   UDF: coding style...
12

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
14
  	return out;
  }
5ca4e4be8   Pekka Enberg   Remove struct typ...
15
  static inline struct lb_addr cpu_to_lelb(struct kernel_lb_addr in)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
  {
5ca4e4be8   Pekka Enberg   Remove struct typ...
17
  	struct lb_addr out;
28de7948a   Cyrill Gorcunov   UDF: coding style...
18

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
20
  	out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
  	out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);
28de7948a   Cyrill Gorcunov   UDF: coding style...
21

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
23
  	return out;
  }
5ca4e4be8   Pekka Enberg   Remove struct typ...
24
  static inline struct short_ad lesa_to_cpu(struct short_ad in)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
  {
5ca4e4be8   Pekka Enberg   Remove struct typ...
26
  	struct short_ad out;
28de7948a   Cyrill Gorcunov   UDF: coding style...
27

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
28
29
  	out.extLength = le32_to_cpu(in.extLength);
  	out.extPosition = le32_to_cpu(in.extPosition);
28de7948a   Cyrill Gorcunov   UDF: coding style...
30

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
32
  	return out;
  }
5ca4e4be8   Pekka Enberg   Remove struct typ...
33
  static inline struct short_ad cpu_to_lesa(struct short_ad in)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34
  {
5ca4e4be8   Pekka Enberg   Remove struct typ...
35
  	struct short_ad out;
28de7948a   Cyrill Gorcunov   UDF: coding style...
36

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
  	out.extLength = cpu_to_le32(in.extLength);
  	out.extPosition = cpu_to_le32(in.extPosition);
28de7948a   Cyrill Gorcunov   UDF: coding style...
39

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
40
41
  	return out;
  }
5ca4e4be8   Pekka Enberg   Remove struct typ...
42
  static inline struct kernel_long_ad lela_to_cpu(struct long_ad in)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
43
  {
5ca4e4be8   Pekka Enberg   Remove struct typ...
44
  	struct kernel_long_ad out;
28de7948a   Cyrill Gorcunov   UDF: coding style...
45

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
47
  	out.extLength = le32_to_cpu(in.extLength);
  	out.extLocation = lelb_to_cpu(in.extLocation);
28de7948a   Cyrill Gorcunov   UDF: coding style...
48

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
50
  	return out;
  }
5ca4e4be8   Pekka Enberg   Remove struct typ...
51
  static inline struct long_ad cpu_to_lela(struct kernel_long_ad in)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
  {
5ca4e4be8   Pekka Enberg   Remove struct typ...
53
  	struct long_ad out;
28de7948a   Cyrill Gorcunov   UDF: coding style...
54

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
56
  	out.extLength = cpu_to_le32(in.extLength);
  	out.extLocation = cpu_to_lelb(in.extLocation);
28de7948a   Cyrill Gorcunov   UDF: coding style...
57

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
59
  	return out;
  }
5ca4e4be8   Pekka Enberg   Remove struct typ...
60
  static inline struct kernel_extent_ad leea_to_cpu(struct extent_ad in)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
  {
5ca4e4be8   Pekka Enberg   Remove struct typ...
62
  	struct kernel_extent_ad out;
28de7948a   Cyrill Gorcunov   UDF: coding style...
63

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64
65
  	out.extLength = le32_to_cpu(in.extLength);
  	out.extLocation = le32_to_cpu(in.extLocation);
28de7948a   Cyrill Gorcunov   UDF: coding style...
66

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
68
  	return out;
  }
28de7948a   Cyrill Gorcunov   UDF: coding style...
69
  #endif /* __UDF_ENDIAN_H */