convert get_sb_mtd() users to ->mount()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2010-07-25 00:56:46 +04:00
parent 152a083666
commit 848b83a59b
4 changed files with 36 additions and 49 deletions

View File

@ -54,11 +54,10 @@ static int get_sb_mtd_set(struct super_block *sb, void *_mtd)
/* /*
* get a superblock on an MTD-backed filesystem * get a superblock on an MTD-backed filesystem
*/ */
static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags, static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, const char *dev_name, void *data,
struct mtd_info *mtd, struct mtd_info *mtd,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
struct super_block *sb; struct super_block *sb;
int ret; int ret;
@ -79,57 +78,49 @@ static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags,
ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (ret < 0) { if (ret < 0) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
return ret; return ERR_PTR(ret);
} }
/* go */ /* go */
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
simple_set_mnt(mnt, sb); return dget(sb->s_root);
return 0;
/* new mountpoint for an already mounted superblock */ /* new mountpoint for an already mounted superblock */
already_mounted: already_mounted:
DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n", DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n",
mtd->index, mtd->name); mtd->index, mtd->name);
simple_set_mnt(mnt, sb); put_mtd_device(mtd);
ret = 0; return dget(sb->s_root);
goto out_put;
out_error: out_error:
ret = PTR_ERR(sb);
out_put:
put_mtd_device(mtd); put_mtd_device(mtd);
return ret; return ERR_CAST(sb);
} }
/* /*
* get a superblock on an MTD-backed filesystem by MTD device number * get a superblock on an MTD-backed filesystem by MTD device number
*/ */
static int get_sb_mtd_nr(struct file_system_type *fs_type, int flags, static struct dentry *mount_mtd_nr(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, int mtdnr, const char *dev_name, void *data, int mtdnr,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
struct mtd_info *mtd; struct mtd_info *mtd;
mtd = get_mtd_device(NULL, mtdnr); mtd = get_mtd_device(NULL, mtdnr);
if (IS_ERR(mtd)) { if (IS_ERR(mtd)) {
DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr); DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr);
return PTR_ERR(mtd); return ERR_CAST(mtd);
} }
return get_sb_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super, return mount_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super);
mnt);
} }
/* /*
* set up an MTD-based superblock * set up an MTD-based superblock
*/ */
int get_sb_mtd(struct file_system_type *fs_type, int flags, struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
struct block_device *bdev; struct block_device *bdev;
@ -138,7 +129,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
int mtdnr; int mtdnr;
if (!dev_name) if (!dev_name)
return -EINVAL; return ERR_PTR(-EINVAL);
DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name); DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name);
@ -156,10 +147,10 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
mtd = get_mtd_device_nm(dev_name + 4); mtd = get_mtd_device_nm(dev_name + 4);
if (!IS_ERR(mtd)) if (!IS_ERR(mtd))
return get_sb_mtd_aux( return mount_mtd_aux(
fs_type, flags, fs_type, flags,
dev_name, data, mtd, dev_name, data, mtd,
fill_super, mnt); fill_super);
printk(KERN_NOTICE "MTD:" printk(KERN_NOTICE "MTD:"
" MTD device with name \"%s\" not found.\n", " MTD device with name \"%s\" not found.\n",
@ -174,9 +165,9 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
/* It was a valid number */ /* It was a valid number */
DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n", DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n",
mtdnr); mtdnr);
return get_sb_mtd_nr(fs_type, flags, return mount_mtd_nr(fs_type, flags,
dev_name, data, dev_name, data,
mtdnr, fill_super, mnt); mtdnr, fill_super);
} }
} }
} }
@ -189,7 +180,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
ret = PTR_ERR(bdev); ret = PTR_ERR(bdev);
DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret); DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret);
return ret; return ERR_PTR(ret);
} }
DEBUG(1, "MTDSB: lookup_bdev() returned 0\n"); DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");
@ -202,8 +193,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
if (major != MTD_BLOCK_MAJOR) if (major != MTD_BLOCK_MAJOR)
goto not_an_MTD_device; goto not_an_MTD_device;
return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, return mount_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super);
mnt);
not_an_MTD_device: not_an_MTD_device:
#endif /* CONFIG_BLOCK */ #endif /* CONFIG_BLOCK */
@ -212,10 +202,10 @@ not_an_MTD_device:
printk(KERN_NOTICE printk(KERN_NOTICE
"MTD: Attempt to mount non-MTD device \"%s\"\n", "MTD: Attempt to mount non-MTD device \"%s\"\n",
dev_name); dev_name);
return -EINVAL; return ERR_PTR(-EINVAL);
} }
EXPORT_SYMBOL_GPL(get_sb_mtd); EXPORT_SYMBOL_GPL(mount_mtd);
/* /*
* destroy an MTD-based superblock * destroy an MTD-based superblock

View File

@ -179,12 +179,11 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
return ret; return ret;
} }
static int jffs2_get_sb(struct file_system_type *fs_type, static struct dentry *jffs2_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_mtd(fs_type, flags, dev_name, data, jffs2_fill_super, return mount_mtd(fs_type, flags, dev_name, data, jffs2_fill_super);
mnt);
} }
static void jffs2_put_super (struct super_block *sb) static void jffs2_put_super (struct super_block *sb)
@ -229,7 +228,7 @@ static void jffs2_kill_sb(struct super_block *sb)
static struct file_system_type jffs2_fs_type = { static struct file_system_type jffs2_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "jffs2", .name = "jffs2",
.get_sb = jffs2_get_sb, .mount = jffs2_mount,
.kill_sb = jffs2_kill_sb, .kill_sb = jffs2_kill_sb,
}; };

View File

@ -552,20 +552,19 @@ error_rsb:
/* /*
* get a superblock for mounting * get a superblock for mounting
*/ */
static int romfs_get_sb(struct file_system_type *fs_type, static struct dentry *romfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
int ret = -EINVAL; struct dentry *ret = ERR_PTR(-EINVAL);
#ifdef CONFIG_ROMFS_ON_MTD #ifdef CONFIG_ROMFS_ON_MTD
ret = get_sb_mtd(fs_type, flags, dev_name, data, romfs_fill_super, ret = mount_mtd(fs_type, flags, dev_name, data, romfs_fill_super);
mnt);
#endif #endif
#ifdef CONFIG_ROMFS_ON_BLOCK #ifdef CONFIG_ROMFS_ON_BLOCK
if (ret == -EINVAL) if (ret == ERR_PTR(-EINVAL))
ret = get_sb_bdev(fs_type, flags, dev_name, data, ret = mount_bdev(fs_type, flags, dev_name, data,
romfs_fill_super, mnt); romfs_fill_super);
#endif #endif
return ret; return ret;
} }
@ -592,7 +591,7 @@ static void romfs_kill_sb(struct super_block *sb)
static struct file_system_type romfs_fs_type = { static struct file_system_type romfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "romfs", .name = "romfs",
.get_sb = romfs_get_sb, .mount = romfs_mount,
.kill_sb = romfs_kill_sb, .kill_sb = romfs_kill_sb,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -18,10 +18,9 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mount.h> #include <linux/mount.h>
extern int get_sb_mtd(struct file_system_type *fs_type, int flags, extern struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int));
struct vfsmount *mnt);
extern void kill_mtd_super(struct super_block *sb); extern void kill_mtd_super(struct super_block *sb);