aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-07-24 17:48:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-10-29 04:16:28 -0400
commitfc14f2fef682df677d64a145256dbd263df2aa7b (patch)
tree74f6b939fbad959a43c04ec646cd0adc8af5f53a /fs
parent848b83a59b772b8f102bc5e3f1187c2fa5676959 (diff)
convert get_sb_single() users
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_misc.c8
-rw-r--r--fs/configfs/mount.c8
-rw-r--r--fs/debugfs/inode.c8
-rw-r--r--fs/devpts/inode.c32
-rw-r--r--fs/fuse/control.c10
-rw-r--r--fs/nfsd/nfsctl.c8
-rw-r--r--fs/openpromfs/inode.c8
-rw-r--r--fs/super.c25
8 files changed, 58 insertions, 49 deletions
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 29990f0eee0c..1befe2ec8186 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -706,10 +706,10 @@ static int bm_fill_super(struct super_block * sb, void * data, int silent)
706 return err; 706 return err;
707} 707}
708 708
709static int bm_get_sb(struct file_system_type *fs_type, 709static struct dentry *bm_mount(struct file_system_type *fs_type,
710 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 710 int flags, const char *dev_name, void *data)
711{ 711{
712 return get_sb_single(fs_type, flags, data, bm_fill_super, mnt); 712 return mount_single(fs_type, flags, data, bm_fill_super);
713} 713}
714 714
715static struct linux_binfmt misc_format = { 715static struct linux_binfmt misc_format = {
@@ -720,7 +720,7 @@ static struct linux_binfmt misc_format = {
720static struct file_system_type bm_fs_type = { 720static struct file_system_type bm_fs_type = {
721 .owner = THIS_MODULE, 721 .owner = THIS_MODULE,
722 .name = "binfmt_misc", 722 .name = "binfmt_misc",
723 .get_sb = bm_get_sb, 723 .mount = bm_mount,
724 .kill_sb = kill_litter_super, 724 .kill_sb = kill_litter_super,
725}; 725};
726 726
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 8c8d64230c2d..7d3607febe1c 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -104,16 +104,16 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
104 return 0; 104 return 0;
105} 105}
106 106
107static int configfs_get_sb(struct file_system_type *fs_type, 107static struct dentry *configfs_do_mount(struct file_system_type *fs_type,
108 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 108 int flags, const char *dev_name, void *data)
109{ 109{
110 return get_sb_single(fs_type, flags, data, configfs_fill_super, mnt); 110 return mount_single(fs_type, flags, data, configfs_fill_super);
111} 111}
112 112
113static struct file_system_type configfs_fs_type = { 113static struct file_system_type configfs_fs_type = {
114 .owner = THIS_MODULE, 114 .owner = THIS_MODULE,
115 .name = "configfs", 115 .name = "configfs",
116 .get_sb = configfs_get_sb, 116 .mount = configfs_do_mount,
117 .kill_sb = kill_litter_super, 117 .kill_sb = kill_litter_super,
118}; 118};
119 119
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index a4ed8380e98a..37a8ca7c1222 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -135,17 +135,17 @@ static int debug_fill_super(struct super_block *sb, void *data, int silent)
135 return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); 135 return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files);
136} 136}
137 137
138static int debug_get_sb(struct file_system_type *fs_type, 138static struct dentry *debug_mount(struct file_system_type *fs_type,
139 int flags, const char *dev_name, 139 int flags, const char *dev_name,
140 void *data, struct vfsmount *mnt) 140 void *data)
141{ 141{
142 return get_sb_single(fs_type, flags, data, debug_fill_super, mnt); 142 return mount_single(fs_type, flags, data, debug_fill_super);
143} 143}
144 144
145static struct file_system_type debug_fs_type = { 145static struct file_system_type debug_fs_type = {
146 .owner = THIS_MODULE, 146 .owner = THIS_MODULE,
147 .name = "debugfs", 147 .name = "debugfs",
148 .get_sb = debug_get_sb, 148 .mount = debug_mount,
149 .kill_sb = kill_litter_super, 149 .kill_sb = kill_litter_super,
150}; 150};
151 151
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 8b3ffd5b5235..1bb547c9cad6 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -331,7 +331,7 @@ static int compare_init_pts_sb(struct super_block *s, void *p)
331} 331}
332 332
333/* 333/*
334 * devpts_get_sb() 334 * devpts_mount()
335 * 335 *
336 * If the '-o newinstance' mount option was specified, mount a new 336 * If the '-o newinstance' mount option was specified, mount a new
337 * (private) instance of devpts. PTYs created in this instance are 337 * (private) instance of devpts. PTYs created in this instance are
@@ -345,20 +345,20 @@ static int compare_init_pts_sb(struct super_block *s, void *p)
345 * semantics in devpts while preserving backward compatibility of the 345 * semantics in devpts while preserving backward compatibility of the
346 * current 'single-namespace' semantics. i.e all mounts of devpts 346 * current 'single-namespace' semantics. i.e all mounts of devpts
347 * without the 'newinstance' mount option should bind to the initial 347 * without the 'newinstance' mount option should bind to the initial
348 * kernel mount, like get_sb_single(). 348 * kernel mount, like mount_single().
349 * 349 *
350 * Mounts with 'newinstance' option create a new, private namespace. 350 * Mounts with 'newinstance' option create a new, private namespace.
351 * 351 *
352 * NOTE: 352 * NOTE:
353 * 353 *
354 * For single-mount semantics, devpts cannot use get_sb_single(), 354 * For single-mount semantics, devpts cannot use mount_single(),
355 * because get_sb_single()/sget() find and use the super-block from 355 * because mount_single()/sget() find and use the super-block from
356 * the most recent mount of devpts. But that recent mount may be a 356 * the most recent mount of devpts. But that recent mount may be a
357 * 'newinstance' mount and get_sb_single() would pick the newinstance 357 * 'newinstance' mount and mount_single() would pick the newinstance
358 * super-block instead of the initial super-block. 358 * super-block instead of the initial super-block.
359 */ 359 */
360static int devpts_get_sb(struct file_system_type *fs_type, 360static struct dentry *devpts_mount(struct file_system_type *fs_type,
361 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 361 int flags, const char *dev_name, void *data)
362{ 362{
363 int error; 363 int error;
364 struct pts_mount_opts opts; 364 struct pts_mount_opts opts;
@@ -366,7 +366,7 @@ static int devpts_get_sb(struct file_system_type *fs_type,
366 366
367 error = parse_mount_options(data, PARSE_MOUNT, &opts); 367 error = parse_mount_options(data, PARSE_MOUNT, &opts);
368 if (error) 368 if (error)
369 return error; 369 return ERR_PTR(error);
370 370
371 if (opts.newinstance) 371 if (opts.newinstance)
372 s = sget(fs_type, NULL, set_anon_super, NULL); 372 s = sget(fs_type, NULL, set_anon_super, NULL);
@@ -374,7 +374,7 @@ static int devpts_get_sb(struct file_system_type *fs_type,
374 s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL); 374 s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL);
375 375
376 if (IS_ERR(s)) 376 if (IS_ERR(s))
377 return PTR_ERR(s); 377 return ERR_CAST(s);
378 378
379 if (!s->s_root) { 379 if (!s->s_root) {
380 s->s_flags = flags; 380 s->s_flags = flags;
@@ -390,13 +390,11 @@ static int devpts_get_sb(struct file_system_type *fs_type,
390 if (error) 390 if (error)
391 goto out_undo_sget; 391 goto out_undo_sget;
392 392
393 simple_set_mnt(mnt, s); 393 return dget(s->s_root);
394
395 return 0;
396 394
397out_undo_sget: 395out_undo_sget:
398 deactivate_locked_super(s); 396 deactivate_locked_super(s);
399 return error; 397 return ERR_PTR(error);
400} 398}
401 399
402#else 400#else
@@ -404,10 +402,10 @@ out_undo_sget:
404 * This supports only the legacy single-instance semantics (no 402 * This supports only the legacy single-instance semantics (no
405 * multiple-instance semantics) 403 * multiple-instance semantics)
406 */ 404 */
407static int devpts_get_sb(struct file_system_type *fs_type, int flags, 405static struct dentry *devpts_mount(struct file_system_type *fs_type, int flags,
408 const char *dev_name, void *data, struct vfsmount *mnt) 406 const char *dev_name, void *data)
409{ 407{
410 return get_sb_single(fs_type, flags, data, devpts_fill_super, mnt); 408 return mount_single(fs_type, flags, data, devpts_fill_super);
411} 409}
412#endif 410#endif
413 411
@@ -421,7 +419,7 @@ static void devpts_kill_sb(struct super_block *sb)
421 419
422static struct file_system_type devpts_fs_type = { 420static struct file_system_type devpts_fs_type = {
423 .name = "devpts", 421 .name = "devpts",
424 .get_sb = devpts_get_sb, 422 .mount = devpts_mount,
425 .kill_sb = devpts_kill_sb, 423 .kill_sb = devpts_kill_sb,
426}; 424};
427 425
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 4eba07661e5c..85542a7daf40 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -322,12 +322,10 @@ static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent)
322 return 0; 322 return 0;
323} 323}
324 324
325static int fuse_ctl_get_sb(struct file_system_type *fs_type, int flags, 325static struct dentry *fuse_ctl_mount(struct file_system_type *fs_type,
326 const char *dev_name, void *raw_data, 326 int flags, const char *dev_name, void *raw_data)
327 struct vfsmount *mnt)
328{ 327{
329 return get_sb_single(fs_type, flags, raw_data, 328 return mount_single(fs_type, flags, raw_data, fuse_ctl_fill_super);
330 fuse_ctl_fill_super, mnt);
331} 329}
332 330
333static void fuse_ctl_kill_sb(struct super_block *sb) 331static void fuse_ctl_kill_sb(struct super_block *sb)
@@ -346,7 +344,7 @@ static void fuse_ctl_kill_sb(struct super_block *sb)
346static struct file_system_type fuse_ctl_fs_type = { 344static struct file_system_type fuse_ctl_fs_type = {
347 .owner = THIS_MODULE, 345 .owner = THIS_MODULE,
348 .name = "fusectl", 346 .name = "fusectl",
349 .get_sb = fuse_ctl_get_sb, 347 .mount = fuse_ctl_mount,
350 .kill_sb = fuse_ctl_kill_sb, 348 .kill_sb = fuse_ctl_kill_sb,
351}; 349};
352 350
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index d6dc3f61f8ba..4514ebbee4d6 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1405,16 +1405,16 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
1405 return simple_fill_super(sb, 0x6e667364, nfsd_files); 1405 return simple_fill_super(sb, 0x6e667364, nfsd_files);
1406} 1406}
1407 1407
1408static int nfsd_get_sb(struct file_system_type *fs_type, 1408static struct dentry *nfsd_mount(struct file_system_type *fs_type,
1409 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1409 int flags, const char *dev_name, void *data)
1410{ 1410{
1411 return get_sb_single(fs_type, flags, data, nfsd_fill_super, mnt); 1411 return mount_single(fs_type, flags, data, nfsd_fill_super);
1412} 1412}
1413 1413
1414static struct file_system_type nfsd_fs_type = { 1414static struct file_system_type nfsd_fs_type = {
1415 .owner = THIS_MODULE, 1415 .owner = THIS_MODULE,
1416 .name = "nfsd", 1416 .name = "nfsd",
1417 .get_sb = nfsd_get_sb, 1417 .mount = nfsd_mount,
1418 .kill_sb = kill_litter_super, 1418 .kill_sb = kill_litter_super,
1419}; 1419};
1420 1420
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index ffcd04f0012c..ddb1f41376e5 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -415,16 +415,16 @@ out_no_root:
415 return ret; 415 return ret;
416} 416}
417 417
418static int openprom_get_sb(struct file_system_type *fs_type, 418static struct dentry *openprom_mount(struct file_system_type *fs_type,
419 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 419 int flags, const char *dev_name, void *data)
420{ 420{
421 return get_sb_single(fs_type, flags, data, openprom_fill_super, mnt); 421 return mount_single(fs_type, flags, data, openprom_fill_super)
422} 422}
423 423
424static struct file_system_type openprom_fs_type = { 424static struct file_system_type openprom_fs_type = {
425 .owner = THIS_MODULE, 425 .owner = THIS_MODULE,
426 .name = "openpromfs", 426 .name = "openpromfs",
427 .get_sb = openprom_get_sb, 427 .mount = openprom_mount,
428 .kill_sb = kill_anon_super, 428 .kill_sb = kill_anon_super,
429}; 429};
430 430
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