aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-06 06:34:20 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 19:37:54 -0500
commitde4e83bd6b5e16d491ec068cd22801d5d063b07a (patch)
treed6b38f1284186abe5f20cfe996be9a4853c503b4 /kernel/sysctl.c
parent0ce8974d504913a0f0ae2d97b20a5ac665431a41 (diff)
sysctl: Register the base sysctl table like any other sysctl table.
Simplify the code by treating the base sysctl table like any other sysctl table and register it with register_sysctl_table. To ensure this table is registered early enough to avoid problems call sysctl_init from proc_sys_init. Rename sysctl_net.c:sysctl_init() to net_sysctl_init() to avoid name conflicts now that kernel/sysctl.c:sysctl_init() is no longer static. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d5bbddd0de24..ad460248acc7 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -192,7 +192,7 @@ static int sysrq_sysctl_handler(ctl_table *table, int write,
192 192
193#endif 193#endif
194 194
195static struct ctl_table root_table[]; 195static struct ctl_table root_table[1];
196static struct ctl_table_root sysctl_table_root; 196static struct ctl_table_root sysctl_table_root;
197static struct ctl_table_header root_table_header = { 197static struct ctl_table_header root_table_header = {
198 {{.count = 1, 198 {{.count = 1,
@@ -222,7 +222,7 @@ int sysctl_legacy_va_layout;
222 222
223/* The default sysctl tables: */ 223/* The default sysctl tables: */
224 224
225static struct ctl_table root_table[] = { 225static struct ctl_table sysctl_base_table[] = {
226 { 226 {
227 .procname = "kernel", 227 .procname = "kernel",
228 .mode = 0555, 228 .mode = 0555,
@@ -1747,17 +1747,12 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1747 } 1747 }
1748} 1748}
1749 1749
1750static __init int sysctl_init(void) 1750int __init sysctl_init(void)
1751{ 1751{
1752 sysctl_set_parent(NULL, root_table); 1752 register_sysctl_table(sysctl_base_table);
1753#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1754 sysctl_check_table(current->nsproxy, root_table);
1755#endif
1756 return 0; 1753 return 0;
1757} 1754}
1758 1755
1759core_initcall(sysctl_init);
1760
1761static struct ctl_table *is_branch_in(struct ctl_table *branch, 1756static struct ctl_table *is_branch_in(struct ctl_table *branch,
1762 struct ctl_table *table) 1757 struct ctl_table *table)
1763{ 1758{