new helper: get_tree_keyed()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 3 Sep 2019 23:05:48 +0000 (19:05 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 5 Sep 2019 18:34:22 +0000 (14:34 -0400)
For vfs_get_keyed_super users.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/nfsd/nfsctl.c
fs/proc/root.c
fs/super.c
include/linux/fs_context.h
ipc/mqueue.c
net/sunrpc/rpc_pipe.c

index 13c548733860cca6414b23bc30caea2d64c69b02..6952233949851859de2d0bd9b872638e7585d9ac 100644 (file)
@@ -1386,8 +1386,7 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc)
 
 static int nfsd_fs_get_tree(struct fs_context *fc)
 {
-       fc->s_fs_info = get_net(fc->net_ns);
-       return vfs_get_super(fc, vfs_get_keyed_super, nfsd_fill_super);
+       return get_tree_keyed(fc, nfsd_fill_super, get_net(fc->net_ns));
 }
 
 static void nfsd_fs_free_fc(struct fs_context *fc)
index 33f72d1b92cca60ef9f187ac7ccfbc873c0bf7e1..0b7c8dffc9ae85d6c07871998d8e75822899be9b 100644 (file)
@@ -157,8 +157,7 @@ static int proc_get_tree(struct fs_context *fc)
 {
        struct proc_fs_context *ctx = fc->fs_private;
 
-       fc->s_fs_info = ctx->pid_ns;
-       return vfs_get_super(fc, vfs_get_keyed_super, proc_fill_super);
+       return get_tree_keyed(fc, proc_fill_super, ctx->pid_ns);
 }
 
 static void proc_fs_context_free(struct fs_context *fc)
index 5960578a40760a26bc0ecd88e28177ce748f4380..0220def9baba704d228eb2934abbe54023f161ba 100644 (file)
@@ -1211,6 +1211,16 @@ int get_tree_single(struct fs_context *fc,
 }
 EXPORT_SYMBOL(get_tree_single);
 
+int get_tree_keyed(struct fs_context *fc,
+                 int (*fill_super)(struct super_block *sb,
+                                   struct fs_context *fc),
+               void *key)
+{
+       fc->s_fs_info = key;
+       return vfs_get_super(fc, vfs_get_keyed_super, fill_super);
+}
+EXPORT_SYMBOL(get_tree_keyed);
+
 #ifdef CONFIG_BLOCK
 static int set_bdev_super(struct super_block *s, void *data)
 {
index 7c6fe3d47fa6aef9ac550938589e64bac83f925b..aad5e68d58e29bc73d403a74c27bbd92c9280ba4 100644 (file)
@@ -136,7 +136,7 @@ extern int vfs_get_tree(struct fs_context *fc);
 extern void put_fs_context(struct fs_context *fc);
 
 /*
- * sget() wrapper to be called from the ->get_tree() op.
+ * sget() wrappers to be called from the ->get_tree() op.
  */
 enum vfs_get_super_keying {
        vfs_get_single_super,   /* Only one such superblock may exist */
@@ -147,12 +147,17 @@ extern int vfs_get_super(struct fs_context *fc,
                         enum vfs_get_super_keying keying,
                         int (*fill_super)(struct super_block *sb,
                                           struct fs_context *fc));
+
 extern int get_tree_nodev(struct fs_context *fc,
                         int (*fill_super)(struct super_block *sb,
                                           struct fs_context *fc));
 extern int get_tree_single(struct fs_context *fc,
                         int (*fill_super)(struct super_block *sb,
                                           struct fs_context *fc));
+extern int get_tree_keyed(struct fs_context *fc,
+                        int (*fill_super)(struct super_block *sb,
+                                          struct fs_context *fc),
+                        void *key);
 
 extern const struct file_operations fscontext_fops;
 
index 7a5a8edc3de3f6f30fa416147618d8e4caba5704..7c15729d9d25a36711ae2d70db206f5f633e64a1 100644 (file)
@@ -364,8 +364,7 @@ static int mqueue_get_tree(struct fs_context *fc)
 {
        struct mqueue_fs_context *ctx = fc->fs_private;
 
-       fc->s_fs_info = ctx->ipc_ns;
-       return vfs_get_super(fc, vfs_get_keyed_super, mqueue_fill_super);
+       return get_tree_keyed(fc, mqueue_fill_super, ctx->ipc_ns);
 }
 
 static void mqueue_fs_context_free(struct fs_context *fc)
index 748bac601e47df6bcfc3fed63909eeb44db98d23..b71a39ded930a2408ce19f4165fee5e0dc5dc650 100644 (file)
@@ -1416,8 +1416,7 @@ EXPORT_SYMBOL_GPL(gssd_running);
 
 static int rpc_fs_get_tree(struct fs_context *fc)
 {
-       fc->s_fs_info = get_net(fc->net_ns);
-       return vfs_get_super(fc, vfs_get_keyed_super, rpc_fill_super);
+       return get_tree_keyed(fc, rpc_fill_super, get_net(fc->net_ns));
 }
 
 static void rpc_fs_free_fc(struct fs_context *fc)