diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-01-12 05:33:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:08 -0500 |
commit | 90754f8ec011c91382ece2849a43b8f8aa8a0105 (patch) | |
tree | f7c6a67a69a62d22988a5218d1a2909c32aacf44 | |
parent | b5ccd792fa413f9336273cb8fa3b9dd3a7ec1735 (diff) |
[IPVS]: Switch to using ctl_paths.
The feature of ipvs ctls is that the net/ipv4/vs path
is common for core ipvs ctls and for two schedulers,
so I make it exported and re-use it in modules.
Two other .c files required linux/sysctl.h to make the
extern declaration of this path compile well.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ip_vs.h | 3 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 35 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_est.c | 1 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_lblc.c | 31 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_lblcr.c | 31 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_sched.c | 1 |
6 files changed, 14 insertions, 88 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 3de6d1e6afa7..56f3c94ae620 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #include <asm/types.h> /* For __uXX types */ | 9 | #include <asm/types.h> /* For __uXX types */ |
10 | #include <linux/types.h> /* For __beXX types in userland */ | 10 | #include <linux/types.h> /* For __beXX types in userland */ |
11 | 11 | ||
12 | #include <linux/sysctl.h> /* For ctl_path */ | ||
13 | |||
12 | #define IP_VS_VERSION_CODE 0x010201 | 14 | #define IP_VS_VERSION_CODE 0x010201 |
13 | #define NVERSION(version) \ | 15 | #define NVERSION(version) \ |
14 | (version >> 16) & 0xFF, \ | 16 | (version >> 16) & 0xFF, \ |
@@ -854,6 +856,7 @@ extern int sysctl_ip_vs_expire_quiescent_template; | |||
854 | extern int sysctl_ip_vs_sync_threshold[2]; | 856 | extern int sysctl_ip_vs_sync_threshold[2]; |
855 | extern int sysctl_ip_vs_nat_icmp_send; | 857 | extern int sysctl_ip_vs_nat_icmp_send; |
856 | extern struct ip_vs_stats ip_vs_stats; | 858 | extern struct ip_vs_stats ip_vs_stats; |
859 | extern struct ctl_path net_vs_ctl_path[]; | ||
857 | 860 | ||
858 | extern struct ip_vs_service * | 861 | extern struct ip_vs_service * |
859 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); | 862 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); |
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 693d92490c11..9fecfe7d1164 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -1591,34 +1591,13 @@ static struct ctl_table vs_vars[] = { | |||
1591 | { .ctl_name = 0 } | 1591 | { .ctl_name = 0 } |
1592 | }; | 1592 | }; |
1593 | 1593 | ||
1594 | static ctl_table vs_table[] = { | 1594 | struct ctl_path net_vs_ctl_path[] = { |
1595 | { | 1595 | { .procname = "net", .ctl_name = CTL_NET, }, |
1596 | .procname = "vs", | 1596 | { .procname = "ipv4", .ctl_name = NET_IPV4, }, |
1597 | .mode = 0555, | 1597 | { .procname = "vs", }, |
1598 | .child = vs_vars | 1598 | { } |
1599 | }, | ||
1600 | { .ctl_name = 0 } | ||
1601 | }; | ||
1602 | |||
1603 | static ctl_table ipvs_ipv4_table[] = { | ||
1604 | { | ||
1605 | .ctl_name = NET_IPV4, | ||
1606 | .procname = "ipv4", | ||
1607 | .mode = 0555, | ||
1608 | .child = vs_table, | ||
1609 | }, | ||
1610 | { .ctl_name = 0 } | ||
1611 | }; | ||
1612 | |||
1613 | static ctl_table vs_root_table[] = { | ||
1614 | { | ||
1615 | .ctl_name = CTL_NET, | ||
1616 | .procname = "net", | ||
1617 | .mode = 0555, | ||
1618 | .child = ipvs_ipv4_table, | ||
1619 | }, | ||
1620 | { .ctl_name = 0 } | ||
1621 | }; | 1599 | }; |
1600 | EXPORT_SYMBOL_GPL(net_vs_ctl_path); | ||
1622 | 1601 | ||
1623 | static struct ctl_table_header * sysctl_header; | 1602 | static struct ctl_table_header * sysctl_header; |
1624 | 1603 | ||
@@ -2345,7 +2324,7 @@ int ip_vs_control_init(void) | |||
2345 | proc_net_fops_create(&init_net, "ip_vs", 0, &ip_vs_info_fops); | 2324 | proc_net_fops_create(&init_net, "ip_vs", 0, &ip_vs_info_fops); |
2346 | proc_net_fops_create(&init_net, "ip_vs_stats",0, &ip_vs_stats_fops); | 2325 | proc_net_fops_create(&init_net, "ip_vs_stats",0, &ip_vs_stats_fops); |
2347 | 2326 | ||
2348 | sysctl_header = register_sysctl_table(vs_root_table); | 2327 | sysctl_header = register_sysctl_paths(net_vs_ctl_path, vs_vars); |
2349 | 2328 | ||
2350 | /* Initialize ip_vs_svc_table, ip_vs_svc_fwm_table, ip_vs_rtable */ | 2329 | /* Initialize ip_vs_svc_table, ip_vs_svc_fwm_table, ip_vs_rtable */ |
2351 | for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | 2330 | for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { |
diff --git a/net/ipv4/ipvs/ip_vs_est.c b/net/ipv4/ipvs/ip_vs_est.c index efdd74e4fa28..dfa0d713c801 100644 --- a/net/ipv4/ipvs/ip_vs_est.c +++ b/net/ipv4/ipvs/ip_vs_est.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/sysctl.h> | ||
21 | 22 | ||
22 | #include <net/ip_vs.h> | 23 | #include <net/ip_vs.h> |
23 | 24 | ||
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c index bf8c04a57548..3888642706ad 100644 --- a/net/ipv4/ipvs/ip_vs_lblc.c +++ b/net/ipv4/ipvs/ip_vs_lblc.c | |||
@@ -123,35 +123,6 @@ static ctl_table vs_vars_table[] = { | |||
123 | { .ctl_name = 0 } | 123 | { .ctl_name = 0 } |
124 | }; | 124 | }; |
125 | 125 | ||
126 | static ctl_table vs_table[] = { | ||
127 | { | ||
128 | .procname = "vs", | ||
129 | .mode = 0555, | ||
130 | .child = vs_vars_table | ||
131 | }, | ||
132 | { .ctl_name = 0 } | ||
133 | }; | ||
134 | |||
135 | static ctl_table ipvs_ipv4_table[] = { | ||
136 | { | ||
137 | .ctl_name = NET_IPV4, | ||
138 | .procname = "ipv4", | ||
139 | .mode = 0555, | ||
140 | .child = vs_table | ||
141 | }, | ||
142 | { .ctl_name = 0 } | ||
143 | }; | ||
144 | |||
145 | static ctl_table lblc_root_table[] = { | ||
146 | { | ||
147 | .ctl_name = CTL_NET, | ||
148 | .procname = "net", | ||
149 | .mode = 0555, | ||
150 | .child = ipvs_ipv4_table | ||
151 | }, | ||
152 | { .ctl_name = 0 } | ||
153 | }; | ||
154 | |||
155 | static struct ctl_table_header * sysctl_header; | 126 | static struct ctl_table_header * sysctl_header; |
156 | 127 | ||
157 | /* | 128 | /* |
@@ -582,7 +553,7 @@ static int __init ip_vs_lblc_init(void) | |||
582 | int ret; | 553 | int ret; |
583 | 554 | ||
584 | INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list); | 555 | INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list); |
585 | sysctl_header = register_sysctl_table(lblc_root_table); | 556 | sysctl_header = register_sysctl_paths(net_vs_ctl_path, vs_vars_table); |
586 | ret = register_ip_vs_scheduler(&ip_vs_lblc_scheduler); | 557 | ret = register_ip_vs_scheduler(&ip_vs_lblc_scheduler); |
587 | if (ret) | 558 | if (ret) |
588 | unregister_sysctl_table(sysctl_header); | 559 | unregister_sysctl_table(sysctl_header); |
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index f50da6411378..daa260eb21cf 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c | |||
@@ -311,35 +311,6 @@ static ctl_table vs_vars_table[] = { | |||
311 | { .ctl_name = 0 } | 311 | { .ctl_name = 0 } |
312 | }; | 312 | }; |
313 | 313 | ||
314 | static ctl_table vs_table[] = { | ||
315 | { | ||
316 | .procname = "vs", | ||
317 | .mode = 0555, | ||
318 | .child = vs_vars_table | ||
319 | }, | ||
320 | { .ctl_name = 0 } | ||
321 | }; | ||
322 | |||
323 | static ctl_table ipvs_ipv4_table[] = { | ||
324 | { | ||
325 | .ctl_name = NET_IPV4, | ||
326 | .procname = "ipv4", | ||
327 | .mode = 0555, | ||
328 | .child = vs_table | ||
329 | }, | ||
330 | { .ctl_name = 0 } | ||
331 | }; | ||
332 | |||
333 | static ctl_table lblcr_root_table[] = { | ||
334 | { | ||
335 | .ctl_name = CTL_NET, | ||
336 | .procname = "net", | ||
337 | .mode = 0555, | ||
338 | .child = ipvs_ipv4_table | ||
339 | }, | ||
340 | { .ctl_name = 0 } | ||
341 | }; | ||
342 | |||
343 | static struct ctl_table_header * sysctl_header; | 314 | static struct ctl_table_header * sysctl_header; |
344 | 315 | ||
345 | /* | 316 | /* |
@@ -771,7 +742,7 @@ static int __init ip_vs_lblcr_init(void) | |||
771 | int ret; | 742 | int ret; |
772 | 743 | ||
773 | INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); | 744 | INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); |
774 | sysctl_header = register_sysctl_table(lblcr_root_table); | 745 | sysctl_header = register_sysctl_paths(net_vs_ctl_path, vs_vars_table); |
775 | ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); | 746 | ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); |
776 | if (ret) | 747 | if (ret) |
777 | unregister_sysctl_table(sysctl_header); | 748 | unregister_sysctl_table(sysctl_header); |
diff --git a/net/ipv4/ipvs/ip_vs_sched.c b/net/ipv4/ipvs/ip_vs_sched.c index 432235861908..121a32b1b756 100644 --- a/net/ipv4/ipvs/ip_vs_sched.c +++ b/net/ipv4/ipvs/ip_vs_sched.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <asm/string.h> | 25 | #include <asm/string.h> |
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/sysctl.h> | ||
27 | 28 | ||
28 | #include <net/ip_vs.h> | 29 | #include <net/ip_vs.h> |
29 | 30 | ||