diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-03-31 19:42:37 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-31 19:42:37 -0700 |
commit | d0538ca3554a3985c09921903cf8f5e38fa56123 (patch) | |
tree | 84fa02db2609be9b07ec14a6bd91da14726daea3 /net/ipv4/proc.c | |
parent | 70ee115942be6ce52ff10e5e813fb4da82cdb25a (diff) | |
download | op-kernel-dev-d0538ca3554a3985c09921903cf8f5e38fa56123.zip op-kernel-dev-d0538ca3554a3985c09921903cf8f5e38fa56123.tar.gz |
[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/proc.c')
-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 8156c26..24ae23b 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -426,25 +426,42 @@ static const struct file_operations netstat_seq_fops = { .release = single_release, }; +static __net_init int ip_proc_init_net(struct net *net) +{ + if (!proc_net_fops_create(net, "sockstat", S_IRUGO, &sockstat_seq_fops)) + return -ENOMEM; + return 0; +} + +static __net_exit void ip_proc_exit_net(struct net *net) +{ + proc_net_remove(net, "sockstat"); +} + +static __net_initdata struct pernet_operations ip_proc_ops = { + .init = ip_proc_init_net, + .exit = ip_proc_exit_net, +}; + int __init ip_misc_proc_init(void) { int rc = 0; + if (register_pernet_subsys(&ip_proc_ops)) + goto out_pernet; + if (!proc_net_fops_create(&init_net, "netstat", S_IRUGO, &netstat_seq_fops)) goto out_netstat; if (!proc_net_fops_create(&init_net, "snmp", S_IRUGO, &snmp_seq_fops)) goto out_snmp; - - if (!proc_net_fops_create(&init_net, "sockstat", S_IRUGO, &sockstat_seq_fops)) - goto out_sockstat; out: return rc; -out_sockstat: - proc_net_remove(&init_net, "snmp"); out_snmp: proc_net_remove(&init_net, "netstat"); out_netstat: + unregister_pernet_subsys(&ip_proc_ops); +out_pernet: rc = -ENOMEM; goto out; } |