Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit f780d9993490faf04d62b85fde16d53c72ac5931 1 parent 28551e3
Lucian Adrian Grijincu authored
2  include/linux/sysctl.h
@@ -944,6 +944,8 @@ struct ctl_table_set {
944 944 int (*is_seen)(struct ctl_table_set *);
945 945 };
946 946
  947 +extern __init int sysctl_init(void);
  948 +
947 949 extern void setup_sysctl_set(struct ctl_table_set *p,
948 950 struct ctl_table_set *parent,
949 951 int (*is_seen)(struct ctl_table_set *));
1  init/main.c
@@ -617,6 +617,7 @@ asmlinkage void __init start_kernel(void)
617 617 fork_init(totalram_pages);
618 618 proc_caches_init();
619 619 buffer_init();
  620 + sysctl_init();
620 621 key_init();
621 622 security_init();
622 623 dbg_late_init();
10 kernel/sysctl.c
@@ -1738,7 +1738,7 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1738 1738 }
1739 1739 }
1740 1740
1741   -static __init int sysctl_init(void)
  1741 +__init int sysctl_init(void)
1742 1742 {
1743 1743 sysctl_set_parent(NULL, root_table);
1744 1744 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
@@ -1747,8 +1747,6 @@ static __init int sysctl_init(void)
1747 1747 return 0;
1748 1748 }
1749 1749
1750   -core_initcall(sysctl_init);
1751   -
1752 1750 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1753 1751 struct ctl_table *table)
1754 1752 {
@@ -2186,6 +2184,12 @@ void setup_sysctl_set(struct ctl_table_set *p,
2186 2184 }
2187 2185
2188 2186 #else /* !CONFIG_SYSCTL */
  2187 +
  2188 +__init int sysctl_init(void)
  2189 +{
  2190 + return 0;
  2191 +}
  2192 +
2189 2193 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
2190 2194 {
2191 2195 return NULL;
4 net/sysctl_net.c
@@ -90,7 +90,7 @@ static struct pernet_operations sysctl_pernet_ops = {
90 90 .exit = sysctl_net_exit,
91 91 };
92 92
93   -static __init int sysctl_init(void)
  93 +static __init int net_sysctl_init(void)
94 94 {
95 95 int ret;
96 96 ret = register_pernet_subsys(&sysctl_pernet_ops);
@@ -102,7 +102,7 @@ static __init int sysctl_init(void)
102 102 out:
103 103 return ret;
104 104 }
105   -subsys_initcall(sysctl_init);
  105 +subsys_initcall(net_sysctl_init);
106 106
107 107 struct ctl_table_header *register_net_sysctl_table(struct net *net,
108 108 const struct ctl_path *path, struct ctl_table *table)

0 comments on commit f780d99

Please sign in to comment.
Something went wrong with that request. Please try again.