Permalink
Browse files

sysctl: call sysctl_init before the first sysctl registration

In the next patch key_init() will be changed to register a sysctl
table. In preparation, we call sysctl_init() before it.

Also, rename net/sysctl_net.c's sysctl_init so the two don't clash.

Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
  • Loading branch information...
luciang committed May 1, 2011
1 parent 28551e3 commit f780d9993490faf04d62b85fde16d53c72ac5931
Showing with 12 additions and 5 deletions.
  1. +2 −0 include/linux/sysctl.h
  2. +1 −0 init/main.c
  3. +7 −3 kernel/sysctl.c
  4. +2 −2 net/sysctl_net.c
View
@@ -944,6 +944,8 @@ struct ctl_table_set {
int (*is_seen)(struct ctl_table_set *);
};
+extern __init int sysctl_init(void);
+
extern void setup_sysctl_set(struct ctl_table_set *p,
struct ctl_table_set *parent,
int (*is_seen)(struct ctl_table_set *));
View
@@ -617,6 +617,7 @@ asmlinkage void __init start_kernel(void)
fork_init(totalram_pages);
proc_caches_init();
buffer_init();
+ sysctl_init();
key_init();
security_init();
dbg_late_init();
View
@@ -1738,7 +1738,7 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
}
}
-static __init int sysctl_init(void)
+__init int sysctl_init(void)
{
sysctl_set_parent(NULL, root_table);
#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
@@ -1747,8 +1747,6 @@ static __init int sysctl_init(void)
return 0;
}
-core_initcall(sysctl_init);
-
static struct ctl_table *is_branch_in(struct ctl_table *branch,
struct ctl_table *table)
{
@@ -2186,6 +2184,12 @@ void setup_sysctl_set(struct ctl_table_set *p,
}
#else /* !CONFIG_SYSCTL */
+
+__init int sysctl_init(void)
+{
+ return 0;
+}
+
struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
{
return NULL;
View
@@ -90,7 +90,7 @@ static struct pernet_operations sysctl_pernet_ops = {
.exit = sysctl_net_exit,
};
-static __init int sysctl_init(void)
+static __init int net_sysctl_init(void)
{
int ret;
ret = register_pernet_subsys(&sysctl_pernet_ops);
@@ -102,7 +102,7 @@ static __init int sysctl_init(void)
out:
return ret;
}
-subsys_initcall(sysctl_init);
+subsys_initcall(net_sysctl_init);
struct ctl_table_header *register_net_sysctl_table(struct net *net,
const struct ctl_path *path, struct ctl_table *table)

0 comments on commit f780d99

Please sign in to comment.