aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs/endian.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/befs/endian.h')
-rw-r--r--fs/befs/endian.h57
1 files changed, 28 insertions, 29 deletions
diff --git a/fs/befs/endian.h b/fs/befs/endian.h
index 9ecaea4e3325..e254a20869f4 100644
--- a/fs/befs/endian.h
+++ b/fs/befs/endian.h
@@ -10,85 +10,84 @@
10#define LINUX_BEFS_ENDIAN 10#define LINUX_BEFS_ENDIAN
11 11
12#include <linux/byteorder/generic.h> 12#include <linux/byteorder/generic.h>
13#include "befs.h"
14 13
15static inline u64 14static inline u64
16fs64_to_cpu(const struct super_block *sb, u64 n) 15fs64_to_cpu(const struct super_block *sb, fs64 n)
17{ 16{
18 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 17 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
19 return le64_to_cpu(n); 18 return le64_to_cpu((__force __le64)n);
20 else 19 else
21 return be64_to_cpu(n); 20 return be64_to_cpu((__force __be64)n);
22} 21}
23 22
24static inline u64 23static inline fs64
25cpu_to_fs64(const struct super_block *sb, u64 n) 24cpu_to_fs64(const struct super_block *sb, u64 n)
26{ 25{
27 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 26 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
28 return cpu_to_le64(n); 27 return (__force fs64)cpu_to_le64(n);
29 else 28 else
30 return cpu_to_be64(n); 29 return (__force fs64)cpu_to_be64(n);
31} 30}
32 31
33static inline u32 32static inline u32
34fs32_to_cpu(const struct super_block *sb, u32 n) 33fs32_to_cpu(const struct super_block *sb, fs32 n)
35{ 34{
36 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 35 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
37 return le32_to_cpu(n); 36 return le32_to_cpu((__force __le32)n);
38 else 37 else
39 return be32_to_cpu(n); 38 return be32_to_cpu((__force __be32)n);
40} 39}
41 40
42static inline u32 41static inline fs32
43cpu_to_fs32(const struct super_block *sb, u32 n) 42cpu_to_fs32(const struct super_block *sb, u32 n)
44{ 43{
45 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 44 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
46 return cpu_to_le32(n); 45 return (__force fs32)cpu_to_le32(n);
47 else 46 else
48 return cpu_to_be32(n); 47 return (__force fs32)cpu_to_be32(n);
49} 48}
50 49
51static inline u16 50static inline u16
52fs16_to_cpu(const struct super_block *sb, u16 n) 51fs16_to_cpu(const struct super_block *sb, fs16 n)
53{ 52{
54 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 53 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
55 return le16_to_cpu(n); 54 return le16_to_cpu((__force __le16)n);
56 else 55 else
57 return be16_to_cpu(n); 56 return be16_to_cpu((__force __be16)n);
58} 57}
59 58
60static inline u16 59static inline fs16
61cpu_to_fs16(const struct super_block *sb, u16 n) 60cpu_to_fs16(const struct super_block *sb, u16 n)
62{ 61{
63 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 62 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
64 return cpu_to_le16(n); 63 return (__force fs16)cpu_to_le16(n);
65 else 64 else
66 return cpu_to_be16(n); 65 return (__force fs16)cpu_to_be16(n);
67} 66}
68 67
69/* Composite types below here */ 68/* Composite types below here */
70 69
71static inline befs_block_run 70static inline befs_block_run
72fsrun_to_cpu(const struct super_block *sb, befs_block_run n) 71fsrun_to_cpu(const struct super_block *sb, befs_disk_block_run n)
73{ 72{
74 befs_block_run run; 73 befs_block_run run;
75 74
76 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { 75 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) {
77 run.allocation_group = le32_to_cpu(n.allocation_group); 76 run.allocation_group = le32_to_cpu((__force __le32)n.allocation_group);
78 run.start = le16_to_cpu(n.start); 77 run.start = le16_to_cpu((__force __le16)n.start);
79 run.len = le16_to_cpu(n.len); 78 run.len = le16_to_cpu((__force __le16)n.len);
80 } else { 79 } else {
81 run.allocation_group = be32_to_cpu(n.allocation_group); 80 run.allocation_group = be32_to_cpu((__force __be32)n.allocation_group);
82 run.start = be16_to_cpu(n.start); 81 run.start = be16_to_cpu((__force __be16)n.start);
83 run.len = be16_to_cpu(n.len); 82 run.len = be16_to_cpu((__force __be16)n.len);
84 } 83 }
85 return run; 84 return run;
86} 85}
87 86
88static inline befs_block_run 87static inline befs_disk_block_run
89cpu_to_fsrun(const struct super_block *sb, befs_block_run n) 88cpu_to_fsrun(const struct super_block *sb, befs_block_run n)
90{ 89{
91 befs_block_run run; 90 befs_disk_block_run run;
92 91
93 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { 92 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) {
94 run.allocation_group = cpu_to_le32(n.allocation_group); 93 run.allocation_group = cpu_to_le32(n.allocation_group);
@@ -103,7 +102,7 @@ cpu_to_fsrun(const struct super_block *sb, befs_block_run n)
103} 102}
104 103
105static inline befs_data_stream 104static inline befs_data_stream
106fsds_to_cpu(const struct super_block *sb, befs_data_stream n) 105fsds_to_cpu(const struct super_block *sb, befs_disk_data_stream n)
107{ 106{
108 befs_data_stream data; 107 befs_data_stream data;
109 int i; 108 int i;