diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-10-16 01:04:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:46 -0400 |
commit | 152b95a1ed499075006cc6552ef49407deeb815b (patch) | |
tree | d77fdf0382669cd541ebb5c723d4e0757cc52e18 /fs/befs | |
parent | bd39597cbd42a784105a04010100e27267481c67 (diff) |
befs: annotate fs32 on tests for superblock endianness
Does compile-time byteswapping rather than runtime.
Noticed by sparse:
fs/befs/super.c:29:6: warning: cast to restricted __le32
fs/befs/super.c:29:6: warning: cast from restricted fs32
fs/befs/super.c:31:11: warning: cast to restricted __be32
fs/befs/super.c:31:11: warning: cast from restricted fs32
fs/befs/super.c:31:11: warning: cast to restricted __be32
fs/befs/super.c:31:11: warning: cast from restricted fs32
fs/befs/super.c:31:11: warning: cast to restricted __be32
fs/befs/super.c:31:11: warning: cast from restricted fs32
fs/befs/super.c:31:11: warning: cast to restricted __be32
fs/befs/super.c:31:11: warning: cast from restricted fs32
fs/befs/super.c:31:11: warning: cast to restricted __be32
fs/befs/super.c:31:11: warning: cast from restricted fs32
fs/befs/super.c:31:11: warning: cast to restricted __be32
fs/befs/super.c:31:11: warning: cast from restricted fs32
fs/befs/linuxvfs.c:811:7: warning: cast to restricted __le32
fs/befs/linuxvfs.c:811:7: warning: cast from restricted fs32
fs/befs/linuxvfs.c:812:7: warning: cast to restricted __be32
fs/befs/linuxvfs.c:812:7: warning: cast from restricted fs32
fs/befs/linuxvfs.c:812:7: warning: cast to restricted __be32
fs/befs/linuxvfs.c:812:7: warning: cast from restricted fs32
fs/befs/linuxvfs.c:812:7: warning: cast to restricted __be32
fs/befs/linuxvfs.c:812:7: warning: cast from restricted fs32
fs/befs/linuxvfs.c:812:7: warning: cast to restricted __be32
fs/befs/linuxvfs.c:812:7: warning: cast from restricted fs32
fs/befs/linuxvfs.c:812:7: warning: cast to restricted __be32
fs/befs/linuxvfs.c:812:7: warning: cast from restricted fs32
fs/befs/linuxvfs.c:812:7: warning: cast to restricted __be32
fs/befs/linuxvfs.c:812:7: warning: cast from restricted fs32
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: "Sergey S. Kostyliov" <rathamahata@php4.ru>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/befs')
-rw-r--r-- | fs/befs/befs_fs_types.h | 4 | ||||
-rw-r--r-- | fs/befs/linuxvfs.c | 4 | ||||
-rw-r--r-- | fs/befs/super.c | 6 |
3 files changed, 9 insertions, 5 deletions
diff --git a/fs/befs/befs_fs_types.h b/fs/befs/befs_fs_types.h index e2595c2c403a..7893eaa1e58c 100644 --- a/fs/befs/befs_fs_types.h +++ b/fs/befs/befs_fs_types.h | |||
@@ -55,8 +55,12 @@ enum super_flags { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | #define BEFS_BYTEORDER_NATIVE 0x42494745 | 57 | #define BEFS_BYTEORDER_NATIVE 0x42494745 |
58 | #define BEFS_BYTEORDER_NATIVE_LE (__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE) | ||
59 | #define BEFS_BYTEORDER_NATIVE_BE (__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE) | ||
58 | 60 | ||
59 | #define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1 | 61 | #define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1 |
62 | #define BEFS_SUPER_MAGIC1_LE (__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1) | ||
63 | #define BEFS_SUPER_MAGIC1_BE (__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1) | ||
60 | 64 | ||
61 | /* | 65 | /* |
62 | * Flags of inode | 66 | * Flags of inode |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 9286b2af893a..b6dfee37c7b7 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -809,8 +809,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) | |||
809 | 809 | ||
810 | /* account for offset of super block on x86 */ | 810 | /* account for offset of super block on x86 */ |
811 | disk_sb = (befs_super_block *) bh->b_data; | 811 | disk_sb = (befs_super_block *) bh->b_data; |
812 | if ((le32_to_cpu(disk_sb->magic1) == BEFS_SUPER_MAGIC1) || | 812 | if ((disk_sb->magic1 == BEFS_SUPER_MAGIC1_LE) || |
813 | (be32_to_cpu(disk_sb->magic1) == BEFS_SUPER_MAGIC1)) { | 813 | (disk_sb->magic1 == BEFS_SUPER_MAGIC1_BE)) { |
814 | befs_debug(sb, "Using PPC superblock location"); | 814 | befs_debug(sb, "Using PPC superblock location"); |
815 | } else { | 815 | } else { |
816 | befs_debug(sb, "Using x86 superblock location"); | 816 | befs_debug(sb, "Using x86 superblock location"); |
diff --git a/fs/befs/super.c b/fs/befs/super.c index 8c3401ff6d6a..41f2b4d0093e 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c | |||
@@ -26,10 +26,10 @@ befs_load_sb(struct super_block *sb, befs_super_block * disk_sb) | |||
26 | befs_sb_info *befs_sb = BEFS_SB(sb); | 26 | befs_sb_info *befs_sb = BEFS_SB(sb); |
27 | 27 | ||
28 | /* Check the byte order of the filesystem */ | 28 | /* Check the byte order of the filesystem */ |
29 | if (le32_to_cpu(disk_sb->fs_byte_order) == BEFS_BYTEORDER_NATIVE) | 29 | if (disk_sb->fs_byte_order == BEFS_BYTEORDER_NATIVE_LE) |
30 | befs_sb->byte_order = BEFS_BYTESEX_LE; | 30 | befs_sb->byte_order = BEFS_BYTESEX_LE; |
31 | else if (be32_to_cpu(disk_sb->fs_byte_order) == BEFS_BYTEORDER_NATIVE) | 31 | else if (disk_sb->fs_byte_order == BEFS_BYTEORDER_NATIVE_BE) |
32 | befs_sb->byte_order = BEFS_BYTESEX_BE; | 32 | befs_sb->byte_order = BEFS_BYTESEX_BE; |
33 | 33 | ||
34 | befs_sb->magic1 = fs32_to_cpu(sb, disk_sb->magic1); | 34 | befs_sb->magic1 = fs32_to_cpu(sb, disk_sb->magic1); |
35 | befs_sb->magic2 = fs32_to_cpu(sb, disk_sb->magic2); | 35 | befs_sb->magic2 = fs32_to_cpu(sb, disk_sb->magic2); |