From patchwork Thu Oct 2 10:14:04 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 2372 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 73C6CDDE01 for ; Thu, 2 Oct 2008 20:15:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753443AbYJBKPn (ORCPT ); Thu, 2 Oct 2008 06:15:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753441AbYJBKPn (ORCPT ); Thu, 2 Oct 2008 06:15:43 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:48819 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753434AbYJBKPm (ORCPT ); Thu, 2 Oct 2008 06:15:42 -0400 Received: from iris.sw.ru ([10.30.1.9]) (authenticated bits=0) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id m92ADsQj010518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Oct 2008 14:13:55 +0400 (MSD) Received: from den by iris.sw.ru with local (Exim 4.69) (envelope-from ) id 1KlLCG-0002Yl-Ij; Thu, 02 Oct 2008 14:14:12 +0400 From: "Denis V. Lunev" To: yoshfuji@linux-ipv6.org Cc: netdev@vger.kernel.org, containers@lists.linux-foundation.org, den@openvz.org, benjamin.thery@bull.net, dlezcano@fr.ibm.com, xemul@openvz.org Subject: [PATCH net-next 1/9] netns: move /proc/net/dev_snmp6 to struct net Date: Thu, 2 Oct 2008 14:14:04 +0400 Message-Id: <1222942452-9820-1-git-send-email-den@openvz.org> X-Mailer: git-send-email 1.5.6.4 In-Reply-To: <1222942394.6327.5.camel@iris.sw.ru> References: <1222942394.6327.5.camel@iris.sw.ru> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Denis V. Lunev --- include/net/netns/mib.h | 4 ++++ net/ipv6/proc.c | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h index 4491476..ffcef5d 100644 --- a/include/net/netns/mib.h +++ b/include/net/netns/mib.h @@ -11,6 +11,10 @@ struct netns_mib { DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics); + +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) + struct proc_dir_entry *proc_net_devsnmp6; +#endif }; #endif diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 0179b66..16ebf85 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c @@ -29,8 +29,6 @@ #include #include -static struct proc_dir_entry *proc_net_devsnmp6; - static int sockstat6_seq_show(struct seq_file *seq, void *v) { struct net *net = seq->private; @@ -210,18 +208,20 @@ static const struct file_operations snmp6_seq_fops = { int snmp6_register_dev(struct inet6_dev *idev) { struct proc_dir_entry *p; + struct net *net; if (!idev || !idev->dev) return -EINVAL; - if (!net_eq(dev_net(idev->dev), &init_net)) + net = dev_net(idev->dev); + if (!net_eq(net, &init_net)) return 0; - if (!proc_net_devsnmp6) + if (!net->mib.proc_net_devsnmp6) return -ENOENT; p = proc_create_data(idev->dev->name, S_IRUGO, - proc_net_devsnmp6, &snmp6_seq_fops, idev); + net->mib.proc_net_devsnmp6, &snmp6_seq_fops, idev); if (!p) return -ENOMEM; @@ -231,12 +231,13 @@ int snmp6_register_dev(struct inet6_dev *idev) int snmp6_unregister_dev(struct inet6_dev *idev) { - if (!proc_net_devsnmp6) + struct net *net = dev_net(idev->dev); + if (!net->mib.proc_net_devsnmp6) return -ENOENT; if (!idev || !idev->stats.proc_dir_entry) return -EINVAL; remove_proc_entry(idev->stats.proc_dir_entry->name, - proc_net_devsnmp6); + net->mib.proc_net_devsnmp6); idev->stats.proc_dir_entry = NULL; return 0; } @@ -269,8 +270,9 @@ int __init ipv6_misc_proc_init(void) 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) + 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;