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/ipv6 | |
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/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 20 | ||||
-rw-r--r-- | net/ipv6/anycast.c | 20 | ||||
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 20 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 40 | ||||
-rw-r--r-- | net/ipv6/raw.c | 17 |
5 files changed, 12 insertions, 105 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 6d5c3c299148..8b2d760ddf26 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2806,24 +2806,8 @@ static const struct seq_operations if6_seq_ops = { | |||
2806 | 2806 | ||
2807 | static int if6_seq_open(struct inode *inode, struct file *file) | 2807 | static int if6_seq_open(struct inode *inode, struct file *file) |
2808 | { | 2808 | { |
2809 | struct seq_file *seq; | 2809 | return seq_open_private(file, &if6_seq_ops, |
2810 | int rc = -ENOMEM; | 2810 | sizeof(struct if6_iter_state)); |
2811 | struct if6_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
2812 | |||
2813 | if (!s) | ||
2814 | goto out; | ||
2815 | |||
2816 | rc = seq_open(file, &if6_seq_ops); | ||
2817 | if (rc) | ||
2818 | goto out_kfree; | ||
2819 | |||
2820 | seq = file->private_data; | ||
2821 | seq->private = s; | ||
2822 | out: | ||
2823 | return rc; | ||
2824 | out_kfree: | ||
2825 | kfree(s); | ||
2826 | goto out; | ||
2827 | } | 2811 | } |
2828 | 2812 | ||
2829 | static const struct file_operations if6_fops = { | 2813 | static const struct file_operations if6_fops = { |
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 5810852c558a..f915c4df9820 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -549,24 +549,8 @@ static const struct seq_operations ac6_seq_ops = { | |||
549 | 549 | ||
550 | static int ac6_seq_open(struct inode *inode, struct file *file) | 550 | static int ac6_seq_open(struct inode *inode, struct file *file) |
551 | { | 551 | { |
552 | struct seq_file *seq; | 552 | return seq_open_private(file, &ac6_seq_ops, |
553 | int rc = -ENOMEM; | 553 | sizeof(struct ac6_iter_state)); |
554 | struct ac6_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
555 | |||
556 | if (!s) | ||
557 | goto out; | ||
558 | |||
559 | rc = seq_open(file, &ac6_seq_ops); | ||
560 | if (rc) | ||
561 | goto out_kfree; | ||
562 | |||
563 | seq = file->private_data; | ||
564 | seq->private = s; | ||
565 | out: | ||
566 | return rc; | ||
567 | out_kfree: | ||
568 | kfree(s); | ||
569 | goto out; | ||
570 | } | 554 | } |
571 | 555 | ||
572 | static const struct file_operations ac6_seq_fops = { | 556 | static const struct file_operations ac6_seq_fops = { |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 1791399c7f10..217d60f9fc80 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -658,24 +658,8 @@ static const struct seq_operations ip6fl_seq_ops = { | |||
658 | 658 | ||
659 | static int ip6fl_seq_open(struct inode *inode, struct file *file) | 659 | static int ip6fl_seq_open(struct inode *inode, struct file *file) |
660 | { | 660 | { |
661 | struct seq_file *seq; | 661 | return seq_open_private(file, &ip6fl_seq_ops, |
662 | int rc = -ENOMEM; | 662 | sizeof(struct ip6fl_iter_state)); |
663 | struct ip6fl_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
664 | |||
665 | if (!s) | ||
666 | goto out; | ||
667 | |||
668 | rc = seq_open(file, &ip6fl_seq_ops); | ||
669 | if (rc) | ||
670 | goto out_kfree; | ||
671 | |||
672 | seq = file->private_data; | ||
673 | seq->private = s; | ||
674 | out: | ||
675 | return rc; | ||
676 | out_kfree: | ||
677 | kfree(s); | ||
678 | goto out; | ||
679 | } | 663 | } |
680 | 664 | ||
681 | static const struct file_operations ip6fl_seq_fops = { | 665 | static const struct file_operations ip6fl_seq_fops = { |
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 | ||
2427 | static int igmp6_mc_seq_open(struct inode *inode, struct file *file) | 2427 | static 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; | ||
2442 | out: | ||
2443 | return rc; | ||
2444 | out_kfree: | ||
2445 | kfree(s); | ||
2446 | goto out; | ||
2447 | } | 2431 | } |
2448 | 2432 | ||
2449 | static const struct file_operations igmp6_mc_seq_fops = { | 2433 | static const struct file_operations igmp6_mc_seq_fops = { |
@@ -2600,24 +2584,8 @@ static const struct seq_operations igmp6_mcf_seq_ops = { | |||
2600 | 2584 | ||
2601 | static int igmp6_mcf_seq_open(struct inode *inode, struct file *file) | 2585 | static 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; | ||
2616 | out: | ||
2617 | return rc; | ||
2618 | out_kfree: | ||
2619 | kfree(s); | ||
2620 | goto out; | ||
2621 | } | 2589 | } |
2622 | 2590 | ||
2623 | static const struct file_operations igmp6_mcf_seq_fops = { | 2591 | static const struct file_operations igmp6_mcf_seq_fops = { |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index bdd0974e6775..ca24ef19cd8f 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1289,21 +1289,8 @@ static const struct seq_operations raw6_seq_ops = { | |||
1289 | 1289 | ||
1290 | static int raw6_seq_open(struct inode *inode, struct file *file) | 1290 | static int raw6_seq_open(struct inode *inode, struct file *file) |
1291 | { | 1291 | { |
1292 | struct seq_file *seq; | 1292 | return seq_open_private(file, &raw6_seq_ops, |
1293 | int rc = -ENOMEM; | 1293 | sizeof(struct raw6_iter_state)); |
1294 | struct raw6_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
1295 | if (!s) | ||
1296 | goto out; | ||
1297 | rc = seq_open(file, &raw6_seq_ops); | ||
1298 | if (rc) | ||
1299 | goto out_kfree; | ||
1300 | seq = file->private_data; | ||
1301 | seq->private = s; | ||
1302 | out: | ||
1303 | return rc; | ||
1304 | out_kfree: | ||
1305 | kfree(s); | ||
1306 | goto out; | ||
1307 | } | 1294 | } |
1308 | 1295 | ||
1309 | static const struct file_operations raw6_seq_fops = { | 1296 | static const struct file_operations raw6_seq_fops = { |