Commit 2309fb8e authored by Al Viro's avatar Al Viro

cramfs: get rid of ->put_super()

failure exits are simpler that way
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 842a859d
...@@ -219,10 +219,11 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i ...@@ -219,10 +219,11 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
return read_buffers[buffer] + offset; return read_buffers[buffer] + offset;
} }
static void cramfs_put_super(struct super_block *sb) static void cramfs_kill_sb(struct super_block *sb)
{ {
kfree(sb->s_fs_info); struct cramfs_sb_info *sbi = sb->s_fs_info;
sb->s_fs_info = NULL; kill_block_super(sb);
kfree(sbi);
} }
static int cramfs_remount(struct super_block *sb, int *flags, char *data) static int cramfs_remount(struct super_block *sb, int *flags, char *data)
...@@ -261,7 +262,7 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -261,7 +262,7 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
if (super.magic == CRAMFS_MAGIC_WEND) { if (super.magic == CRAMFS_MAGIC_WEND) {
if (!silent) if (!silent)
printk(KERN_ERR "cramfs: wrong endianness\n"); printk(KERN_ERR "cramfs: wrong endianness\n");
goto out; return -EINVAL;
} }
/* check at 512 byte offset */ /* check at 512 byte offset */
...@@ -273,20 +274,20 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -273,20 +274,20 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
printk(KERN_ERR "cramfs: wrong endianness\n"); printk(KERN_ERR "cramfs: wrong endianness\n");
else if (!silent) else if (!silent)
printk(KERN_ERR "cramfs: wrong magic\n"); printk(KERN_ERR "cramfs: wrong magic\n");
goto out; return -EINVAL;
} }
} }
/* get feature flags first */ /* get feature flags first */
if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) { if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) {
printk(KERN_ERR "cramfs: unsupported filesystem features\n"); printk(KERN_ERR "cramfs: unsupported filesystem features\n");
goto out; return -EINVAL;
} }
/* Check that the root inode is in a sane state */ /* Check that the root inode is in a sane state */
if (!S_ISDIR(super.root.mode)) { if (!S_ISDIR(super.root.mode)) {
printk(KERN_ERR "cramfs: root is not a directory\n"); printk(KERN_ERR "cramfs: root is not a directory\n");
goto out; return -EINVAL;
} }
/* correct strange, hard-coded permissions of mkcramfs */ /* correct strange, hard-coded permissions of mkcramfs */
super.root.mode |= (S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); super.root.mode |= (S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
...@@ -310,22 +311,18 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -310,22 +311,18 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
(root_offset != 512 + sizeof(struct cramfs_super)))) (root_offset != 512 + sizeof(struct cramfs_super))))
{ {
printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset); printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset);
goto out; return -EINVAL;
} }
/* Set it all up.. */ /* Set it all up.. */
sb->s_op = &cramfs_ops; sb->s_op = &cramfs_ops;
root = get_cramfs_inode(sb, &super.root, 0); root = get_cramfs_inode(sb, &super.root, 0);
if (IS_ERR(root)) if (IS_ERR(root))
goto out; return PTR_ERR(root);
sb->s_root = d_make_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) if (!sb->s_root)
goto out; return -ENOMEM;
return 0; return 0;
out:
kfree(sbi);
sb->s_fs_info = NULL;
return -EINVAL;
} }
static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf) static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
...@@ -550,7 +547,6 @@ static const struct inode_operations cramfs_dir_inode_operations = { ...@@ -550,7 +547,6 @@ static const struct inode_operations cramfs_dir_inode_operations = {
}; };
static const struct super_operations cramfs_ops = { static const struct super_operations cramfs_ops = {
.put_super = cramfs_put_super,
.remount_fs = cramfs_remount, .remount_fs = cramfs_remount,
.statfs = cramfs_statfs, .statfs = cramfs_statfs,
}; };
...@@ -565,7 +561,7 @@ static struct file_system_type cramfs_fs_type = { ...@@ -565,7 +561,7 @@ static struct file_system_type cramfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "cramfs", .name = "cramfs",
.mount = cramfs_mount, .mount = cramfs_mount,
.kill_sb = kill_block_super, .kill_sb = cramfs_kill_sb,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };
MODULE_ALIAS_FS("cramfs"); MODULE_ALIAS_FS("cramfs");
......
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