aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/fs/super.c b/fs/super.c
index 40989e9a2606..6f021a171ac6 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -900,29 +900,42 @@ static int compare_single(struct super_block *s, void *p)
900 return 1; 900 return 1;
901} 901}
902 902
903int get_sb_single(struct file_system_type *fs_type, 903struct dentry *mount_single(struct file_system_type *fs_type,
904 int flags, void *data, 904 int flags, void *data,
905 int (*fill_super)(struct super_block *, void *, int), 905 int (*fill_super)(struct super_block *, void *, int))
906 struct vfsmount *mnt)
907{ 906{
908 struct super_block *s; 907 struct super_block *s;
909 int error; 908 int error;
910 909
911 s = sget(fs_type, compare_single, set_anon_super, NULL); 910 s = sget(fs_type, compare_single, set_anon_super, NULL);
912 if (IS_ERR(s)) 911 if (IS_ERR(s))
913 return PTR_ERR(s); 912 return ERR_CAST(s);
914 if (!s->s_root) { 913 if (!s->s_root) {
915 s->s_flags = flags; 914 s->s_flags = flags;
916 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 915 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
917 if (error) { 916 if (error) {
918 deactivate_locked_super(s); 917 deactivate_locked_super(s);
919 return error; 918 return ERR_PTR(error);
920 } 919 }
921 s->s_flags |= MS_ACTIVE; 920 s->s_flags |= MS_ACTIVE;
922 } else { 921 } else {
923 do_remount_sb(s, flags, data, 0); 922 do_remount_sb(s, flags, data, 0);
924 } 923 }
925 simple_set_mnt(mnt, s); 924 return dget(s->s_root);
925}
926EXPORT_SYMBOL(mount_single);
927
928int get_sb_single(struct file_system_type *fs_type,
929 int flags, void *data,
930 int (*fill_super)(struct super_block *, void *, int),
931 struct vfsmount *mnt)
932{
933 struct dentry *root;
934 root = mount_single(fs_type, flags, data, fill_super);
935 if (IS_ERR(root))
936 return PTR_ERR(root);
937 mnt->mnt_root = root;
938 mnt->mnt_sb = root->d_sb;
926 return 0; 939 return 0;
927} 940}
928 941