Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

Al Viro 065e88fa a117bf4c

+11 -44
+11 -44
net/sunrpc/rpc_pipe.c
··· 997 997 RPCAUTH_nfsd4_cb, 998 998 RPCAUTH_cache, 999 999 RPCAUTH_nfsd, 1000 - RPCAUTH_gssd, 1001 1000 RPCAUTH_RootEOF 1002 1001 }; 1003 1002 ··· 1031 1032 }, 1032 1033 [RPCAUTH_nfsd] = { 1033 1034 .name = "nfsd", 1034 - .mode = S_IFDIR | 0555, 1035 - }, 1036 - [RPCAUTH_gssd] = { 1037 - .name = "gssd", 1038 1035 .mode = S_IFDIR | 0555, 1039 1036 }, 1040 1037 }; ··· 1092 1097 } 1093 1098 EXPORT_SYMBOL_GPL(rpc_put_sb_net); 1094 1099 1095 - static const struct rpc_filelist gssd_dummy_clnt_dir[] = { 1096 - [0] = { 1097 - .name = "clntXX", 1098 - .mode = S_IFDIR | 0555, 1099 - }, 1100 - }; 1101 - 1102 1100 static ssize_t 1103 1101 dummy_downcall(struct file *filp, const char __user *src, size_t len) 1104 1102 { ··· 1120 1132 } 1121 1133 DEFINE_SHOW_ATTRIBUTE(rpc_dummy_info); 1122 1134 1123 - static const struct rpc_filelist gssd_dummy_info_file[] = { 1124 - [0] = { 1125 - .name = "info", 1126 - .i_fop = &rpc_dummy_info_fops, 1127 - .mode = S_IFREG | 0400, 1128 - }, 1129 - }; 1130 - 1131 1135 /** 1132 1136 * rpc_gssd_dummy_populate - create a dummy gssd pipe 1133 1137 * @root: root of the rpc_pipefs filesystem ··· 1131 1151 static int 1132 1152 rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data) 1133 1153 { 1134 - int ret = 0; 1135 - struct dentry *gssd_dentry; 1136 - struct dentry *clnt_dentry = NULL; 1154 + struct dentry *gssd_dentry, *clnt_dentry; 1155 + int err; 1137 1156 1138 - /* We should never get this far if "gssd" doesn't exist */ 1139 - gssd_dentry = try_lookup_noperm(&QSTR(files[RPCAUTH_gssd].name), root); 1140 - if (!gssd_dentry) 1157 + gssd_dentry = rpc_new_dir(root, "gssd", 0555, NULL); 1158 + if (IS_ERR(gssd_dentry)) 1141 1159 return -ENOENT; 1142 1160 1143 - ret = rpc_populate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1, NULL); 1144 - if (ret) { 1145 - dput(gssd_dentry); 1146 - return ret; 1147 - } 1148 - 1149 - clnt_dentry = try_lookup_noperm(&QSTR(gssd_dummy_clnt_dir[0].name), 1150 - gssd_dentry); 1151 - dput(gssd_dentry); 1152 - if (!clnt_dentry) 1161 + clnt_dentry = rpc_new_dir(gssd_dentry, "clntXX", 0555, NULL); 1162 + if (IS_ERR(clnt_dentry)) 1153 1163 return -ENOENT; 1154 1164 1155 - ret = rpc_populate(clnt_dentry, gssd_dummy_info_file, 0, 1, NULL); 1156 - if (ret) { 1157 - dput(clnt_dentry); 1158 - return ret; 1159 - } 1160 - ret = rpc_mkpipe_dentry(clnt_dentry, "gssd", NULL, pipe_data); 1161 - dput(clnt_dentry); 1162 - return ret; 1165 + err = rpc_new_file(clnt_dentry, "info", 0400, 1166 + &rpc_dummy_info_fops, NULL); 1167 + if (!err) 1168 + err = rpc_mkpipe_dentry(clnt_dentry, "gssd", NULL, pipe_data); 1169 + return err; 1163 1170 } 1164 1171 1165 1172 static int