diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-03-31 22:42:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-31 22:42:37 -0400 |
commit | d0538ca3554a3985c09921903cf8f5e38fa56123 (patch) | |
tree | 84fa02db2609be9b07ec14a6bd91da14726daea3 /net/ipv4 | |
parent | 70ee115942be6ce52ff10e5e813fb4da82cdb25a (diff) |
[SOCK][NETNS]: Register sockstat(6) files in each net.
Currently they live in init_net only, but now almost all the info
they can provide is available per-net.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/proc.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 8156c26f9337..24ae23bb5124 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -426,25 +426,42 @@ static const struct file_operations netstat_seq_fops = { | |||
426 | .release = single_release, | 426 | .release = single_release, |
427 | }; | 427 | }; |
428 | 428 | ||
429 | static __net_init int ip_proc_init_net(struct net *net) | ||
430 | { | ||
431 | if (!proc_net_fops_create(net, "sockstat", S_IRUGO, &sockstat_seq_fops)) | ||
432 | return -ENOMEM; | ||
433 | return 0; | ||
434 | } | ||
435 | |||
436 | static __net_exit void ip_proc_exit_net(struct net *net) | ||
437 | { | ||
438 | proc_net_remove(net, "sockstat"); | ||
439 | } | ||
440 | |||
441 | static __net_initdata struct pernet_operations ip_proc_ops = { | ||
442 | .init = ip_proc_init_net, | ||
443 | .exit = ip_proc_exit_net, | ||
444 | }; | ||
445 | |||
429 | int __init ip_misc_proc_init(void) | 446 | int __init ip_misc_proc_init(void) |
430 | { | 447 | { |
431 | int rc = 0; | 448 | int rc = 0; |
432 | 449 | ||
450 | if (register_pernet_subsys(&ip_proc_ops)) | ||
451 | goto out_pernet; | ||
452 | |||
433 | if (!proc_net_fops_create(&init_net, "netstat", S_IRUGO, &netstat_seq_fops)) | 453 | if (!proc_net_fops_create(&init_net, "netstat", S_IRUGO, &netstat_seq_fops)) |
434 | goto out_netstat; | 454 | goto out_netstat; |
435 | 455 | ||
436 | if (!proc_net_fops_create(&init_net, "snmp", S_IRUGO, &snmp_seq_fops)) | 456 | if (!proc_net_fops_create(&init_net, "snmp", S_IRUGO, &snmp_seq_fops)) |
437 | goto out_snmp; | 457 | goto out_snmp; |
438 | |||
439 | if (!proc_net_fops_create(&init_net, "sockstat", S_IRUGO, &sockstat_seq_fops)) | ||
440 | goto out_sockstat; | ||
441 | out: | 458 | out: |
442 | return rc; | 459 | return rc; |
443 | out_sockstat: | ||
444 | proc_net_remove(&init_net, "snmp"); | ||
445 | out_snmp: | 460 | out_snmp: |
446 | proc_net_remove(&init_net, "netstat"); | 461 | proc_net_remove(&init_net, "netstat"); |
447 | out_netstat: | 462 | out_netstat: |
463 | unregister_pernet_subsys(&ip_proc_ops); | ||
464 | out_pernet: | ||
448 | rc = -ENOMEM; | 465 | rc = -ENOMEM; |
449 | goto out; | 466 | goto out; |
450 | } | 467 | } |