diff options
author | Denis V. Lunev <den@openvz.org> | 2008-01-10 06:21:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:24 -0500 |
commit | 61a0265344786a548e8a0b26cb668e78a71f9602 (patch) | |
tree | cebfe266232678baba5b3d48f46b3e0f160bebdb /net | |
parent | 5fd30ee7c48bf7f9cd16ab44c8a09fa4a57cc21d (diff) |
[NETNS]: Add namespace to API for routing /proc entries creation.
This adds netns parameter to fib_proc_init/exit and replaces __init
specifier with __net_init. After this, we will not yet have these proc
files show info from the specific namespace - this will be done when
these tables become namespaced.
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/af_inet.c | 4 | ||||
-rw-r--r-- | net/ipv4/fib_hash.c | 8 | ||||
-rw-r--r-- | net/ipv4/fib_trie.c | 21 |
3 files changed, 17 insertions, 16 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 0e12cf646071..d5b8cb1dad67 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1475,14 +1475,14 @@ static int __init ipv4_proc_init(void) | |||
1475 | goto out_tcp; | 1475 | goto out_tcp; |
1476 | if (udp4_proc_init()) | 1476 | if (udp4_proc_init()) |
1477 | goto out_udp; | 1477 | goto out_udp; |
1478 | if (fib_proc_init()) | 1478 | if (fib_proc_init(&init_net)) |
1479 | goto out_fib; | 1479 | goto out_fib; |
1480 | if (ip_misc_proc_init()) | 1480 | if (ip_misc_proc_init()) |
1481 | goto out_misc; | 1481 | goto out_misc; |
1482 | out: | 1482 | out: |
1483 | return rc; | 1483 | return rc; |
1484 | out_misc: | 1484 | out_misc: |
1485 | fib_proc_exit(); | 1485 | fib_proc_exit(&init_net); |
1486 | out_fib: | 1486 | out_fib: |
1487 | udp4_proc_exit(); | 1487 | udp4_proc_exit(); |
1488 | out_udp: | 1488 | out_udp: |
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index ee1ffdb3044f..8de21bc4947a 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -1041,15 +1041,15 @@ static const struct file_operations fib_seq_fops = { | |||
1041 | .release = seq_release_private, | 1041 | .release = seq_release_private, |
1042 | }; | 1042 | }; |
1043 | 1043 | ||
1044 | int __init fib_proc_init(void) | 1044 | int __net_init fib_proc_init(struct net *net) |
1045 | { | 1045 | { |
1046 | if (!proc_net_fops_create(&init_net, "route", S_IRUGO, &fib_seq_fops)) | 1046 | if (!proc_net_fops_create(net, "route", S_IRUGO, &fib_seq_fops)) |
1047 | return -ENOMEM; | 1047 | return -ENOMEM; |
1048 | return 0; | 1048 | return 0; |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | void __init fib_proc_exit(void) | 1051 | void __net_exit fib_proc_exit(struct net *net) |
1052 | { | 1052 | { |
1053 | proc_net_remove(&init_net, "route"); | 1053 | proc_net_remove(net, "route"); |
1054 | } | 1054 | } |
1055 | #endif /* CONFIG_PROC_FS */ | 1055 | #endif /* CONFIG_PROC_FS */ |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index a842204df7ba..4bbfaeedf210 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -2508,32 +2508,33 @@ static const struct file_operations fib_route_fops = { | |||
2508 | .release = seq_release_private, | 2508 | .release = seq_release_private, |
2509 | }; | 2509 | }; |
2510 | 2510 | ||
2511 | int __init fib_proc_init(void) | 2511 | int __net_init fib_proc_init(struct net *net) |
2512 | { | 2512 | { |
2513 | if (!proc_net_fops_create(&init_net, "fib_trie", S_IRUGO, &fib_trie_fops)) | 2513 | if (!proc_net_fops_create(net, "fib_trie", S_IRUGO, &fib_trie_fops)) |
2514 | goto out1; | 2514 | goto out1; |
2515 | 2515 | ||
2516 | if (!proc_net_fops_create(&init_net, "fib_triestat", S_IRUGO, &fib_triestat_fops)) | 2516 | if (!proc_net_fops_create(net, "fib_triestat", S_IRUGO, |
2517 | &fib_triestat_fops)) | ||
2517 | goto out2; | 2518 | goto out2; |
2518 | 2519 | ||
2519 | if (!proc_net_fops_create(&init_net, "route", S_IRUGO, &fib_route_fops)) | 2520 | if (!proc_net_fops_create(net, "route", S_IRUGO, &fib_route_fops)) |
2520 | goto out3; | 2521 | goto out3; |
2521 | 2522 | ||
2522 | return 0; | 2523 | return 0; |
2523 | 2524 | ||
2524 | out3: | 2525 | out3: |
2525 | proc_net_remove(&init_net, "fib_triestat"); | 2526 | proc_net_remove(net, "fib_triestat"); |
2526 | out2: | 2527 | out2: |
2527 | proc_net_remove(&init_net, "fib_trie"); | 2528 | proc_net_remove(net, "fib_trie"); |
2528 | out1: | 2529 | out1: |
2529 | return -ENOMEM; | 2530 | return -ENOMEM; |
2530 | } | 2531 | } |
2531 | 2532 | ||
2532 | void __init fib_proc_exit(void) | 2533 | void __net_exit fib_proc_exit(struct net *net) |
2533 | { | 2534 | { |
2534 | proc_net_remove(&init_net, "fib_trie"); | 2535 | proc_net_remove(net, "fib_trie"); |
2535 | proc_net_remove(&init_net, "fib_triestat"); | 2536 | proc_net_remove(net, "fib_triestat"); |
2536 | proc_net_remove(&init_net, "route"); | 2537 | proc_net_remove(net, "route"); |
2537 | } | 2538 | } |
2538 | 2539 | ||
2539 | #endif /* CONFIG_PROC_FS */ | 2540 | #endif /* CONFIG_PROC_FS */ |