netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
To: yoshfuji-VfPWfsRibaP+Ru+s062T9g@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	den-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org,
	dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org,
	xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org,
	benjamin.thery-6ktuUTfB/bM@public.gmane.org
Subject: [PATCH net-next 2/9] netns: register /proc/net/dev_snmp6/* in each ns
Date: Thu,  2 Oct 2008 14:14:05 +0400	[thread overview]
Message-ID: <1222942452-9820-2-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1222942394.6327.5.camel-aPCOdVxUTlgvJsYlp49lxw@public.gmane.org>

Do the same for /proc/net/snmp6.

Signed-off-by: Denis V. Lunev <den-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
---
 net/ipv6/proc.c |   40 ++++++++++++++++------------------------
 1 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 16ebf85..5764062 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -247,12 +247,27 @@ static int ipv6_proc_init_net(struct net *net)
 	if (!proc_net_fops_create(net, "sockstat6", S_IRUGO,
 			&sockstat6_seq_fops))
 		return -ENOMEM;
+
+	if (!proc_net_fops_create(net, "snmp6", S_IRUGO, &snmp6_seq_fops))
+		goto proc_snmp6_fail;
+
+	net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net);
+	if (!net->mib.proc_net_devsnmp6)
+		goto proc_dev_snmp6_fail;
 	return 0;
+
+proc_snmp6_fail:
+	proc_net_remove(net, "sockstat6");
+proc_dev_snmp6_fail:
+	proc_net_remove(net, "dev_snmp6");
+	return -ENOMEM;
 }
 
 static void ipv6_proc_exit_net(struct net *net)
 {
 	proc_net_remove(net, "sockstat6");
+	proc_net_remove(net, "dev_snmp6");
+	proc_net_remove(net, "snmp6");
 }
 
 static struct pernet_operations ipv6_proc_ops = {
@@ -262,34 +277,11 @@ static struct pernet_operations ipv6_proc_ops = {
 
 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;
-
-	init_net.mib.proc_net_devsnmp6 =
-		proc_mkdir("dev_snmp6", init_net.proc_net);
-	if (!init_net.mib.proc_net_devsnmp6)
-		goto proc_dev_snmp6_fail;
-out:
-	return rc;
-
-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;
+	return register_pernet_subsys(&ipv6_proc_ops);
 }
 
 void ipv6_misc_proc_exit(void)
 {
-	proc_net_remove(&init_net, "dev_snmp6");
-	proc_net_remove(&init_net, "snmp6");
 	unregister_pernet_subsys(&ipv6_proc_ops);
 }
 
-- 
1.5.3.rc5

  parent reply	other threads:[~2008-10-02 10:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02 10:13 [PATCH net-next 0/9] ipv6: making UDP mibs per/namespace Denis V. Lunev
     [not found] ` <1222942394.6327.5.camel-aPCOdVxUTlgvJsYlp49lxw@public.gmane.org>
2008-10-02 10:14   ` [PATCH net-next 1/9] netns: move /proc/net/dev_snmp6 to struct net Denis V. Lunev
2008-10-02 10:14   ` Denis V. Lunev [this message]
2008-10-02 10:14   ` [PATCH net-next 3/9] ipv6: consolidate ipv6 sock_stat code at the beginning of net/ipv6/proc.c Denis V. Lunev
2008-10-02 10:14   ` [PATCH net-next 4/9] ipv6: separate seq_ops for global & per/device ipv6 statistics Denis V. Lunev
2008-10-02 10:14   ` [PATCH net-next 5/9] netns: register global ipv6 mibs statistics in each namespace Denis V. Lunev
2008-10-02 10:14   ` [PATCH net-next 6/9] netns: allow per device ipv6 snmp statistics in non-initial namespace Denis V. Lunev
2008-10-02 10:14   ` [PATCH net-next 7/9] netns: add stab functions for per/namespace mibs allocation Denis V. Lunev
2008-10-02 10:14   ` [PATCH net-next 9/9] netns: make uplitev6 mib per/namespace Denis V. Lunev
2008-10-02 10:14 ` [PATCH net-next 8/9] netns: make udpv6 " Denis V. Lunev
2008-10-07 22:00 ` [PATCH net-next 0/9] ipv6: making UDP mibs per/namespace David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1222942452-9820-2-git-send-email-den@openvz.org \
    --to=den-gefaqzzx7r8dnm+yrofe0a@public.gmane.org \
    --cc=benjamin.thery-6ktuUTfB/bM@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=yoshfuji-VfPWfsRibaP+Ru+s062T9g@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).