aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-07-24 16:46:55 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-10-29 04:16:13 -0400
commit152a08366671080f27b32e0c411ad620c5f88b57 (patch)
treed13d16028f74839c678bce355ba8aac75d939fa8 /fs/super.c
parentc96e41e92b4aaf11e1f9775ecf0d1c8cbff829ed (diff)
new helper: mount_bdev()
... and switch of the obvious get_sb_bdev() users to ->mount() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/fs/super.c b/fs/super.c
index 00a2c9662b5..40989e9a260 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -762,10 +762,9 @@ static int test_bdev_super(struct super_block *s, void *data)
762 return (void *)s->s_bdev == data; 762 return (void *)s->s_bdev == data;
763} 763}
764 764
765int get_sb_bdev(struct file_system_type *fs_type, 765struct dentry *mount_bdev(struct file_system_type *fs_type,
766 int flags, const char *dev_name, void *data, 766 int flags, const char *dev_name, void *data,
767 int (*fill_super)(struct super_block *, void *, int), 767 int (*fill_super)(struct super_block *, void *, int))
768 struct vfsmount *mnt)
769{ 768{
770 struct block_device *bdev; 769 struct block_device *bdev;
771 struct super_block *s; 770 struct super_block *s;
@@ -777,7 +776,7 @@ int get_sb_bdev(struct file_system_type *fs_type,
777 776
778 bdev = open_bdev_exclusive(dev_name, mode, fs_type); 777 bdev = open_bdev_exclusive(dev_name, mode, fs_type);
779 if (IS_ERR(bdev)) 778 if (IS_ERR(bdev))
780 return PTR_ERR(bdev); 779 return ERR_CAST(bdev);
781 780
782 /* 781 /*
783 * once the super is inserted into the list by sget, s_umount 782 * once the super is inserted into the list by sget, s_umount
@@ -829,15 +828,30 @@ int get_sb_bdev(struct file_system_type *fs_type,
829 bdev->bd_super = s; 828 bdev->bd_super = s;
830 } 829 }
831 830
832 simple_set_mnt(mnt, s); 831 return dget(s->s_root);
833 return 0;
834 832
835error_s: 833error_s:
836 error = PTR_ERR(s); 834 error = PTR_ERR(s);
837error_bdev: 835error_bdev:
838 close_bdev_exclusive(bdev, mode); 836 close_bdev_exclusive(bdev, mode);
839error: 837error:
840 return error; 838 return ERR_PTR(error);
839}
840EXPORT_SYMBOL(mount_bdev);
841
842int get_sb_bdev(struct file_system_type *fs_type,
843 int flags, const char *dev_name, void *data,
844 int (*fill_super)(struct super_block *, void *, int),
845 struct vfsmount *mnt)
846{
847 struct dentry *root;
848
849 root = mount_bdev(fs_type, flags, dev_name, data, fill_super);
850 if (IS_ERR(root))
851 return PTR_ERR(root);
852 mnt->mnt_root = root;
853 mnt->mnt_sb = root->d_sb;
854 return 0;
841} 855}
842 856
843EXPORT_SYMBOL(get_sb_bdev); 857EXPORT_SYMBOL(get_sb_bdev);