diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-10 05:29:58 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:34 -0400 |
commit | e2da59133880976586b2d9d81d798222ecafa566 (patch) | |
tree | 03cb1c61318992437e3bc040b34fa437b957c662 /net | |
parent | cf7732e4cc14b56d593ff53352673e1fd5e3ba52 (diff) |
[NETFILTER]: Make netfilter code use the seq_open_private
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/ipt_recent.c | 15 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 36 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_expect.c | 18 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_standalone.c | 18 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 18 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue.c | 18 |
6 files changed, 14 insertions, 109 deletions
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index db2a79889f9a..11d39fb5f38b 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c | |||
@@ -381,25 +381,14 @@ static const struct seq_operations recent_seq_ops = { | |||
381 | static int recent_seq_open(struct inode *inode, struct file *file) | 381 | static int recent_seq_open(struct inode *inode, struct file *file) |
382 | { | 382 | { |
383 | struct proc_dir_entry *pde = PDE(inode); | 383 | struct proc_dir_entry *pde = PDE(inode); |
384 | struct seq_file *seq; | ||
385 | struct recent_iter_state *st; | 384 | struct recent_iter_state *st; |
386 | int ret; | ||
387 | 385 | ||
388 | st = kzalloc(sizeof(*st), GFP_KERNEL); | 386 | st = __seq_open_private(file, &recent_seq_ops, sizeof(*st)); |
389 | if (st == NULL) | 387 | if (st == NULL) |
390 | return -ENOMEM; | 388 | return -ENOMEM; |
391 | 389 | ||
392 | ret = seq_open(file, &recent_seq_ops); | ||
393 | if (ret) { | ||
394 | kfree(st); | ||
395 | goto out; | ||
396 | } | ||
397 | |||
398 | st->table = pde->data; | 390 | st->table = pde->data; |
399 | seq = file->private_data; | 391 | return 0; |
400 | seq->private = st; | ||
401 | out: | ||
402 | return ret; | ||
403 | } | 392 | } |
404 | 393 | ||
405 | static ssize_t recent_proc_write(struct file *file, const char __user *input, | 394 | static ssize_t recent_proc_write(struct file *file, const char __user *input, |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index a5ae2eabf0f3..741f3dfaa5a1 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | |||
@@ -174,22 +174,8 @@ static const struct seq_operations ct_seq_ops = { | |||
174 | 174 | ||
175 | static int ct_open(struct inode *inode, struct file *file) | 175 | static int ct_open(struct inode *inode, struct file *file) |
176 | { | 176 | { |
177 | struct seq_file *seq; | 177 | return seq_open_private(file, &ct_seq_ops, |
178 | struct ct_iter_state *st; | 178 | sizeof(struct ct_iter_state)); |
179 | int ret; | ||
180 | |||
181 | st = kzalloc(sizeof(struct ct_iter_state), GFP_KERNEL); | ||
182 | if (st == NULL) | ||
183 | return -ENOMEM; | ||
184 | ret = seq_open(file, &ct_seq_ops); | ||
185 | if (ret) | ||
186 | goto out_free; | ||
187 | seq = file->private_data; | ||
188 | seq->private = st; | ||
189 | return ret; | ||
190 | out_free: | ||
191 | kfree(st); | ||
192 | return ret; | ||
193 | } | 179 | } |
194 | 180 | ||
195 | static const struct file_operations ct_file_ops = { | 181 | static const struct file_operations ct_file_ops = { |
@@ -291,22 +277,8 @@ static const struct seq_operations exp_seq_ops = { | |||
291 | 277 | ||
292 | static int exp_open(struct inode *inode, struct file *file) | 278 | static int exp_open(struct inode *inode, struct file *file) |
293 | { | 279 | { |
294 | struct seq_file *seq; | 280 | return seq_open_private(file, &exp_seq_ops, |
295 | struct ct_expect_iter_state *st; | 281 | sizeof(struct ct_expect_iter_state)); |
296 | int ret; | ||
297 | |||
298 | st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); | ||
299 | if (!st) | ||
300 | return -ENOMEM; | ||
301 | ret = seq_open(file, &exp_seq_ops); | ||
302 | if (ret) | ||
303 | goto out_free; | ||
304 | seq = file->private_data; | ||
305 | seq->private = st; | ||
306 | return ret; | ||
307 | out_free: | ||
308 | kfree(st); | ||
309 | return ret; | ||
310 | } | 282 | } |
311 | 283 | ||
312 | static const struct file_operations ip_exp_file_ops = { | 284 | static const struct file_operations ip_exp_file_ops = { |
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index 7a0ae36c9b47..175c8d1a1992 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c | |||
@@ -472,22 +472,8 @@ static const struct seq_operations exp_seq_ops = { | |||
472 | 472 | ||
473 | static int exp_open(struct inode *inode, struct file *file) | 473 | static int exp_open(struct inode *inode, struct file *file) |
474 | { | 474 | { |
475 | struct seq_file *seq; | 475 | return seq_open_private(file, &exp_seq_ops, |
476 | struct ct_expect_iter_state *st; | 476 | sizeof(struct ct_expect_iter_state)); |
477 | int ret; | ||
478 | |||
479 | st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); | ||
480 | if (!st) | ||
481 | return -ENOMEM; | ||
482 | ret = seq_open(file, &exp_seq_ops); | ||
483 | if (ret) | ||
484 | goto out_free; | ||
485 | seq = file->private_data; | ||
486 | seq->private = st; | ||
487 | return ret; | ||
488 | out_free: | ||
489 | kfree(st); | ||
490 | return ret; | ||
491 | } | 477 | } |
492 | 478 | ||
493 | static const struct file_operations exp_file_ops = { | 479 | static const struct file_operations exp_file_ops = { |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 2a19c5f1240f..9efdd37fc195 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -195,22 +195,8 @@ static const struct seq_operations ct_seq_ops = { | |||
195 | 195 | ||
196 | static int ct_open(struct inode *inode, struct file *file) | 196 | static int ct_open(struct inode *inode, struct file *file) |
197 | { | 197 | { |
198 | struct seq_file *seq; | 198 | return seq_open_private(file, &ct_seq_ops, |
199 | struct ct_iter_state *st; | 199 | sizeof(struct ct_iter_state)); |
200 | int ret; | ||
201 | |||
202 | st = kzalloc(sizeof(struct ct_iter_state), GFP_KERNEL); | ||
203 | if (st == NULL) | ||
204 | return -ENOMEM; | ||
205 | ret = seq_open(file, &ct_seq_ops); | ||
206 | if (ret) | ||
207 | goto out_free; | ||
208 | seq = file->private_data; | ||
209 | seq->private = st; | ||
210 | return ret; | ||
211 | out_free: | ||
212 | kfree(st); | ||
213 | return ret; | ||
214 | } | 200 | } |
215 | 201 | ||
216 | static const struct file_operations ct_file_ops = { | 202 | static const struct file_operations ct_file_ops = { |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 2135926199ca..2c7bd2eb0294 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -951,22 +951,8 @@ static const struct seq_operations nful_seq_ops = { | |||
951 | 951 | ||
952 | static int nful_open(struct inode *inode, struct file *file) | 952 | static int nful_open(struct inode *inode, struct file *file) |
953 | { | 953 | { |
954 | struct seq_file *seq; | 954 | return seq_open_private(file, &nful_seq_ops, |
955 | struct iter_state *is; | 955 | sizeof(struct iter_state)); |
956 | int ret; | ||
957 | |||
958 | is = kzalloc(sizeof(*is), GFP_KERNEL); | ||
959 | if (!is) | ||
960 | return -ENOMEM; | ||
961 | ret = seq_open(file, &nful_seq_ops); | ||
962 | if (ret < 0) | ||
963 | goto out_free; | ||
964 | seq = file->private_data; | ||
965 | seq->private = is; | ||
966 | return ret; | ||
967 | out_free: | ||
968 | kfree(is); | ||
969 | return ret; | ||
970 | } | 956 | } |
971 | 957 | ||
972 | static const struct file_operations nful_file_ops = { | 958 | static const struct file_operations nful_file_ops = { |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 48e095a7de2d..49f0480afe09 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -1051,22 +1051,8 @@ static const struct seq_operations nfqnl_seq_ops = { | |||
1051 | 1051 | ||
1052 | static int nfqnl_open(struct inode *inode, struct file *file) | 1052 | static int nfqnl_open(struct inode *inode, struct file *file) |
1053 | { | 1053 | { |
1054 | struct seq_file *seq; | 1054 | return seq_open_private(file, &nfqnl_seq_ops, |
1055 | struct iter_state *is; | 1055 | sizeof(struct iter_state)); |
1056 | int ret; | ||
1057 | |||
1058 | is = kzalloc(sizeof(*is), GFP_KERNEL); | ||
1059 | if (!is) | ||
1060 | return -ENOMEM; | ||
1061 | ret = seq_open(file, &nfqnl_seq_ops); | ||
1062 | if (ret < 0) | ||
1063 | goto out_free; | ||
1064 | seq = file->private_data; | ||
1065 | seq->private = is; | ||
1066 | return ret; | ||
1067 | out_free: | ||
1068 | kfree(is); | ||
1069 | return ret; | ||
1070 | } | 1056 | } |
1071 | 1057 | ||
1072 | static const struct file_operations nfqnl_file_ops = { | 1058 | static const struct file_operations nfqnl_file_ops = { |