[NET]: Make /proc/net per network namespace
[linux-block.git] / net / decnet / dn_route.c
index f2a61ef2af9cdebde1f5d217d09a8b74be9bc8c7..4cfea9563d2abe67cae6ddedab03c90c79b09083 100644 (file)
@@ -77,6 +77,7 @@
 #include <linux/rcupdate.h>
 #include <linux/times.h>
 #include <asm/errno.h>
+#include <net/net_namespace.h>
 #include <net/netlink.h>
 #include <net/neighbour.h>
 #include <net/dst.h>
@@ -1737,8 +1738,9 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct dn_rt_cache_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct dn_rt_cache_iter_state *s;
 
+       s = kzalloc(sizeof(*s), GFP_KERNEL);
        if (!s)
                goto out;
        rc = seq_open(file, &dn_rt_cache_seq_ops);
@@ -1746,7 +1748,6 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file)
                goto out_kfree;
        seq             = file->private_data;
        seq->private    = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
@@ -1814,7 +1815,7 @@ void __init dn_route_init(void)
 
        dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);
 
-       proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
+       proc_net_fops_create(&init_net, "decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
 
 #ifdef CONFIG_DECNET_ROUTER
        rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, dn_fib_dump);
@@ -1829,6 +1830,6 @@ void __exit dn_route_cleanup(void)
        del_timer(&dn_route_timer);
        dn_run_flush(0);
 
-       proc_net_remove("decnet_cache");
+       proc_net_remove(&init_net, "decnet_cache");
 }