diff options
Diffstat (limited to 'fs/ufs/swab.h')
-rw-r--r-- | fs/ufs/swab.h | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h index 1683d2bee614..8d974c4fd18b 100644 --- a/fs/ufs/swab.h +++ b/fs/ufs/swab.h | |||
@@ -40,25 +40,7 @@ cpu_to_fs64(struct super_block *sbp, u64 n) | |||
40 | return (__force __fs64)cpu_to_be64(n); | 40 | return (__force __fs64)cpu_to_be64(n); |
41 | } | 41 | } |
42 | 42 | ||
43 | static __inline u32 | 43 | static inline u32 |
44 | fs64_add(struct super_block *sbp, u32 *n, int d) | ||
45 | { | ||
46 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | ||
47 | return *n = cpu_to_le64(le64_to_cpu(*n)+d); | ||
48 | else | ||
49 | return *n = cpu_to_be64(be64_to_cpu(*n)+d); | ||
50 | } | ||
51 | |||
52 | static __inline u32 | ||
53 | fs64_sub(struct super_block *sbp, u32 *n, int d) | ||
54 | { | ||
55 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | ||
56 | return *n = cpu_to_le64(le64_to_cpu(*n)-d); | ||
57 | else | ||
58 | return *n = cpu_to_be64(be64_to_cpu(*n)-d); | ||
59 | } | ||
60 | |||
61 | static __inline u32 | ||
62 | fs32_to_cpu(struct super_block *sbp, __fs32 n) | 44 | fs32_to_cpu(struct super_block *sbp, __fs32 n) |
63 | { | 45 | { |
64 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 46 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
@@ -80,18 +62,18 @@ static inline void | |||
80 | fs32_add(struct super_block *sbp, __fs32 *n, int d) | 62 | fs32_add(struct super_block *sbp, __fs32 *n, int d) |
81 | { | 63 | { |
82 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 64 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
83 | *(__le32 *)n = cpu_to_le32(le32_to_cpu(*(__le32 *)n)+d); | 65 | le32_add_cpu((__le32 *)n, d); |
84 | else | 66 | else |
85 | *(__be32 *)n = cpu_to_be32(be32_to_cpu(*(__be32 *)n)+d); | 67 | be32_add_cpu((__be32 *)n, d); |
86 | } | 68 | } |
87 | 69 | ||
88 | static inline void | 70 | static inline void |
89 | fs32_sub(struct super_block *sbp, __fs32 *n, int d) | 71 | fs32_sub(struct super_block *sbp, __fs32 *n, int d) |
90 | { | 72 | { |
91 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 73 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
92 | *(__le32 *)n = cpu_to_le32(le32_to_cpu(*(__le32 *)n)-d); | 74 | le32_add_cpu((__le32 *)n, -d); |
93 | else | 75 | else |
94 | *(__be32 *)n = cpu_to_be32(be32_to_cpu(*(__be32 *)n)-d); | 76 | be32_add_cpu((__be32 *)n, -d); |
95 | } | 77 | } |
96 | 78 | ||
97 | static inline u16 | 79 | static inline u16 |
@@ -116,18 +98,18 @@ static inline void | |||
116 | fs16_add(struct super_block *sbp, __fs16 *n, int d) | 98 | fs16_add(struct super_block *sbp, __fs16 *n, int d) |
117 | { | 99 | { |
118 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 100 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
119 | *(__le16 *)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)+d); | 101 | le16_add_cpu((__le16 *)n, d); |
120 | else | 102 | else |
121 | *(__be16 *)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)+d); | 103 | be16_add_cpu((__be16 *)n, d); |
122 | } | 104 | } |
123 | 105 | ||
124 | static inline void | 106 | static inline void |
125 | fs16_sub(struct super_block *sbp, __fs16 *n, int d) | 107 | fs16_sub(struct super_block *sbp, __fs16 *n, int d) |
126 | { | 108 | { |
127 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 109 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
128 | *(__le16 *)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)-d); | 110 | le16_add_cpu((__le16 *)n, -d); |
129 | else | 111 | else |
130 | *(__be16 *)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)-d); | 112 | be16_add_cpu((__be16 *)n, -d); |
131 | } | 113 | } |
132 | 114 | ||
133 | #endif /* _UFS_SWAB_H */ | 115 | #endif /* _UFS_SWAB_H */ |