]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[NETFILTER]: Make netfilter code use the seq_open_private
authorPavel Emelyanov <xemul@openvz.org>
Wed, 10 Oct 2007 09:29:58 +0000 (02:29 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:55:34 +0000 (16:55 -0700)
Just switch to the consolidated calls.

ipt_recent() has to initialize the private, so use
the __seq_open_private() helper.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter/ipt_recent.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
net/netfilter/nf_conntrack_expect.c
net/netfilter/nf_conntrack_standalone.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c

index db2a79889f9a6f64bc925529633f5e9e5b097f4b..11d39fb5f38bade83b7ce74aa5a435f6e38da854 100644 (file)
@@ -381,25 +381,14 @@ static const struct seq_operations recent_seq_ops = {
 static int recent_seq_open(struct inode *inode, struct file *file)
 {
        struct proc_dir_entry *pde = PDE(inode);
-       struct seq_file *seq;
        struct recent_iter_state *st;
-       int ret;
 
-       st = kzalloc(sizeof(*st), GFP_KERNEL);
+       st = __seq_open_private(file, &recent_seq_ops, sizeof(*st));
        if (st == NULL)
                return -ENOMEM;
 
-       ret = seq_open(file, &recent_seq_ops);
-       if (ret) {
-               kfree(st);
-               goto out;
-       }
-
        st->table    = pde->data;
-       seq          = file->private_data;
-       seq->private = st;
-out:
-       return ret;
+       return 0;
 }
 
 static ssize_t recent_proc_write(struct file *file, const char __user *input,
index a5ae2eabf0f335020b0b370a15b9d9c9efe843c6..741f3dfaa5a101efe385dc9c30755a8e8de218dd 100644 (file)
@@ -174,22 +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 = kzalloc(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;
-       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,22 +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 = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
-       if (!st)
-               return -ENOMEM;
-       ret = seq_open(file, &exp_seq_ops);
-       if (ret)
-               goto out_free;
-       seq          = file->private_data;
-       seq->private = st;
-       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 = {
index 7a0ae36c9b47351203d54fc95d2b532975fd914d..175c8d1a199219ee57144b9c1d0574c4374abf01 100644 (file)
@@ -472,22 +472,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 = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
-       if (!st)
-               return -ENOMEM;
-       ret = seq_open(file, &exp_seq_ops);
-       if (ret)
-               goto out_free;
-       seq          = file->private_data;
-       seq->private = st;
-       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 exp_file_ops = {
index 2a19c5f1240f85bce4bb8f5c4a4199be67207b12..9efdd37fc19543a1e57b013ff51686ad2b1c406a 100644 (file)
@@ -195,22 +195,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 = kzalloc(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;
-       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 = {
index 2135926199ca39387effe3864f3aa3461bded3cc..2c7bd2eb0294400ed1175749f41281ed4f7b735b 100644 (file)
@@ -951,22 +951,8 @@ static const struct seq_operations nful_seq_ops = {
 
 static int nful_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *seq;
-       struct iter_state *is;
-       int ret;
-
-       is = kzalloc(sizeof(*is), GFP_KERNEL);
-       if (!is)
-               return -ENOMEM;
-       ret = seq_open(file, &nful_seq_ops);
-       if (ret < 0)
-               goto out_free;
-       seq = file->private_data;
-       seq->private = is;
-       return ret;
-out_free:
-       kfree(is);
-       return ret;
+       return seq_open_private(file, &nful_seq_ops,
+                       sizeof(struct iter_state));
 }
 
 static const struct file_operations nful_file_ops = {
index 48e095a7de2db28a566fe906845a6d1bd480a1c5..49f0480afe099ac4643bf895eb05d68256b563a6 100644 (file)
@@ -1051,22 +1051,8 @@ static const struct seq_operations nfqnl_seq_ops = {
 
 static int nfqnl_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *seq;
-       struct iter_state *is;
-       int ret;
-
-       is = kzalloc(sizeof(*is), GFP_KERNEL);
-       if (!is)
-               return -ENOMEM;
-       ret = seq_open(file, &nfqnl_seq_ops);
-       if (ret < 0)
-               goto out_free;
-       seq = file->private_data;
-       seq->private = is;
-       return ret;
-out_free:
-       kfree(is);
-       return ret;
+       return seq_open_private(file, &nfqnl_seq_ops,
+                       sizeof(struct iter_state));
 }
 
 static const struct file_operations nfqnl_file_ops = {