[NETFILTER]: {nf_netlink,ip,ip6}_queue: use list_for_each_entry
[powerpc.git] / net / ipv4 / netfilter / nf_conntrack_l3proto_ipv4_compat.c
index 3da9d73..741f3df 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/percpu.h>
+#include <net/net_namespace.h>
 
 #include <linux/netfilter.h>
 #include <net/netfilter/nf_conntrack_core.h>
@@ -173,23 +174,8 @@ static const struct seq_operations ct_seq_ops = {
 
 static int ct_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *seq;
-       struct ct_iter_state *st;
-       int ret;
-
-       st = kmalloc(sizeof(struct ct_iter_state), GFP_KERNEL);
-       if (st == NULL)
-               return -ENOMEM;
-       ret = seq_open(file, &ct_seq_ops);
-       if (ret)
-               goto out_free;
-       seq          = file->private_data;
-       seq->private = st;
-       memset(st, 0, sizeof(struct ct_iter_state));
-       return ret;
-out_free:
-       kfree(st);
-       return ret;
+       return seq_open_private(file, &ct_seq_ops,
+                       sizeof(struct ct_iter_state));
 }
 
 static const struct file_operations ct_file_ops = {
@@ -291,23 +277,8 @@ static const struct seq_operations exp_seq_ops = {
 
 static int exp_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *seq;
-       struct ct_expect_iter_state *st;
-       int ret;
-
-       st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
-       if (st == NULL)
-               return -ENOMEM;
-       ret = seq_open(file, &exp_seq_ops);
-       if (ret)
-               goto out_free;
-       seq          = file->private_data;
-       seq->private = st;
-       memset(st, 0, sizeof(struct ct_expect_iter_state));
-       return ret;
-out_free:
-       kfree(st);
-       return ret;
+       return seq_open_private(file, &exp_seq_ops,
+                       sizeof(struct ct_expect_iter_state));
 }
 
 static const struct file_operations ip_exp_file_ops = {
@@ -410,16 +381,16 @@ int __init nf_conntrack_ipv4_compat_init(void)
 {
        struct proc_dir_entry *proc, *proc_exp, *proc_stat;
 
-       proc = proc_net_fops_create("ip_conntrack", 0440, &ct_file_ops);
+       proc = proc_net_fops_create(&init_net, "ip_conntrack", 0440, &ct_file_ops);
        if (!proc)
                goto err1;
 
-       proc_exp = proc_net_fops_create("ip_conntrack_expect", 0440,
+       proc_exp = proc_net_fops_create(&init_net, "ip_conntrack_expect", 0440,
                                        &ip_exp_file_ops);
        if (!proc_exp)
                goto err2;
 
-       proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, proc_net_stat);
+       proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, init_net.proc_net_stat);
        if (!proc_stat)
                goto err3;
 
@@ -429,16 +400,16 @@ int __init nf_conntrack_ipv4_compat_init(void)
        return 0;
 
 err3:
-       proc_net_remove("ip_conntrack_expect");
+       proc_net_remove(&init_net, "ip_conntrack_expect");
 err2:
-       proc_net_remove("ip_conntrack");
+       proc_net_remove(&init_net, "ip_conntrack");
 err1:
        return -ENOMEM;
 }
 
 void __exit nf_conntrack_ipv4_compat_fini(void)
 {
-       remove_proc_entry("ip_conntrack", proc_net_stat);
-       proc_net_remove("ip_conntrack_expect");
-       proc_net_remove("ip_conntrack");
+       remove_proc_entry("ip_conntrack", init_net.proc_net_stat);
+       proc_net_remove(&init_net, "ip_conntrack_expect");
+       proc_net_remove(&init_net, "ip_conntrack");
 }