Commit f521ddc9 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[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: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 943315ac
...@@ -88,8 +88,8 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) ...@@ -88,8 +88,8 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
if (!bh) if (!bh)
ext2_error (sb, "read_block_bitmap", ext2_error (sb, "read_block_bitmap",
"Cannot read block bitmap - " "Cannot read block bitmap - "
"block_group = %d, block_bitmap = %lu", "block_group = %d, block_bitmap = %u",
block_group, (unsigned long) desc->bg_block_bitmap); block_group, le32_to_cpu(desc->bg_block_bitmap));
error_out: error_out:
return bh; return bh;
} }
......
...@@ -57,8 +57,8 @@ read_inode_bitmap(struct super_block * sb, unsigned long block_group) ...@@ -57,8 +57,8 @@ read_inode_bitmap(struct super_block * sb, unsigned long block_group)
if (!bh) if (!bh)
ext2_error(sb, "read_inode_bitmap", ext2_error(sb, "read_inode_bitmap",
"Cannot read inode bitmap - " "Cannot read inode bitmap - "
"block_group = %lu, inode_bitmap = %lu", "block_group = %lu, inode_bitmap = %u",
block_group, (unsigned long) desc->bg_inode_bitmap); block_group, le32_to_cpu(desc->bg_inode_bitmap));
error_out: error_out:
return bh; return bh;
} }
......
...@@ -573,6 +573,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -573,6 +573,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
int blocksize = BLOCK_SIZE; int blocksize = BLOCK_SIZE;
int db_count; int db_count;
int i, j; int i, j;
__u32 features;
sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi) if (!sbi)
...@@ -662,17 +663,18 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -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, * 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. * 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 " printk("EXT2-fs: %s: couldn't mount because of "
"unsupported optional features (%x).\n", "unsupported optional features (%x).\n",
sb->s_id, i); sb->s_id, le32_to_cpu(features));
goto failed_mount; goto failed_mount;
} }
if (!(sb->s_flags & MS_RDONLY) && 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 " printk("EXT2-fs: %s: couldn't mount RDWR because of "
"unsupported optional features (%x).\n", "unsupported optional features (%x).\n",
sb->s_id, i); sb->s_id, le32_to_cpu(features));
goto failed_mount; goto failed_mount;
} }
blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); 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) ...@@ -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_state = cpu_to_le16(sbi->s_mount_state);
es->s_mtime = cpu_to_le32(get_seconds()); es->s_mtime = cpu_to_le32(get_seconds());
} else { } else {
int ret; __u32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb,
if ((ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP);
~EXT2_FEATURE_RO_COMPAT_SUPP))) { if (ret) {
printk("EXT2-fs: %s: couldn't remount RDWR because of " printk("EXT2-fs: %s: couldn't remount RDWR because of "
"unsupported optional features (%x).\n", "unsupported optional features (%x).\n",
sb->s_id, ret); sb->s_id, le32_to_cpu(ret));
return -EROFS; return -EROFS;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment