aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/mcast.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-10-10 05:29:29 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:55:33 -0400
commitcf7732e4cc14b56d593ff53352673e1fd5e3ba52 (patch)
tree3479e278b72f9d535a58066bc2a26238806252ce /net/ipv6/mcast.c
parent39699037a5c94d7cd1363dfe48a50c78c643fd9a (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/ipv6/mcast.c')
-rw-r--r--net/ipv6/mcast.c40
1 files changed, 4 insertions, 36 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index cc8d4e2a9531..331d728c2035 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2426,24 +2426,8 @@ static const struct seq_operations igmp6_mc_seq_ops = {
2426 2426
2427static int igmp6_mc_seq_open(struct inode *inode, struct file *file) 2427static int igmp6_mc_seq_open(struct inode *inode, struct file *file)
2428{ 2428{
2429 struct seq_file *seq; 2429 return seq_open_private(file, &igmp6_mc_seq_ops,
2430 int rc = -ENOMEM; 2430 sizeof(struct igmp6_mc_iter_state));
2431 struct igmp6_mc_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2432
2433 if (!s)
2434 goto out;
2435
2436 rc = seq_open(file, &igmp6_mc_seq_ops);
2437 if (rc)
2438 goto out_kfree;
2439
2440 seq = file->private_data;
2441 seq->private = s;
2442out:
2443 return rc;
2444out_kfree:
2445 kfree(s);
2446 goto out;
2447} 2431}
2448 2432
2449static const struct file_operations igmp6_mc_seq_fops = { 2433static const struct file_operations igmp6_mc_seq_fops = {
@@ -2600,24 +2584,8 @@ static const struct seq_operations igmp6_mcf_seq_ops = {
2600 2584
2601static int igmp6_mcf_seq_open(struct inode *inode, struct file *file) 2585static int igmp6_mcf_seq_open(struct inode *inode, struct file *file)
2602{ 2586{
2603 struct seq_file *seq; 2587 return seq_open_private(file, &igmp6_mcf_seq_ops,
2604 int rc = -ENOMEM; 2588 sizeof(struct igmp6_mcf_iter_state));
2605 struct igmp6_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2606
2607 if (!s)
2608 goto out;
2609
2610 rc = seq_open(file, &igmp6_mcf_seq_ops);
2611 if (rc)
2612 goto out_kfree;
2613
2614 seq = file->private_data;
2615 seq->private = s;
2616out:
2617 return rc;
2618out_kfree:
2619 kfree(s);
2620 goto out;
2621} 2589}
2622 2590
2623static const struct file_operations igmp6_mcf_seq_fops = { 2591static const struct file_operations igmp6_mcf_seq_fops = {