aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2005-12-24 01:32:03 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-10 19:15:33 -0400
commit1151895f8076584e061092afffb110b90cb38a68 (patch)
treeb21948f944b9f949c629cef3027985f9e3cf53dc /fs/befs
parentaf10b0084dff530fb7232a0f8bbc4499e9c58574 (diff)
[PATCH] befs: introduce on-disk endian types
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/befs')
-rw-r--r--fs/befs/befs_fs_types.h4
-rw-r--r--fs/befs/endian.h36
2 files changed, 22 insertions, 18 deletions
diff --git a/fs/befs/befs_fs_types.h b/fs/befs/befs_fs_types.h
index d124b4c51179..128066b1c4b0 100644
--- a/fs/befs/befs_fs_types.h
+++ b/fs/befs/befs_fs_types.h
@@ -79,6 +79,10 @@ enum inode_flags {
79 * On-Disk datastructures of BeFS 79 * On-Disk datastructures of BeFS
80 */ 80 */
81 81
82typedef u64 __bitwise fs64;
83typedef u32 __bitwise fs32;
84typedef u16 __bitwise fs16;
85
82typedef u64 befs_off_t; 86typedef u64 befs_off_t;
83typedef u64 befs_time_t; 87typedef u64 befs_time_t;
84 88
diff --git a/fs/befs/endian.h b/fs/befs/endian.h
index d77a26e7bd97..979c543e6c58 100644
--- a/fs/befs/endian.h
+++ b/fs/befs/endian.h
@@ -12,57 +12,57 @@
12#include <linux/byteorder/generic.h> 12#include <linux/byteorder/generic.h>
13 13
14static inline u64 14static inline u64
15fs64_to_cpu(const struct super_block *sb, u64 n) 15fs64_to_cpu(const struct super_block *sb, fs64 n)
16{ 16{
17 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 17 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
18 return le64_to_cpu(n); 18 return le64_to_cpu((__force __le64)n);
19 else 19 else
20 return be64_to_cpu(n); 20 return be64_to_cpu((__force __be64)n);
21} 21}
22 22
23static inline u64 23static inline fs64
24cpu_to_fs64(const struct super_block *sb, u64 n) 24cpu_to_fs64(const struct super_block *sb, u64 n)
25{ 25{
26 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 26 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
27 return cpu_to_le64(n); 27 return (__force fs64)cpu_to_le64(n);
28 else 28 else
29 return cpu_to_be64(n); 29 return (__force fs64)cpu_to_be64(n);
30} 30}
31 31
32static inline u32 32static inline u32
33fs32_to_cpu(const struct super_block *sb, u32 n) 33fs32_to_cpu(const struct super_block *sb, fs32 n)
34{ 34{
35 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 35 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
36 return le32_to_cpu(n); 36 return le32_to_cpu((__force __le32)n);
37 else 37 else
38 return be32_to_cpu(n); 38 return be32_to_cpu((__force __be32)n);
39} 39}
40 40
41static inline u32 41static inline fs32
42cpu_to_fs32(const struct super_block *sb, u32 n) 42cpu_to_fs32(const struct super_block *sb, u32 n)
43{ 43{
44 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 44 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
45 return cpu_to_le32(n); 45 return (__force fs32)cpu_to_le32(n);
46 else 46 else
47 return cpu_to_be32(n); 47 return (__force fs32)cpu_to_be32(n);
48} 48}
49 49
50static inline u16 50static inline u16
51fs16_to_cpu(const struct super_block *sb, u16 n) 51fs16_to_cpu(const struct super_block *sb, fs16 n)
52{ 52{
53 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 53 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
54 return le16_to_cpu(n); 54 return le16_to_cpu((__force __le16)n);
55 else 55 else
56 return be16_to_cpu(n); 56 return be16_to_cpu((__force __be16)n);
57} 57}
58 58
59static inline u16 59static inline fs16
60cpu_to_fs16(const struct super_block *sb, u16 n) 60cpu_to_fs16(const struct super_block *sb, u16 n)
61{ 61{
62 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 62 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
63 return cpu_to_le16(n); 63 return (__force fs16)cpu_to_le16(n);
64 else 64 else
65 return cpu_to_be16(n); 65 return (__force fs16)cpu_to_be16(n);
66} 66}
67 67
68/* Composite types below here */ 68/* Composite types below here */