diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-03-21 07:10:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-21 07:10:53 -0400 |
commit | ea82edf704f6bf3c3a51d0dbee816c5bbc6d3974 (patch) | |
tree | fd0fd1832bedaeaabb4ec6ed228389de7a9b5b18 /net | |
parent | 82cc1a7a56872056af0ead6c7d695aa223f36695 (diff) |
[NETNS][IPV6] mcast - fix compilation warning when procfs is not compiled in
When CONFIG_PROC_FS=no, the out_sock_create label is not used because
the code using it is disabled and that leads to a warning at compile
time.
This patch fix that by making a specific function to initialize proc
for igmp6, and remove the annoying CONFIG_PROC_FS sections in
init/exit function.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/mcast.c | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index f2879056fab0..957ac7e9e929 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -2633,6 +2633,41 @@ static const struct file_operations igmp6_mcf_seq_fops = { | |||
2633 | .llseek = seq_lseek, | 2633 | .llseek = seq_lseek, |
2634 | .release = seq_release_net, | 2634 | .release = seq_release_net, |
2635 | }; | 2635 | }; |
2636 | |||
2637 | static int igmp6_proc_init(struct net *net) | ||
2638 | { | ||
2639 | int err; | ||
2640 | |||
2641 | err = -ENOMEM; | ||
2642 | if (!proc_net_fops_create(net, "igmp6", S_IRUGO, &igmp6_mc_seq_fops)) | ||
2643 | goto out; | ||
2644 | if (!proc_net_fops_create(net, "mcfilter6", S_IRUGO, | ||
2645 | &igmp6_mcf_seq_fops)) | ||
2646 | goto out_proc_net_igmp6; | ||
2647 | |||
2648 | err = 0; | ||
2649 | out: | ||
2650 | return err; | ||
2651 | |||
2652 | out_proc_net_igmp6: | ||
2653 | proc_net_remove(net, "igmp6"); | ||
2654 | goto out; | ||
2655 | } | ||
2656 | |||
2657 | static void igmp6_proc_exit(struct net *net) | ||
2658 | { | ||
2659 | proc_net_remove(net, "mcfilter6"); | ||
2660 | proc_net_remove(net, "igmp6"); | ||
2661 | } | ||
2662 | #else | ||
2663 | static int igmp6_proc_init(struct net *net) | ||
2664 | { | ||
2665 | return 0; | ||
2666 | } | ||
2667 | static void igmp6_proc_exit(struct net *net) | ||
2668 | { | ||
2669 | ; | ||
2670 | } | ||
2636 | #endif | 2671 | #endif |
2637 | 2672 | ||
2638 | static int igmp6_net_init(struct net *net) | 2673 | static int igmp6_net_init(struct net *net) |
@@ -2658,18 +2693,9 @@ static int igmp6_net_init(struct net *net) | |||
2658 | np = inet6_sk(sk); | 2693 | np = inet6_sk(sk); |
2659 | np->hop_limit = 1; | 2694 | np->hop_limit = 1; |
2660 | 2695 | ||
2661 | #ifdef CONFIG_PROC_FS | 2696 | err = igmp6_proc_init(net); |
2662 | err = -ENOMEM; | 2697 | if (err) |
2663 | if (!proc_net_fops_create(net, "igmp6", S_IRUGO, &igmp6_mc_seq_fops)) | ||
2664 | goto out_sock_create; | ||
2665 | if (!proc_net_fops_create(net, "mcfilter6", S_IRUGO, | ||
2666 | &igmp6_mcf_seq_fops)) { | ||
2667 | proc_net_remove(net, "igmp6"); | ||
2668 | goto out_sock_create; | 2698 | goto out_sock_create; |
2669 | } | ||
2670 | #endif | ||
2671 | |||
2672 | err = 0; | ||
2673 | out: | 2699 | out: |
2674 | return err; | 2700 | return err; |
2675 | 2701 | ||
@@ -2681,10 +2707,7 @@ out_sock_create: | |||
2681 | static void igmp6_net_exit(struct net *net) | 2707 | static void igmp6_net_exit(struct net *net) |
2682 | { | 2708 | { |
2683 | sk_release_kernel(net->ipv6.igmp_sk); | 2709 | sk_release_kernel(net->ipv6.igmp_sk); |
2684 | #ifdef CONFIG_PROC_FS | 2710 | igmp6_proc_exit(net); |
2685 | proc_net_remove(net, "mcfilter6"); | ||
2686 | proc_net_remove(net, "igmp6"); | ||
2687 | #endif | ||
2688 | } | 2711 | } |
2689 | 2712 | ||
2690 | static struct pernet_operations igmp6_net_ops = { | 2713 | static struct pernet_operations igmp6_net_ops = { |