aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-08 03:02:37 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 19:40:30 -0500
commit60a47a2e823cbe6b609346bffff61a00c0c76470 (patch)
treeb19ac63068757893d6f110cf31d27fb59942d005 /fs/proc
parent0e47c99d7fe25e0f3907d9f3401079169d904891 (diff)
sysctl: Modify __register_sysctl_paths to take a set instead of a root and an nsproxy
An nsproxy argument here has always been awkard and now the nsproxy argument is completely unnecessary so remove it, replacing it with the set we want the registered tables to show up in. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/proc_sysctl.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index ec54a57c469..e0d3e7e59cb 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1084,8 +1084,7 @@ out:
1084 1084
1085/** 1085/**
1086 * __register_sysctl_table - register a leaf sysctl table 1086 * __register_sysctl_table - register a leaf sysctl table
1087 * @root: List of sysctl headers to register on 1087 * @set: Sysctl tree to register on
1088 * @namespaces: Data to compute which lists of sysctl entries are visible
1089 * @path: The path to the directory the sysctl table is in. 1088 * @path: The path to the directory the sysctl table is in.
1090 * @table: the top-level table structure 1089 * @table: the top-level table structure
1091 * 1090 *
@@ -1126,26 +1125,24 @@ out:
1126 * to the table header on success. 1125 * to the table header on success.
1127 */ 1126 */
1128struct ctl_table_header *__register_sysctl_table( 1127struct ctl_table_header *__register_sysctl_table(
1129 struct ctl_table_root *root, 1128 struct ctl_table_set *set,
1130 struct nsproxy *namespaces,
1131 const char *path, struct ctl_table *table) 1129 const char *path, struct ctl_table *table)
1132{ 1130{
1131 struct ctl_table_root *root = set->dir.header.root;
1133 struct ctl_table_header *links = NULL; 1132 struct ctl_table_header *links = NULL;
1134 struct ctl_table_header *header; 1133 struct ctl_table_header *header;
1135 const char *name, *nextname; 1134 const char *name, *nextname;
1136 struct ctl_table_set *set;
1137 struct ctl_dir *dir; 1135 struct ctl_dir *dir;
1138 1136
1139 header = kzalloc(sizeof(struct ctl_table_header), GFP_KERNEL); 1137 header = kzalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
1140 if (!header) 1138 if (!header)
1141 return NULL; 1139 return NULL;
1142 1140
1143 init_header(header, root, NULL, table); 1141 init_header(header, root, set, table);
1144 if (sysctl_check_table(path, table)) 1142 if (sysctl_check_table(path, table))
1145 goto fail; 1143 goto fail;
1146 1144
1147 spin_lock(&sysctl_lock); 1145 spin_lock(&sysctl_lock);
1148 header->set = set = lookup_header_set(root, namespaces);
1149 dir = &set->dir; 1146 dir = &set->dir;
1150 dir->header.nreg++; 1147 dir->header.nreg++;
1151 spin_unlock(&sysctl_lock); 1148 spin_unlock(&sysctl_lock);
@@ -1223,8 +1220,7 @@ static int count_subheaders(struct ctl_table *table)
1223} 1220}
1224 1221
1225static int register_leaf_sysctl_tables(const char *path, char *pos, 1222static int register_leaf_sysctl_tables(const char *path, char *pos,
1226 struct ctl_table_header ***subheader, 1223 struct ctl_table_header ***subheader, struct ctl_table_set *set,
1227 struct ctl_table_root *root, struct nsproxy *namespaces,
1228 struct ctl_table *table) 1224 struct ctl_table *table)
1229{ 1225{
1230 struct ctl_table *ctl_table_arg = NULL; 1226 struct ctl_table *ctl_table_arg = NULL;
@@ -1261,7 +1257,7 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
1261 /* Register everything except a directory full of subdirectories */ 1257 /* Register everything except a directory full of subdirectories */
1262 if (nr_files || !nr_dirs) { 1258 if (nr_files || !nr_dirs) {
1263 struct ctl_table_header *header; 1259 struct ctl_table_header *header;
1264 header = __register_sysctl_table(root, namespaces, path, files); 1260 header = __register_sysctl_table(set, path, files);
1265 if (!header) { 1261 if (!header) {
1266 kfree(ctl_table_arg); 1262 kfree(ctl_table_arg);
1267 goto out; 1263 goto out;
@@ -1286,7 +1282,7 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
1286 goto out; 1282 goto out;
1287 1283
1288 err = register_leaf_sysctl_tables(path, child_pos, subheader, 1284 err = register_leaf_sysctl_tables(path, child_pos, subheader,
1289 root, namespaces, entry->child); 1285 set, entry->child);
1290 pos[0] = '\0'; 1286 pos[0] = '\0';
1291 if (err) 1287 if (err)
1292 goto out; 1288 goto out;
@@ -1299,8 +1295,7 @@ out:
1299 1295
1300/** 1296/**
1301 * __register_sysctl_paths - register a sysctl table hierarchy 1297 * __register_sysctl_paths - register a sysctl table hierarchy
1302 * @root: List of sysctl headers to register on 1298 * @set: Sysctl tree to register on
1303 * @namespaces: Data to compute which lists of sysctl entries are visible
1304 * @path: The path to the directory the sysctl table is in. 1299 * @path: The path to the directory the sysctl table is in.
1305 * @table: the top-level table structure 1300 * @table: the top-level table structure
1306 * 1301 *
@@ -1310,8 +1305,7 @@ out:
1310 * See __register_sysctl_table for more details. 1305 * See __register_sysctl_table for more details.
1311 */ 1306 */
1312struct ctl_table_header *__register_sysctl_paths( 1307struct ctl_table_header *__register_sysctl_paths(
1313 struct ctl_table_root *root, 1308 struct ctl_table_set *set,
1314 struct nsproxy *namespaces,
1315 const struct ctl_path *path, struct ctl_table *table) 1309 const struct ctl_path *path, struct ctl_table *table)
1316{ 1310{
1317 struct ctl_table *ctl_table_arg = table; 1311 struct ctl_table *ctl_table_arg = table;
@@ -1337,7 +1331,7 @@ struct ctl_table_header *__register_sysctl_paths(
1337 table = table->child; 1331 table = table->child;
1338 } 1332 }
1339 if (nr_subheaders == 1) { 1333 if (nr_subheaders == 1) {
1340 header = __register_sysctl_table(root, namespaces, new_path, table); 1334 header = __register_sysctl_table(set, new_path, table);
1341 if (header) 1335 if (header)
1342 header->ctl_table_arg = ctl_table_arg; 1336 header->ctl_table_arg = ctl_table_arg;
1343 } else { 1337 } else {
@@ -1351,7 +1345,7 @@ struct ctl_table_header *__register_sysctl_paths(
1351 header->ctl_table_arg = ctl_table_arg; 1345 header->ctl_table_arg = ctl_table_arg;
1352 1346
1353 if (register_leaf_sysctl_tables(new_path, pos, &subheader, 1347 if (register_leaf_sysctl_tables(new_path, pos, &subheader,
1354 root, namespaces, table)) 1348 set, table))
1355 goto err_register_leaves; 1349 goto err_register_leaves;
1356 } 1350 }
1357 1351
@@ -1384,7 +1378,7 @@ err_register_leaves:
1384struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 1378struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1385 struct ctl_table *table) 1379 struct ctl_table *table)
1386{ 1380{
1387 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy, 1381 return __register_sysctl_paths(&sysctl_table_root.default_set,
1388 path, table); 1382 path, table);
1389} 1383}
1390EXPORT_SYMBOL(register_sysctl_paths); 1384EXPORT_SYMBOL(register_sysctl_paths);