aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/proc_sysctl.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-21 20:51:48 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 19:40:28 -0500
commita194558e8698621a9ce7f2c6a720123e644af131 (patch)
tree7f58d41bf0be3a992b0dd6ae41be97d9964bb809 /fs/proc/proc_sysctl.c
parent8425d6aaf0704b98480131ed339c208ffce12e44 (diff)
sysctl: Normalize the root_table data structure.
Every other directory has a .child member and we look at the .child for our entries. Do the same for the root_table. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
-rw-r--r--fs/proc/proc_sysctl.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 7e96a2681b60..88d1b06cc5c0 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -25,7 +25,14 @@ void proc_sys_poll_notify(struct ctl_table_poll *poll)
25 wake_up_interruptible(&poll->wait); 25 wake_up_interruptible(&poll->wait);
26} 26}
27 27
28static struct ctl_table root_table[1]; 28static struct ctl_table root_table[] = {
29 {
30 .procname = "",
31 .mode = S_IRUGO|S_IXUGO,
32 .child = &root_table[1],
33 },
34 { }
35};
29static struct ctl_table_root sysctl_table_root; 36static struct ctl_table_root sysctl_table_root;
30static struct ctl_table_header root_table_header = { 37static struct ctl_table_header root_table_header = {
31 {{.count = 1, 38 {{.count = 1,
@@ -319,7 +326,7 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
319 goto out; 326 goto out;
320 } 327 }
321 328
322 table = table ? table->child : head->ctl_table; 329 table = table ? table->child : &head->ctl_table[1];
323 330
324 p = find_in_table(table, name); 331 p = find_in_table(table, name);
325 if (!p) { 332 if (!p) {
@@ -510,7 +517,7 @@ static int proc_sys_readdir(struct file *filp, void *dirent, filldir_t filldir)
510 goto out; 517 goto out;
511 } 518 }
512 519
513 table = table ? table->child : head->ctl_table; 520 table = table ? table->child : &head->ctl_table[1];
514 521
515 ret = 0; 522 ret = 0;
516 /* Avoid a switch here: arm builds fail with missing __cmpdi2 */ 523 /* Avoid a switch here: arm builds fail with missing __cmpdi2 */
@@ -966,7 +973,7 @@ struct ctl_table_header *__register_sysctl_table(
966 spin_lock(&sysctl_lock); 973 spin_lock(&sysctl_lock);
967 header->set = lookup_header_set(root, namespaces); 974 header->set = lookup_header_set(root, namespaces);
968 header->attached_by = header->ctl_table; 975 header->attached_by = header->ctl_table;
969 header->attached_to = root_table; 976 header->attached_to = &root_table[1];
970 header->parent = &root_table_header; 977 header->parent = &root_table_header;
971 set = header->set; 978 set = header->set;
972 root = header->root; 979 root = header->root;