diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-07-24 16:46:55 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-10-29 04:16:13 -0400 |
commit | 152a08366671080f27b32e0c411ad620c5f88b57 (patch) | |
tree | d13d16028f74839c678bce355ba8aac75d939fa8 /fs/super.c | |
parent | c96e41e92b4aaf11e1f9775ecf0d1c8cbff829ed (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.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/fs/super.c b/fs/super.c index 00a2c9662b55..40989e9a2606 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 | ||
765 | int get_sb_bdev(struct file_system_type *fs_type, | 765 | struct 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 | ||
835 | error_s: | 833 | error_s: |
836 | error = PTR_ERR(s); | 834 | error = PTR_ERR(s); |
837 | error_bdev: | 835 | error_bdev: |
838 | close_bdev_exclusive(bdev, mode); | 836 | close_bdev_exclusive(bdev, mode); |
839 | error: | 837 | error: |
840 | return error; | 838 | return ERR_PTR(error); |
839 | } | ||
840 | EXPORT_SYMBOL(mount_bdev); | ||
841 | |||
842 | int 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 | ||
843 | EXPORT_SYMBOL(get_sb_bdev); | 857 | EXPORT_SYMBOL(get_sb_bdev); |