summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-03-24 00:36:45 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-04-01 00:03:16 +0400
commit39429c5e4a2c56a39c9a1c9bdad54431c63104b0 (patch)
tree06abc2a4ff8d323b0358b768a71c7b651c3229f3 /init
parent2f99c36986ff27a86f06f27212c5f5fa8c7164a3 (diff)
downloadlinux-39429c5e4a2c56a39c9a1c9bdad54431c63104b0.tar.xz
new helper: ext2_image_size()
... implemented that way since the next commit will leave it almost alone in ext2_fs.h - most of the file (including struct ext2_super_block) is going to move to fs/ext2/ext2.h. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'init')
-rw-r--r--init/do_mounts_rd.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index 01f1306aa26e..6212586df29a 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -54,20 +54,19 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
{
const int size = 512;
struct minix_super_block *minixsb;
- struct ext2_super_block *ext2sb;
struct romfs_super_block *romfsb;
struct cramfs_super *cramfsb;
struct squashfs_super_block *squashfsb;
int nblocks = -1;
unsigned char *buf;
const char *compress_name;
+ unsigned long n;
buf = kmalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
minixsb = (struct minix_super_block *) buf;
- ext2sb = (struct ext2_super_block *) buf;
romfsb = (struct romfs_super_block *) buf;
cramfsb = (struct cramfs_super *) buf;
squashfsb = (struct squashfs_super_block *) buf;
@@ -150,12 +149,12 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
}
/* Try ext2 */
- if (ext2sb->s_magic == cpu_to_le16(EXT2_SUPER_MAGIC)) {
+ n = ext2_image_size(buf);
+ if (n) {
printk(KERN_NOTICE
"RAMDISK: ext2 filesystem found at block %d\n",
start_block);
- nblocks = le32_to_cpu(ext2sb->s_blocks_count) <<
- le32_to_cpu(ext2sb->s_log_block_size);
+ nblocks = n;
goto done;
}