From f521ddc965538730bdb9944ed6bc25e1b5c9dcdb Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Sat, 4 Sep 2004 06:42:10 -0700 Subject: [PATCH] [PATCH] ext2 endianness fixes Several places printk a little-endian number without any conversions. Ones in super.c are particulary unpleasant - there we are getting told that fs couldn't be mounted because of the following set of incompat features and it would be nice to have the printed number matching what one could find in headers... Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/ext2/balloc.c | 4 ++-- fs/ext2/ialloc.c | 4 ++-- fs/ext2/super.c | 18 ++++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index f5a6b336f708f..bc19e7c2e5040 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c @@ -88,8 +88,8 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) if (!bh) ext2_error (sb, "read_block_bitmap", "Cannot read block bitmap - " - "block_group = %d, block_bitmap = %lu", - block_group, (unsigned long) desc->bg_block_bitmap); + "block_group = %d, block_bitmap = %u", + block_group, le32_to_cpu(desc->bg_block_bitmap)); error_out: return bh; } diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index e03b542313ec2..3a01038f7e5dd 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c @@ -57,8 +57,8 @@ read_inode_bitmap(struct super_block * sb, unsigned long block_group) if (!bh) ext2_error(sb, "read_inode_bitmap", "Cannot read inode bitmap - " - "block_group = %lu, inode_bitmap = %lu", - block_group, (unsigned long) desc->bg_inode_bitmap); + "block_group = %lu, inode_bitmap = %u", + block_group, le32_to_cpu(desc->bg_inode_bitmap)); error_out: return bh; } diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 28a820e3f27ae..9d1e1aa0693bb 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -573,6 +573,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) int blocksize = BLOCK_SIZE; int db_count; int i, j; + __u32 features; sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) @@ -662,17 +663,18 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) * previously didn't change the revision level when setting the flags, * so there is a chance incompat flags are set on a rev 0 filesystem. */ - if ((i = EXT2_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP))) { + features = EXT2_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP); + if (features) { printk("EXT2-fs: %s: couldn't mount because of " "unsupported optional features (%x).\n", - sb->s_id, i); + sb->s_id, le32_to_cpu(features)); goto failed_mount; } if (!(sb->s_flags & MS_RDONLY) && - (i = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ + (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ printk("EXT2-fs: %s: couldn't mount RDWR because of " "unsupported optional features (%x).\n", - sb->s_id, i); + sb->s_id, le32_to_cpu(features)); goto failed_mount; } blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); @@ -938,12 +940,12 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) es->s_state = cpu_to_le16(sbi->s_mount_state); es->s_mtime = cpu_to_le32(get_seconds()); } else { - int ret; - if ((ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, - ~EXT2_FEATURE_RO_COMPAT_SUPP))) { + __u32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, + ~EXT2_FEATURE_RO_COMPAT_SUPP); + if (ret) { printk("EXT2-fs: %s: couldn't remount RDWR because of " "unsupported optional features (%x).\n", - sb->s_id, ret); + sb->s_id, le32_to_cpu(ret)); return -EROFS; } /* -- 2.53.0