diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-10 05:29:29 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:33 -0400 |
commit | cf7732e4cc14b56d593ff53352673e1fd5e3ba52 (patch) | |
tree | 3479e278b72f9d535a58066bc2a26238806252ce /net/ipv4/igmp.c | |
parent | 39699037a5c94d7cd1363dfe48a50c78c643fd9a (diff) |
[NET]: Make core networking code use seq_open_private
This concerns the ipv4 and ipv6 code mostly, but also the netlink
and unix sockets.
The netlink code is an example of how to use the __seq_open_private()
call - it saves the net namespace on this private.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/igmp.c')
-rw-r--r-- | net/ipv4/igmp.c | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 2b6e59c4c0d0..7dbc282d4f9f 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -2410,23 +2410,8 @@ static const struct seq_operations igmp_mc_seq_ops = { | |||
2410 | 2410 | ||
2411 | static int igmp_mc_seq_open(struct inode *inode, struct file *file) | 2411 | static int igmp_mc_seq_open(struct inode *inode, struct file *file) |
2412 | { | 2412 | { |
2413 | struct seq_file *seq; | 2413 | return seq_open_private(file, &igmp_mc_seq_ops, |
2414 | int rc = -ENOMEM; | 2414 | sizeof(struct igmp_mc_iter_state)); |
2415 | struct igmp_mc_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
2416 | |||
2417 | if (!s) | ||
2418 | goto out; | ||
2419 | rc = seq_open(file, &igmp_mc_seq_ops); | ||
2420 | if (rc) | ||
2421 | goto out_kfree; | ||
2422 | |||
2423 | seq = file->private_data; | ||
2424 | seq->private = s; | ||
2425 | out: | ||
2426 | return rc; | ||
2427 | out_kfree: | ||
2428 | kfree(s); | ||
2429 | goto out; | ||
2430 | } | 2415 | } |
2431 | 2416 | ||
2432 | static const struct file_operations igmp_mc_seq_fops = { | 2417 | static const struct file_operations igmp_mc_seq_fops = { |
@@ -2584,23 +2569,8 @@ static const struct seq_operations igmp_mcf_seq_ops = { | |||
2584 | 2569 | ||
2585 | static int igmp_mcf_seq_open(struct inode *inode, struct file *file) | 2570 | static int igmp_mcf_seq_open(struct inode *inode, struct file *file) |
2586 | { | 2571 | { |
2587 | struct seq_file *seq; | 2572 | return seq_open_private(file, &igmp_mcf_seq_ops, |
2588 | int rc = -ENOMEM; | 2573 | sizeof(struct igmp_mcf_iter_state)); |
2589 | struct igmp_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
2590 | |||
2591 | if (!s) | ||
2592 | goto out; | ||
2593 | rc = seq_open(file, &igmp_mcf_seq_ops); | ||
2594 | if (rc) | ||
2595 | goto out_kfree; | ||
2596 | |||
2597 | seq = file->private_data; | ||
2598 | seq->private = s; | ||
2599 | out: | ||
2600 | return rc; | ||
2601 | out_kfree: | ||
2602 | kfree(s); | ||
2603 | goto out; | ||
2604 | } | 2574 | } |
2605 | 2575 | ||
2606 | static const struct file_operations igmp_mcf_seq_fops = { | 2576 | static const struct file_operations igmp_mcf_seq_fops = { |