diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2005-12-24 01:32:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-10 19:15:33 -0400 |
commit | 1151895f8076584e061092afffb110b90cb38a68 (patch) | |
tree | b21948f944b9f949c629cef3027985f9e3cf53dc /fs | |
parent | af10b0084dff530fb7232a0f8bbc4499e9c58574 (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')
-rw-r--r-- | fs/befs/befs_fs_types.h | 4 | ||||
-rw-r--r-- | fs/befs/endian.h | 36 |
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 | ||
82 | typedef u64 __bitwise fs64; | ||
83 | typedef u32 __bitwise fs32; | ||
84 | typedef u16 __bitwise fs16; | ||
85 | |||
82 | typedef u64 befs_off_t; | 86 | typedef u64 befs_off_t; |
83 | typedef u64 befs_time_t; | 87 | typedef 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 | ||
14 | static inline u64 | 14 | static inline u64 |
15 | fs64_to_cpu(const struct super_block *sb, u64 n) | 15 | fs64_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 | ||
23 | static inline u64 | 23 | static inline fs64 |
24 | cpu_to_fs64(const struct super_block *sb, u64 n) | 24 | cpu_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 | ||
32 | static inline u32 | 32 | static inline u32 |
33 | fs32_to_cpu(const struct super_block *sb, u32 n) | 33 | fs32_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 | ||
41 | static inline u32 | 41 | static inline fs32 |
42 | cpu_to_fs32(const struct super_block *sb, u32 n) | 42 | cpu_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 | ||
50 | static inline u16 | 50 | static inline u16 |
51 | fs16_to_cpu(const struct super_block *sb, u16 n) | 51 | fs16_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 | ||
59 | static inline u16 | 59 | static inline fs16 |
60 | cpu_to_fs16(const struct super_block *sb, u16 n) | 60 | cpu_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 */ |