]> err.no Git - linux-2.6/commitdiff
[IPV4]: Use ctl paths to register net/ipv4/ table
authorPavel Emelyanov <xemul@openvz.org>
Wed, 5 Dec 2007 09:41:26 +0000 (01:41 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:56:27 +0000 (14:56 -0800)
This is the same as I did for the net/core/ table in the
second patch in his series: use the paths and isolate the
whole table in the .c file.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip.h
net/ipv4/sysctl_net_ipv4.c
net/sysctl_net.c

index 66d51616ade8bee54da4c091d3adbc001095575d..17d1189723fc0f62fdfd6f203e31c8df32ab0bdd 100644 (file)
@@ -395,6 +395,4 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
 extern int ip_misc_proc_init(void);
 #endif
 
-extern struct ctl_table ipv4_table[];
-
 #endif /* _IP_H */
index 3546424765f59e1d53ab666e0b6a5d1ce6a129eb..bfd0dec6238d419b17f6d59a08f88e132307fb41 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/igmp.h>
 #include <linux/inetdevice.h>
 #include <linux/seqlock.h>
+#include <linux/init.h>
 #include <net/snmp.h>
 #include <net/icmp.h>
 #include <net/ip.h>
@@ -247,7 +248,7 @@ static int strategy_allowed_congestion_control(ctl_table *table, int __user *nam
 
 }
 
-ctl_table ipv4_table[] = {
+static struct ctl_table ipv4_table[] = {
        {
                .ctl_name       = NET_IPV4_TCP_TIMESTAMPS,
                .procname       = "tcp_timestamps",
@@ -878,3 +879,19 @@ ctl_table ipv4_table[] = {
        },
        { .ctl_name = 0 }
 };
+
+static __initdata struct ctl_path net_ipv4_path[] = {
+       { .procname = "net", .ctl_name = CTL_NET, },
+       { .procname = "ipv4", .ctl_name = NET_IPV4, },
+       { },
+};
+
+static __init int sysctl_ipv4_init(void)
+{
+       struct ctl_table_header *hdr;
+
+       hdr = register_sysctl_paths(net_ipv4_path, ipv4_table);
+       return hdr == NULL ? -ENOMEM : 0;
+}
+
+__initcall(sysctl_ipv4_init);
index 747fc55b28f1bbea7b2632fa85e216eb5cb6b8ef..a4f0ed8d0e791ba3a63df38c7676f2c8446461a1 100644 (file)
 #endif
 
 struct ctl_table net_table[] = {
-#ifdef CONFIG_INET
-       {
-               .ctl_name       = NET_IPV4,
-               .procname       = "ipv4",
-               .mode           = 0555,
-               .child          = ipv4_table
-       },
-#endif
 #ifdef CONFIG_TR
        {
                .ctl_name       = NET_TR,