aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/swab.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ufs/swab.h')
-rw-r--r--fs/ufs/swab.h36
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
43static __inline u32 43static inline u32
44fs64_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
52static __inline u32
53fs64_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
61static __inline u32
62fs32_to_cpu(struct super_block *sbp, __fs32 n) 44fs32_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
80fs32_add(struct super_block *sbp, __fs32 *n, int d) 62fs32_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
88static inline void 70static inline void
89fs32_sub(struct super_block *sbp, __fs32 *n, int d) 71fs32_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
97static inline u16 79static inline u16
@@ -116,18 +98,18 @@ static inline void
116fs16_add(struct super_block *sbp, __fs16 *n, int d) 98fs16_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
124static inline void 106static inline void
125fs16_sub(struct super_block *sbp, __fs16 *n, int d) 107fs16_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 */