summaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-03-31 19:42:37 -0700
committerDavid S. Miller <davem@davemloft.net>2008-03-31 19:42:37 -0700
commitd0538ca3554a3985c09921903cf8f5e38fa56123 (patch)
tree84fa02db2609be9b07ec14a6bd91da14726daea3 /net/ipv6
parent70ee115942be6ce52ff10e5e813fb4da82cdb25a (diff)
downloadtalos-op-linux-d0538ca3554a3985c09921903cf8f5e38fa56123.tar.gz
talos-op-linux-d0538ca3554a3985c09921903cf8f5e38fa56123.zip
[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/ipv6')
-rw-r--r--net/ipv6/proc.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 4b9d5a905725..562366015e54 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -243,27 +243,45 @@ int snmp6_unregister_dev(struct inet6_dev *idev)
return 0;
}
+static int ipv6_proc_init_net(struct net *net)
+{
+ if (!proc_net_fops_create(net, "sockstat6", S_IRUGO,
+ &sockstat6_seq_fops))
+ return -ENOMEM;
+ return 0;
+}
+
+static void ipv6_proc_exit_net(struct net *net)
+{
+ proc_net_remove(net, "sockstat6");
+}
+
+static struct pernet_operations ipv6_proc_ops = {
+ .init = ipv6_proc_init_net,
+ .exit = ipv6_proc_exit_net,
+};
+
int __init ipv6_misc_proc_init(void)
{
int rc = 0;
+ if (register_pernet_subsys(&ipv6_proc_ops))
+ goto proc_net_fail;
+
if (!proc_net_fops_create(&init_net, "snmp6", S_IRUGO, &snmp6_seq_fops))
goto proc_snmp6_fail;
proc_net_devsnmp6 = proc_mkdir("dev_snmp6", init_net.proc_net);
if (!proc_net_devsnmp6)
goto proc_dev_snmp6_fail;
-
- if (!proc_net_fops_create(&init_net, "sockstat6", S_IRUGO, &sockstat6_seq_fops))
- goto proc_sockstat6_fail;
out:
return rc;
-proc_sockstat6_fail:
- proc_net_remove(&init_net, "dev_snmp6");
proc_dev_snmp6_fail:
proc_net_remove(&init_net, "snmp6");
proc_snmp6_fail:
+ unregister_pernet_subsys(&ipv6_proc_ops);
+proc_net_fail:
rc = -ENOMEM;
goto out;
}
@@ -273,5 +291,6 @@ void ipv6_misc_proc_exit(void)
proc_net_remove(&init_net, "sockstat6");
proc_net_remove(&init_net, "dev_snmp6");
proc_net_remove(&init_net, "snmp6");
+ unregister_pernet_subsys(&ipv6_proc_ops);
}
OpenPOWER on IntegriCloud