mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
[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>
This commit is contained in:
parent
82cc1a7a56
commit
ea82edf704
@ -2633,6 +2633,41 @@ static const struct file_operations igmp6_mcf_seq_fops = {
|
|||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = seq_release_net,
|
.release = seq_release_net,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int igmp6_proc_init(struct net *net)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = -ENOMEM;
|
||||||
|
if (!proc_net_fops_create(net, "igmp6", S_IRUGO, &igmp6_mc_seq_fops))
|
||||||
|
goto out;
|
||||||
|
if (!proc_net_fops_create(net, "mcfilter6", S_IRUGO,
|
||||||
|
&igmp6_mcf_seq_fops))
|
||||||
|
goto out_proc_net_igmp6;
|
||||||
|
|
||||||
|
err = 0;
|
||||||
|
out:
|
||||||
|
return err;
|
||||||
|
|
||||||
|
out_proc_net_igmp6:
|
||||||
|
proc_net_remove(net, "igmp6");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void igmp6_proc_exit(struct net *net)
|
||||||
|
{
|
||||||
|
proc_net_remove(net, "mcfilter6");
|
||||||
|
proc_net_remove(net, "igmp6");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static int igmp6_proc_init(struct net *net)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static void igmp6_proc_exit(struct net *net)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int igmp6_net_init(struct net *net)
|
static int igmp6_net_init(struct net *net)
|
||||||
@ -2658,18 +2693,9 @@ static int igmp6_net_init(struct net *net)
|
|||||||
np = inet6_sk(sk);
|
np = inet6_sk(sk);
|
||||||
np->hop_limit = 1;
|
np->hop_limit = 1;
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
err = igmp6_proc_init(net);
|
||||||
err = -ENOMEM;
|
if (err)
|
||||||
if (!proc_net_fops_create(net, "igmp6", S_IRUGO, &igmp6_mc_seq_fops))
|
|
||||||
goto out_sock_create;
|
goto out_sock_create;
|
||||||
if (!proc_net_fops_create(net, "mcfilter6", S_IRUGO,
|
|
||||||
&igmp6_mcf_seq_fops)) {
|
|
||||||
proc_net_remove(net, "igmp6");
|
|
||||||
goto out_sock_create;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
err = 0;
|
|
||||||
out:
|
out:
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -2681,10 +2707,7 @@ out_sock_create:
|
|||||||
static void igmp6_net_exit(struct net *net)
|
static void igmp6_net_exit(struct net *net)
|
||||||
{
|
{
|
||||||
sk_release_kernel(net->ipv6.igmp_sk);
|
sk_release_kernel(net->ipv6.igmp_sk);
|
||||||
#ifdef CONFIG_PROC_FS
|
igmp6_proc_exit(net);
|
||||||
proc_net_remove(net, "mcfilter6");
|
|
||||||
proc_net_remove(net, "igmp6");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pernet_operations igmp6_net_ops = {
|
static struct pernet_operations igmp6_net_ops = {
|
||||||
|
Loading…
Reference in New Issue
Block a user