Skip to content

Commit 065e88f

Browse files
author
Al Viro
committed
rpc_gssd_dummy_populate(): don't bother with rpc_populate()
Just have it create gssd (in root), clntXX in gssd, then info and gssd in clntXX - all with explicit rpc_new_dir()/rpc_new_file()/rpc_mkpipe_dentry(). Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent a117bf4 commit 065e88f

1 file changed

Lines changed: 11 additions & 44 deletions

File tree

net/sunrpc/rpc_pipe.c

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,6 @@ enum {
997997
RPCAUTH_nfsd4_cb,
998998
RPCAUTH_cache,
999999
RPCAUTH_nfsd,
1000-
RPCAUTH_gssd,
10011000
RPCAUTH_RootEOF
10021001
};
10031002

@@ -1034,10 +1033,6 @@ static const struct rpc_filelist files[] = {
10341033
.name = "nfsd",
10351034
.mode = S_IFDIR | 0555,
10361035
},
1037-
[RPCAUTH_gssd] = {
1038-
.name = "gssd",
1039-
.mode = S_IFDIR | 0555,
1040-
},
10411036
};
10421037

10431038
/*
@@ -1097,13 +1092,6 @@ void rpc_put_sb_net(const struct net *net)
10971092
}
10981093
EXPORT_SYMBOL_GPL(rpc_put_sb_net);
10991094

1100-
static const struct rpc_filelist gssd_dummy_clnt_dir[] = {
1101-
[0] = {
1102-
.name = "clntXX",
1103-
.mode = S_IFDIR | 0555,
1104-
},
1105-
};
1106-
11071095
static ssize_t
11081096
dummy_downcall(struct file *filp, const char __user *src, size_t len)
11091097
{
@@ -1132,14 +1120,6 @@ rpc_dummy_info_show(struct seq_file *m, void *v)
11321120
}
11331121
DEFINE_SHOW_ATTRIBUTE(rpc_dummy_info);
11341122

1135-
static const struct rpc_filelist gssd_dummy_info_file[] = {
1136-
[0] = {
1137-
.name = "info",
1138-
.i_fop = &rpc_dummy_info_fops,
1139-
.mode = S_IFREG | 0400,
1140-
},
1141-
};
1142-
11431123
/**
11441124
* rpc_gssd_dummy_populate - create a dummy gssd pipe
11451125
* @root: root of the rpc_pipefs filesystem
@@ -1151,35 +1131,22 @@ static const struct rpc_filelist gssd_dummy_info_file[] = {
11511131
static int
11521132
rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data)
11531133
{
1154-
int ret = 0;
1155-
struct dentry *gssd_dentry;
1156-
struct dentry *clnt_dentry = NULL;
1134+
struct dentry *gssd_dentry, *clnt_dentry;
1135+
int err;
11571136

1158-
/* We should never get this far if "gssd" doesn't exist */
1159-
gssd_dentry = try_lookup_noperm(&QSTR(files[RPCAUTH_gssd].name), root);
1160-
if (!gssd_dentry)
1137+
gssd_dentry = rpc_new_dir(root, "gssd", 0555, NULL);
1138+
if (IS_ERR(gssd_dentry))
11611139
return -ENOENT;
11621140

1163-
ret = rpc_populate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1, NULL);
1164-
if (ret) {
1165-
dput(gssd_dentry);
1166-
return ret;
1167-
}
1168-
1169-
clnt_dentry = try_lookup_noperm(&QSTR(gssd_dummy_clnt_dir[0].name),
1170-
gssd_dentry);
1171-
dput(gssd_dentry);
1172-
if (!clnt_dentry)
1141+
clnt_dentry = rpc_new_dir(gssd_dentry, "clntXX", 0555, NULL);
1142+
if (IS_ERR(clnt_dentry))
11731143
return -ENOENT;
11741144

1175-
ret = rpc_populate(clnt_dentry, gssd_dummy_info_file, 0, 1, NULL);
1176-
if (ret) {
1177-
dput(clnt_dentry);
1178-
return ret;
1179-
}
1180-
ret = rpc_mkpipe_dentry(clnt_dentry, "gssd", NULL, pipe_data);
1181-
dput(clnt_dentry);
1182-
return ret;
1145+
err = rpc_new_file(clnt_dentry, "info", 0400,
1146+
&rpc_dummy_info_fops, NULL);
1147+
if (!err)
1148+
err = rpc_mkpipe_dentry(clnt_dentry, "gssd", NULL, pipe_data);
1149+
return err;
11831150
}
11841151

11851152
static int

0 commit comments

Comments
 (0)