Skip to content

Commit 533770c

Browse files
author
Al Viro
committed
new helper: get_tree_keyed()
For vfs_get_keyed_super users. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 1dd9bc0 commit 533770c

6 files changed

Lines changed: 20 additions & 9 deletions

File tree

‎fs/nfsd/nfsctl.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,8 +1386,7 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc)
13861386

13871387
static int nfsd_fs_get_tree(struct fs_context *fc)
13881388
{
1389-
fc->s_fs_info = get_net(fc->net_ns);
1390-
return vfs_get_super(fc, vfs_get_keyed_super, nfsd_fill_super);
1389+
return get_tree_keyed(fc, nfsd_fill_super, get_net(fc->net_ns));
13911390
}
13921391

13931392
static void nfsd_fs_free_fc(struct fs_context *fc)

‎fs/proc/root.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ static int proc_get_tree(struct fs_context *fc)
157157
{
158158
struct proc_fs_context *ctx = fc->fs_private;
159159

160-
fc->s_fs_info = ctx->pid_ns;
161-
return vfs_get_super(fc, vfs_get_keyed_super, proc_fill_super);
160+
return get_tree_keyed(fc, proc_fill_super, ctx->pid_ns);
162161
}
163162

164163
static void proc_fs_context_free(struct fs_context *fc)

‎fs/super.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,16 @@ int get_tree_single(struct fs_context *fc,
12111211
}
12121212
EXPORT_SYMBOL(get_tree_single);
12131213

1214+
int get_tree_keyed(struct fs_context *fc,
1215+
int (*fill_super)(struct super_block *sb,
1216+
struct fs_context *fc),
1217+
void *key)
1218+
{
1219+
fc->s_fs_info = key;
1220+
return vfs_get_super(fc, vfs_get_keyed_super, fill_super);
1221+
}
1222+
EXPORT_SYMBOL(get_tree_keyed);
1223+
12141224
#ifdef CONFIG_BLOCK
12151225
static int set_bdev_super(struct super_block *s, void *data)
12161226
{

‎include/linux/fs_context.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ extern int vfs_get_tree(struct fs_context *fc);
136136
extern void put_fs_context(struct fs_context *fc);
137137

138138
/*
139-
* sget() wrapper to be called from the ->get_tree() op.
139+
* sget() wrappers to be called from the ->get_tree() op.
140140
*/
141141
enum vfs_get_super_keying {
142142
vfs_get_single_super, /* Only one such superblock may exist */
@@ -147,12 +147,17 @@ extern int vfs_get_super(struct fs_context *fc,
147147
enum vfs_get_super_keying keying,
148148
int (*fill_super)(struct super_block *sb,
149149
struct fs_context *fc));
150+
150151
extern int get_tree_nodev(struct fs_context *fc,
151152
int (*fill_super)(struct super_block *sb,
152153
struct fs_context *fc));
153154
extern int get_tree_single(struct fs_context *fc,
154155
int (*fill_super)(struct super_block *sb,
155156
struct fs_context *fc));
157+
extern int get_tree_keyed(struct fs_context *fc,
158+
int (*fill_super)(struct super_block *sb,
159+
struct fs_context *fc),
160+
void *key);
156161

157162
extern const struct file_operations fscontext_fops;
158163

‎ipc/mqueue.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ static int mqueue_get_tree(struct fs_context *fc)
364364
{
365365
struct mqueue_fs_context *ctx = fc->fs_private;
366366

367-
fc->s_fs_info = ctx->ipc_ns;
368-
return vfs_get_super(fc, vfs_get_keyed_super, mqueue_fill_super);
367+
return get_tree_keyed(fc, mqueue_fill_super, ctx->ipc_ns);
369368
}
370369

371370
static void mqueue_fs_context_free(struct fs_context *fc)

‎net/sunrpc/rpc_pipe.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,8 +1416,7 @@ EXPORT_SYMBOL_GPL(gssd_running);
14161416

14171417
static int rpc_fs_get_tree(struct fs_context *fc)
14181418
{
1419-
fc->s_fs_info = get_net(fc->net_ns);
1420-
return vfs_get_super(fc, vfs_get_keyed_super, rpc_fill_super);
1419+
return get_tree_keyed(fc, rpc_fill_super, get_net(fc->net_ns));
14211420
}
14221421

14231422
static void rpc_fs_free_fc(struct fs_context *fc)

0 commit comments

Comments
 (0)