aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/proc.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-10-07 17:45:55 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-07 17:45:55 -0400
commit835bcc0497e18f54153ac9e32b598dd8ffb7aa66 (patch)
tree7d0e41088297d678597bc4a7e425a78b7c0a5076 /net/ipv6/proc.c
parent4a7e56098f06d505f23f8d7c8d6762221065922a (diff)
netns: move /proc/net/dev_snmp6 to struct net
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/proc.c')
-rw-r--r--net/ipv6/proc.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 0179b66864f1..16ebf85d4ad2 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -29,8 +29,6 @@
29#include <net/transp_v6.h> 29#include <net/transp_v6.h>
30#include <net/ipv6.h> 30#include <net/ipv6.h>
31 31
32static struct proc_dir_entry *proc_net_devsnmp6;
33
34static int sockstat6_seq_show(struct seq_file *seq, void *v) 32static int sockstat6_seq_show(struct seq_file *seq, void *v)
35{ 33{
36 struct net *net = seq->private; 34 struct net *net = seq->private;
@@ -210,18 +208,20 @@ static const struct file_operations snmp6_seq_fops = {
210int snmp6_register_dev(struct inet6_dev *idev) 208int snmp6_register_dev(struct inet6_dev *idev)
211{ 209{
212 struct proc_dir_entry *p; 210 struct proc_dir_entry *p;
211 struct net *net;
213 212
214 if (!idev || !idev->dev) 213 if (!idev || !idev->dev)
215 return -EINVAL; 214 return -EINVAL;
216 215
217 if (!net_eq(dev_net(idev->dev), &init_net)) 216 net = dev_net(idev->dev);
217 if (!net_eq(net, &init_net))
218 return 0; 218 return 0;
219 219
220 if (!proc_net_devsnmp6) 220 if (!net->mib.proc_net_devsnmp6)
221 return -ENOENT; 221 return -ENOENT;
222 222
223 p = proc_create_data(idev->dev->name, S_IRUGO, 223 p = proc_create_data(idev->dev->name, S_IRUGO,
224 proc_net_devsnmp6, &snmp6_seq_fops, idev); 224 net->mib.proc_net_devsnmp6, &snmp6_seq_fops, idev);
225 if (!p) 225 if (!p)
226 return -ENOMEM; 226 return -ENOMEM;
227 227
@@ -231,12 +231,13 @@ int snmp6_register_dev(struct inet6_dev *idev)
231 231
232int snmp6_unregister_dev(struct inet6_dev *idev) 232int snmp6_unregister_dev(struct inet6_dev *idev)
233{ 233{
234 if (!proc_net_devsnmp6) 234 struct net *net = dev_net(idev->dev);
235 if (!net->mib.proc_net_devsnmp6)
235 return -ENOENT; 236 return -ENOENT;
236 if (!idev || !idev->stats.proc_dir_entry) 237 if (!idev || !idev->stats.proc_dir_entry)
237 return -EINVAL; 238 return -EINVAL;
238 remove_proc_entry(idev->stats.proc_dir_entry->name, 239 remove_proc_entry(idev->stats.proc_dir_entry->name,
239 proc_net_devsnmp6); 240 net->mib.proc_net_devsnmp6);
240 idev->stats.proc_dir_entry = NULL; 241 idev->stats.proc_dir_entry = NULL;
241 return 0; 242 return 0;
242} 243}
@@ -269,8 +270,9 @@ int __init ipv6_misc_proc_init(void)
269 if (!proc_net_fops_create(&init_net, "snmp6", S_IRUGO, &snmp6_seq_fops)) 270 if (!proc_net_fops_create(&init_net, "snmp6", S_IRUGO, &snmp6_seq_fops))
270 goto proc_snmp6_fail; 271 goto proc_snmp6_fail;
271 272
272 proc_net_devsnmp6 = proc_mkdir("dev_snmp6", init_net.proc_net); 273 init_net.mib.proc_net_devsnmp6 =
273 if (!proc_net_devsnmp6) 274 proc_mkdir("dev_snmp6", init_net.proc_net);
275 if (!init_net.mib.proc_net_devsnmp6)
274 goto proc_dev_snmp6_fail; 276 goto proc_dev_snmp6_fail;
275out: 277out:
276 return rc; 278 return rc;