Commit 2c8c1e72 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by David S. Miller
Browse files

net: spread __net_init, __net_exit



__net_init/__net_exit are apparently not going away, so use them
to full extent.

In some cases __net_init was removed, because it was called from
__net_exit code.
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72659ecc
......@@ -3307,7 +3307,7 @@ static void bond_remove_proc_entry(struct bonding *bond)
/* Create the bonding directory under /proc/net, if doesn't exist yet.
* Caller must hold rtnl_lock.
*/
static void bond_create_proc_dir(struct bond_net *bn)
static void __net_init bond_create_proc_dir(struct bond_net *bn)
{
if (!bn->proc_dir) {
bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net);
......@@ -3320,7 +3320,7 @@ static void bond_create_proc_dir(struct bond_net *bn)
/* Destroy the bonding directory under /proc/net, if empty.
* Caller must hold rtnl_lock.
*/
static void bond_destroy_proc_dir(struct bond_net *bn)
static void __net_exit bond_destroy_proc_dir(struct bond_net *bn)
{
if (bn->proc_dir) {
remove_proc_entry(DRV_NAME, bn->net->proc_net);
......@@ -3338,11 +3338,11 @@ static void bond_remove_proc_entry(struct bonding *bond)
{
}
static void bond_create_proc_dir(struct bond_net *bn)
static inline void bond_create_proc_dir(struct bond_net *bn)
{
}
static void bond_destroy_proc_dir(struct bond_net *bn)
static inline void bond_destroy_proc_dir(struct bond_net *bn)
{
}
......@@ -4955,7 +4955,7 @@ int bond_create(struct net *net, const char *name)
goto out;
}
static int bond_net_init(struct net *net)
static int __net_init bond_net_init(struct net *net)
{
struct bond_net *bn = net_generic(net, bond_net_id);
......@@ -4967,7 +4967,7 @@ static int bond_net_init(struct net *net)
return 0;
}
static void bond_net_exit(struct net *net)
static void __net_exit bond_net_exit(struct net *net)
{
struct bond_net *bn = net_generic(net, bond_net_id);
......
......@@ -663,7 +663,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
return err;
}
static int vlan_init_net(struct net *net)
static int __net_init vlan_init_net(struct net *net)
{
struct vlan_net *vn = net_generic(net, vlan_net_id);
int err;
......@@ -675,7 +675,7 @@ static int vlan_init_net(struct net *net)
return err;
}
static void vlan_exit_net(struct net *net)
static void __net_exit vlan_exit_net(struct net *net)
{
vlan_proc_cleanup(net);
}
......
......@@ -140,7 +140,7 @@ void vlan_proc_cleanup(struct net *net)
* Create /proc/net/vlan entries
*/
int vlan_proc_init(struct net *net)
int __net_init vlan_proc_init(struct net *net)
{
struct vlan_net *vn = net_generic(net, vlan_net_id);
......
......@@ -467,7 +467,7 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
return 0;
}
void br_net_exit(struct net *net)
void __net_exit br_net_exit(struct net *net)
{
struct net_device *dev;
LIST_HEAD(list);
......
......@@ -708,7 +708,7 @@ static struct notifier_block fib_rules_notifier = {
.notifier_call = fib_rules_event,
};
static int fib_rules_net_init(struct net *net)
static int __net_init fib_rules_net_init(struct net *net)
{
INIT_LIST_HEAD(&net->rules_ops);
spin_lock_init(&net->rules_mod_lock);
......
......@@ -1386,7 +1386,7 @@ static struct notifier_block rtnetlink_dev_notifier = {
};
static int rtnetlink_net_init(struct net *net)
static int __net_init rtnetlink_net_init(struct net *net)
{
struct sock *sk;
sk = netlink_kernel_create(net, NETLINK_ROUTE, RTNLGRP_MAX,
......@@ -1397,7 +1397,7 @@ static int rtnetlink_net_init(struct net *net)
return 0;
}
static void rtnetlink_net_exit(struct net *net)
static void __net_exit rtnetlink_net_exit(struct net *net)
{
netlink_kernel_release(net->rtnl);
net->rtnl = NULL;
......
......@@ -2140,13 +2140,13 @@ int sock_prot_inuse_get(struct net *net, struct proto *prot)
}
EXPORT_SYMBOL_GPL(sock_prot_inuse_get);
static int sock_inuse_init_net(struct net *net)
static int __net_init sock_inuse_init_net(struct net *net)
{
net->core.inuse = alloc_percpu(struct prot_inuse);
return net->core.inuse ? 0 : -ENOMEM;
}
static void sock_inuse_exit_net(struct net *net)
static void __net_exit sock_inuse_exit_net(struct net *net)
{
free_percpu(net->core.inuse);
}
......
......@@ -996,7 +996,7 @@ static struct inet_protosw dccp_v4_protosw = {
.flags = INET_PROTOSW_ICSK,
};
static int dccp_v4_init_net(struct net *net)
static int __net_init dccp_v4_init_net(struct net *net)
{
int err;
......@@ -1005,7 +1005,7 @@ static int dccp_v4_init_net(struct net *net)
return err;
}
static void dccp_v4_exit_net(struct net *net)
static void __net_exit dccp_v4_exit_net(struct net *net)
{
inet_ctl_sock_destroy(net->dccp.v4_ctl_sk);
}
......
......@@ -1189,7 +1189,7 @@ static struct inet_protosw dccp_v6_protosw = {
.flags = INET_PROTOSW_ICSK,
};
static int dccp_v6_init_net(struct net *net)
static int __net_init dccp_v6_init_net(struct net *net)
{
int err;
......@@ -1198,7 +1198,7 @@ static int dccp_v6_init_net(struct net *net)
return err;
}
static void dccp_v6_exit_net(struct net *net)
static void __net_exit dccp_v6_exit_net(struct net *net)
{
inet_ctl_sock_destroy(net->dccp.v6_ctl_sk);
}
......
......@@ -883,7 +883,7 @@ static void nl_fib_input(struct sk_buff *skb)
netlink_unicast(net->ipv4.fibnl, skb, pid, MSG_DONTWAIT);
}
static int nl_fib_lookup_init(struct net *net)
static int __net_init nl_fib_lookup_init(struct net *net)
{
struct sock *sk;
sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, 0,
......@@ -1004,7 +1004,7 @@ static int __net_init ip_fib_net_init(struct net *net)
return err;
}
static void __net_exit ip_fib_net_exit(struct net *net)
static void ip_fib_net_exit(struct net *net)
{
unsigned int i;
......
......@@ -2603,7 +2603,7 @@ static const struct file_operations igmp_mcf_seq_fops = {
.release = seq_release_net,
};
static int igmp_net_init(struct net *net)
static int __net_init igmp_net_init(struct net *net)
{
struct proc_dir_entry *pde;
......@@ -2621,7 +2621,7 @@ static int igmp_net_init(struct net *net)
return -ENOMEM;
}
static void igmp_net_exit(struct net *net)
static void __net_exit igmp_net_exit(struct net *net)
{
proc_net_remove(net, "mcfilter");
proc_net_remove(net, "igmp");
......
......@@ -646,7 +646,7 @@ static struct ctl_table ip4_frags_ctl_table[] = {
{ }
};
static int ip4_frags_ns_ctl_register(struct net *net)
static int __net_init ip4_frags_ns_ctl_register(struct net *net)
{
struct ctl_table *table;
struct ctl_table_header *hdr;
......@@ -676,7 +676,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
return -ENOMEM;
}
static void ip4_frags_ns_ctl_unregister(struct net *net)
static void __net_exit ip4_frags_ns_ctl_unregister(struct net *net)
{
struct ctl_table *table;
......@@ -704,7 +704,7 @@ static inline void ip4_frags_ctl_register(void)
}
#endif
static int ipv4_frags_init_net(struct net *net)
static int __net_init ipv4_frags_init_net(struct net *net)
{
/*
* Fragment cache limits. We will commit 256K at one time. Should we
......@@ -726,7 +726,7 @@ static int ipv4_frags_init_net(struct net *net)
return ip4_frags_ns_ctl_register(net);
}
static void ipv4_frags_exit_net(struct net *net)
static void __net_exit ipv4_frags_exit_net(struct net *net)
{
ip4_frags_ns_ctl_unregister(net);
inet_frags_exit_net(&net->ipv4.frags, &ip4_frags);
......
......@@ -1307,7 +1307,7 @@ static void ipgre_destroy_tunnels(struct ipgre_net *ign, struct list_head *head)
}
}
static int ipgre_init_net(struct net *net)
static int __net_init ipgre_init_net(struct net *net)
{
struct ipgre_net *ign = net_generic(net, ipgre_net_id);
int err;
......@@ -1334,7 +1334,7 @@ static int ipgre_init_net(struct net *net)
return err;
}
static void ipgre_exit_net(struct net *net)
static void __net_exit ipgre_exit_net(struct net *net)
{
struct ipgre_net *ign;
LIST_HEAD(list);
......
......@@ -130,7 +130,6 @@ struct ipip_net {
struct net_device *fb_tunnel_dev;
};
static void ipip_fb_tunnel_init(struct net_device *dev);
static void ipip_tunnel_init(struct net_device *dev);
static void ipip_tunnel_setup(struct net_device *dev);
......@@ -730,7 +729,7 @@ static void ipip_tunnel_init(struct net_device *dev)
ipip_tunnel_bind_dev(dev);
}
static void ipip_fb_tunnel_init(struct net_device *dev)
static void __net_init ipip_fb_tunnel_init(struct net_device *dev)
{
struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph;
......@@ -773,7 +772,7 @@ static void ipip_destroy_tunnels(struct ipip_net *ipn, struct list_head *head)
}
}
static int ipip_init_net(struct net *net)
static int __net_init ipip_init_net(struct net *net)
{
struct ipip_net *ipn = net_generic(net, ipip_net_id);
int err;
......@@ -806,7 +805,7 @@ static int ipip_init_net(struct net *net)
return err;
}
static void ipip_exit_net(struct net *net)
static void __net_exit ipip_exit_net(struct net *net)
{
struct ipip_net *ipn = net_generic(net, ipip_net_id);
LIST_HEAD(list);
......
......@@ -2430,12 +2430,12 @@ static struct tcp_seq_afinfo tcp4_seq_afinfo = {
},
};
static int tcp4_proc_init_net(struct net *net)
static int __net_init tcp4_proc_init_net(struct net *net)
{
return tcp_proc_register(net, &tcp4_seq_afinfo);
}
static void tcp4_proc_exit_net(struct net *net)
static void __net_exit tcp4_proc_exit_net(struct net *net)
{
tcp_proc_unregister(net, &tcp4_seq_afinfo);
}
......
......@@ -2027,12 +2027,12 @@ static struct udp_seq_afinfo udp4_seq_afinfo = {
},
};
static int udp4_proc_init_net(struct net *net)
static int __net_init udp4_proc_init_net(struct net *net)
{
return udp_proc_register(net, &udp4_seq_afinfo);
}
static void udp4_proc_exit_net(struct net *net)
static void __net_exit udp4_proc_exit_net(struct net *net)
{
udp_proc_unregister(net, &udp4_seq_afinfo);
}
......
......@@ -81,12 +81,12 @@ static struct udp_seq_afinfo udplite4_seq_afinfo = {
},
};
static int udplite4_proc_init_net(struct net *net)
static int __net_init udplite4_proc_init_net(struct net *net)
{
return udp_proc_register(net, &udplite4_seq_afinfo);
}
static void udplite4_proc_exit_net(struct net *net)
static void __net_exit udplite4_proc_exit_net(struct net *net)
{
udp_proc_unregister(net, &udplite4_seq_afinfo);
}
......
......@@ -3027,14 +3027,14 @@ static const struct file_operations if6_fops = {
.release = seq_release_net,
};
static int if6_proc_net_init(struct net *net)
static int __net_init if6_proc_net_init(struct net *net)
{
if (!proc_net_fops_create(net, "if_inet6", S_IRUGO, &if6_fops))
return -ENOMEM;
return 0;
}
static void if6_proc_net_exit(struct net *net)
static void __net_exit if6_proc_net_exit(struct net *net)
{
proc_net_remove(net, "if_inet6");
}
......@@ -4418,7 +4418,7 @@ static void addrconf_sysctl_unregister(struct inet6_dev *idev)
#endif
static int addrconf_init_net(struct net *net)
static int __net_init addrconf_init_net(struct net *net)
{
int err;
struct ipv6_devconf *all, *dflt;
......@@ -4467,7 +4467,7 @@ static int addrconf_init_net(struct net *net)
return err;
}
static void addrconf_exit_net(struct net *net)
static void __net_exit addrconf_exit_net(struct net *net)
{
#ifdef CONFIG_SYSCTL
__addrconf_sysctl_unregister(net->ipv6.devconf_dflt);
......
......@@ -999,7 +999,7 @@ static int __net_init ipv6_init_mibs(struct net *net)
return -ENOMEM;
}
static void __net_exit ipv6_cleanup_mibs(struct net *net)
static void ipv6_cleanup_mibs(struct net *net)
{
snmp_mib_free((void **)net->mib.udp_stats_in6);
snmp_mib_free((void **)net->mib.udplite_stats_in6);
......@@ -1042,7 +1042,7 @@ static int __net_init inet6_net_init(struct net *net)
#endif
}
static void inet6_net_exit(struct net *net)
static void __net_exit inet6_net_exit(struct net *net)
{
#ifdef CONFIG_PROC_FS
udp6_proc_exit(net);
......
......@@ -538,7 +538,7 @@ static const struct file_operations ac6_seq_fops = {
.release = seq_release_net,
};
int ac6_proc_init(struct net *net)
int __net_init ac6_proc_init(struct net *net)
{
if (!proc_net_fops_create(net, "anycast6", S_IRUGO, &ac6_seq_fops))
return -ENOMEM;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment