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: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Alexey Dobriyan 2010-01-17 03:35:32 +00:00 committed by David S. Miller
parent 72659ecce6
commit 2c8c1e7297
44 changed files with 107 additions and 112 deletions

View File

@ -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. /* Create the bonding directory under /proc/net, if doesn't exist yet.
* Caller must hold rtnl_lock. * 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) { if (!bn->proc_dir) {
bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net); 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. /* Destroy the bonding directory under /proc/net, if empty.
* Caller must hold rtnl_lock. * 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) { if (bn->proc_dir) {
remove_proc_entry(DRV_NAME, bn->net->proc_net); 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 @@ out_netdev:
goto out; 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); struct bond_net *bn = net_generic(net, bond_net_id);
@ -4967,7 +4967,7 @@ static int bond_net_init(struct net *net)
return 0; 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); struct bond_net *bn = net_generic(net, bond_net_id);

View File

@ -663,7 +663,7 @@ out:
return err; 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); struct vlan_net *vn = net_generic(net, vlan_net_id);
int err; int err;
@ -675,7 +675,7 @@ static int vlan_init_net(struct net *net)
return err; return err;
} }
static void vlan_exit_net(struct net *net) static void __net_exit vlan_exit_net(struct net *net)
{ {
vlan_proc_cleanup(net); vlan_proc_cleanup(net);
} }

View File

@ -140,7 +140,7 @@ void vlan_proc_cleanup(struct net *net)
* Create /proc/net/vlan entries * 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); struct vlan_net *vn = net_generic(net, vlan_net_id);

View File

@ -467,7 +467,7 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
return 0; return 0;
} }
void br_net_exit(struct net *net) void __net_exit br_net_exit(struct net *net)
{ {
struct net_device *dev; struct net_device *dev;
LIST_HEAD(list); LIST_HEAD(list);

View File

@ -708,7 +708,7 @@ static struct notifier_block fib_rules_notifier = {
.notifier_call = fib_rules_event, .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); INIT_LIST_HEAD(&net->rules_ops);
spin_lock_init(&net->rules_mod_lock); spin_lock_init(&net->rules_mod_lock);

View File

@ -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; struct sock *sk;
sk = netlink_kernel_create(net, NETLINK_ROUTE, RTNLGRP_MAX, sk = netlink_kernel_create(net, NETLINK_ROUTE, RTNLGRP_MAX,
@ -1397,7 +1397,7 @@ static int rtnetlink_net_init(struct net *net)
return 0; 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); netlink_kernel_release(net->rtnl);
net->rtnl = NULL; net->rtnl = NULL;

View File

@ -2140,13 +2140,13 @@ int sock_prot_inuse_get(struct net *net, struct proto *prot)
} }
EXPORT_SYMBOL_GPL(sock_prot_inuse_get); 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); net->core.inuse = alloc_percpu(struct prot_inuse);
return net->core.inuse ? 0 : -ENOMEM; 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); free_percpu(net->core.inuse);
} }

View File

@ -996,7 +996,7 @@ static struct inet_protosw dccp_v4_protosw = {
.flags = INET_PROTOSW_ICSK, .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; int err;
@ -1005,7 +1005,7 @@ static int dccp_v4_init_net(struct net *net)
return err; 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); inet_ctl_sock_destroy(net->dccp.v4_ctl_sk);
} }

View File

@ -1189,7 +1189,7 @@ static struct inet_protosw dccp_v6_protosw = {
.flags = INET_PROTOSW_ICSK, .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; int err;
@ -1198,7 +1198,7 @@ static int dccp_v6_init_net(struct net *net)
return err; 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); inet_ctl_sock_destroy(net->dccp.v6_ctl_sk);
} }

View File

@ -883,7 +883,7 @@ static void nl_fib_input(struct sk_buff *skb)
netlink_unicast(net->ipv4.fibnl, skb, pid, MSG_DONTWAIT); 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; struct sock *sk;
sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, 0, sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, 0,
@ -1004,7 +1004,7 @@ fail:
return err; 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; unsigned int i;

View File

@ -2603,7 +2603,7 @@ static const struct file_operations igmp_mcf_seq_fops = {
.release = seq_release_net, .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; struct proc_dir_entry *pde;
@ -2621,7 +2621,7 @@ out_igmp:
return -ENOMEM; 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, "mcfilter");
proc_net_remove(net, "igmp"); proc_net_remove(net, "igmp");

View File

@ -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 *table;
struct ctl_table_header *hdr; struct ctl_table_header *hdr;
@ -676,7 +676,7 @@ err_alloc:
return -ENOMEM; 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; struct ctl_table *table;
@ -704,7 +704,7 @@ static inline void ip4_frags_ctl_register(void)
} }
#endif #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 * 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); 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); ip4_frags_ns_ctl_unregister(net);
inet_frags_exit_net(&net->ipv4.frags, &ip4_frags); inet_frags_exit_net(&net->ipv4.frags, &ip4_frags);

View File

@ -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); struct ipgre_net *ign = net_generic(net, ipgre_net_id);
int err; int err;
@ -1334,7 +1334,7 @@ err_alloc_dev:
return err; return err;
} }
static void ipgre_exit_net(struct net *net) static void __net_exit ipgre_exit_net(struct net *net)
{ {
struct ipgre_net *ign; struct ipgre_net *ign;
LIST_HEAD(list); LIST_HEAD(list);

View File

@ -130,7 +130,6 @@ struct ipip_net {
struct net_device *fb_tunnel_dev; 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_init(struct net_device *dev);
static void ipip_tunnel_setup(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); 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 ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph; 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); struct ipip_net *ipn = net_generic(net, ipip_net_id);
int err; int err;
@ -806,7 +805,7 @@ err_alloc_dev:
return err; 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); struct ipip_net *ipn = net_generic(net, ipip_net_id);
LIST_HEAD(list); LIST_HEAD(list);

View File

@ -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); 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); tcp_proc_unregister(net, &tcp4_seq_afinfo);
} }

View File

@ -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); 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); udp_proc_unregister(net, &udp4_seq_afinfo);
} }

View File

@ -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); 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); udp_proc_unregister(net, &udplite4_seq_afinfo);
} }

View File

@ -3027,14 +3027,14 @@ static const struct file_operations if6_fops = {
.release = seq_release_net, .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)) if (!proc_net_fops_create(net, "if_inet6", S_IRUGO, &if6_fops))
return -ENOMEM; return -ENOMEM;
return 0; 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"); proc_net_remove(net, "if_inet6");
} }
@ -4418,7 +4418,7 @@ static void addrconf_sysctl_unregister(struct inet6_dev *idev)
#endif #endif
static int addrconf_init_net(struct net *net) static int __net_init addrconf_init_net(struct net *net)
{ {
int err; int err;
struct ipv6_devconf *all, *dflt; struct ipv6_devconf *all, *dflt;
@ -4467,7 +4467,7 @@ err_alloc_all:
return err; return err;
} }
static void addrconf_exit_net(struct net *net) static void __net_exit addrconf_exit_net(struct net *net)
{ {
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
__addrconf_sysctl_unregister(net->ipv6.devconf_dflt); __addrconf_sysctl_unregister(net->ipv6.devconf_dflt);

View File

@ -999,7 +999,7 @@ err_udplite_mib:
return -ENOMEM; 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.udp_stats_in6);
snmp_mib_free((void **)net->mib.udplite_stats_in6); snmp_mib_free((void **)net->mib.udplite_stats_in6);
@ -1042,7 +1042,7 @@ out:
#endif #endif
} }
static void inet6_net_exit(struct net *net) static void __net_exit inet6_net_exit(struct net *net)
{ {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
udp6_proc_exit(net); udp6_proc_exit(net);

View File

@ -538,7 +538,7 @@ static const struct file_operations ac6_seq_fops = {
.release = seq_release_net, .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)) if (!proc_net_fops_create(net, "anycast6", S_IRUGO, &ac6_seq_fops))
return -ENOMEM; return -ENOMEM;

View File

@ -262,7 +262,7 @@ static struct fib_rules_ops fib6_rules_ops_template = {
.fro_net = &init_net, .fro_net = &init_net,
}; };
static int fib6_rules_net_init(struct net *net) static int __net_init fib6_rules_net_init(struct net *net)
{ {
struct fib_rules_ops *ops; struct fib_rules_ops *ops;
int err = -ENOMEM; int err = -ENOMEM;
@ -291,7 +291,7 @@ out_fib6_rules_ops:
goto out; goto out;
} }
static void fib6_rules_net_exit(struct net *net) static void __net_exit fib6_rules_net_exit(struct net *net)
{ {
fib_rules_unregister(net->ipv6.fib6_rules_ops); fib_rules_unregister(net->ipv6.fib6_rules_ops);
} }

View File

@ -951,7 +951,7 @@ ctl_table ipv6_icmp_table_template[] = {
{ }, { },
}; };
struct ctl_table *ipv6_icmp_sysctl_init(struct net *net) struct ctl_table * __net_init ipv6_icmp_sysctl_init(struct net *net)
{ {
struct ctl_table *table; struct ctl_table *table;

View File

@ -239,7 +239,7 @@ struct fib6_table *fib6_get_table(struct net *net, u32 id)
return NULL; return NULL;
} }
static void fib6_tables_init(struct net *net) static void __net_init fib6_tables_init(struct net *net)
{ {
fib6_link_table(net, net->ipv6.fib6_main_tbl); fib6_link_table(net, net->ipv6.fib6_main_tbl);
fib6_link_table(net, net->ipv6.fib6_local_tbl); fib6_link_table(net, net->ipv6.fib6_local_tbl);
@ -262,7 +262,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
return (struct dst_entry *) lookup(net, net->ipv6.fib6_main_tbl, fl, flags); return (struct dst_entry *) lookup(net, net->ipv6.fib6_main_tbl, fl, flags);
} }
static void fib6_tables_init(struct net *net) static void __net_init fib6_tables_init(struct net *net)
{ {
fib6_link_table(net, net->ipv6.fib6_main_tbl); fib6_link_table(net, net->ipv6.fib6_main_tbl);
} }
@ -1469,7 +1469,7 @@ static void fib6_gc_timer_cb(unsigned long arg)
fib6_run_gc(0, (struct net *)arg); fib6_run_gc(0, (struct net *)arg);
} }
static int fib6_net_init(struct net *net) static int __net_init fib6_net_init(struct net *net)
{ {
setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net); setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net);

View File

@ -154,7 +154,7 @@ static void ip6_fl_gc(unsigned long dummy)
write_unlock(&ip6_fl_lock); write_unlock(&ip6_fl_lock);
} }
static void ip6_fl_purge(struct net *net) static void __net_exit ip6_fl_purge(struct net *net)
{ {
int i; int i;
@ -735,7 +735,7 @@ static const struct file_operations ip6fl_seq_fops = {
.release = seq_release_net, .release = seq_release_net,
}; };
static int ip6_flowlabel_proc_init(struct net *net) static int __net_init ip6_flowlabel_proc_init(struct net *net)
{ {
if (!proc_net_fops_create(net, "ip6_flowlabel", if (!proc_net_fops_create(net, "ip6_flowlabel",
S_IRUGO, &ip6fl_seq_fops)) S_IRUGO, &ip6fl_seq_fops))
@ -743,7 +743,7 @@ static int ip6_flowlabel_proc_init(struct net *net)
return 0; return 0;
} }
static void ip6_flowlabel_proc_fini(struct net *net) static void __net_exit ip6_flowlabel_proc_fini(struct net *net)
{ {
proc_net_remove(net, "ip6_flowlabel"); proc_net_remove(net, "ip6_flowlabel");
} }
@ -754,11 +754,10 @@ static inline int ip6_flowlabel_proc_init(struct net *net)
} }
static inline void ip6_flowlabel_proc_fini(struct net *net) static inline void ip6_flowlabel_proc_fini(struct net *net)
{ {
return ;
} }
#endif #endif
static inline void ip6_flowlabel_net_exit(struct net *net) static void __net_exit ip6_flowlabel_net_exit(struct net *net)
{ {
ip6_fl_purge(net); ip6_fl_purge(net);
ip6_flowlabel_proc_fini(net); ip6_flowlabel_proc_fini(net);

View File

@ -74,7 +74,6 @@ MODULE_LICENSE("GPL");
(addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \ (addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \
(HASH_SIZE - 1)) (HASH_SIZE - 1))
static void ip6_fb_tnl_dev_init(struct net_device *dev);
static void ip6_tnl_dev_init(struct net_device *dev); static void ip6_tnl_dev_init(struct net_device *dev);
static void ip6_tnl_dev_setup(struct net_device *dev); static void ip6_tnl_dev_setup(struct net_device *dev);
@ -1364,7 +1363,7 @@ static void ip6_tnl_dev_init(struct net_device *dev)
* Return: 0 * Return: 0
**/ **/
static void ip6_fb_tnl_dev_init(struct net_device *dev) static void __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
{ {
struct ip6_tnl *t = netdev_priv(dev); struct ip6_tnl *t = netdev_priv(dev);
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
@ -1388,7 +1387,7 @@ static struct xfrm6_tunnel ip6ip6_handler = {
.priority = 1, .priority = 1,
}; };
static void ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n) static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n)
{ {
int h; int h;
struct ip6_tnl *t; struct ip6_tnl *t;
@ -1407,7 +1406,7 @@ static void ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n)
unregister_netdevice_many(&list); unregister_netdevice_many(&list);
} }
static int ip6_tnl_init_net(struct net *net) static int __net_init ip6_tnl_init_net(struct net *net)
{ {
struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
int err; int err;
@ -1436,7 +1435,7 @@ err_alloc_dev:
return err; return err;
} }
static void ip6_tnl_exit_net(struct net *net) static void __net_exit ip6_tnl_exit_net(struct net *net)
{ {
struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);

View File

@ -2646,7 +2646,7 @@ static const struct file_operations igmp6_mcf_seq_fops = {
.release = seq_release_net, .release = seq_release_net,
}; };
static int igmp6_proc_init(struct net *net) static int __net_init igmp6_proc_init(struct net *net)
{ {
int err; int err;
@ -2666,23 +2666,22 @@ out_proc_net_igmp6:
goto out; goto out;
} }
static void igmp6_proc_exit(struct net *net) static void __net_exit igmp6_proc_exit(struct net *net)
{ {
proc_net_remove(net, "mcfilter6"); proc_net_remove(net, "mcfilter6");
proc_net_remove(net, "igmp6"); proc_net_remove(net, "igmp6");
} }
#else #else
static int igmp6_proc_init(struct net *net) static inline int igmp6_proc_init(struct net *net)
{ {
return 0; return 0;
} }
static void igmp6_proc_exit(struct net *net) static inline void igmp6_proc_exit(struct net *net)
{ {
;
} }
#endif #endif
static int igmp6_net_init(struct net *net) static int __net_init igmp6_net_init(struct net *net)
{ {
int err; int err;
@ -2708,7 +2707,7 @@ out_sock_create:
goto out; goto out;
} }
static void igmp6_net_exit(struct net *net) static void __net_exit igmp6_net_exit(struct net *net)
{ {
inet_ctl_sock_destroy(net->ipv6.igmp_sk); inet_ctl_sock_destroy(net->ipv6.igmp_sk);
igmp6_proc_exit(net); igmp6_proc_exit(net);

View File

@ -1772,7 +1772,7 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *bu
#endif #endif
static int ndisc_net_init(struct net *net) static int __net_init ndisc_net_init(struct net *net)
{ {
struct ipv6_pinfo *np; struct ipv6_pinfo *np;
struct sock *sk; struct sock *sk;
@ -1797,7 +1797,7 @@ static int ndisc_net_init(struct net *net)
return 0; return 0;
} }
static void ndisc_net_exit(struct net *net) static void __net_exit ndisc_net_exit(struct net *net)
{ {
inet_ctl_sock_destroy(net->ipv6.ndisc_sk); inet_ctl_sock_destroy(net->ipv6.ndisc_sk);
} }

View File

@ -267,7 +267,7 @@ int snmp6_unregister_dev(struct inet6_dev *idev)
return 0; return 0;
} }
static int ipv6_proc_init_net(struct net *net) static int __net_init ipv6_proc_init_net(struct net *net)
{ {
if (!proc_net_fops_create(net, "sockstat6", S_IRUGO, if (!proc_net_fops_create(net, "sockstat6", S_IRUGO,
&sockstat6_seq_fops)) &sockstat6_seq_fops))
@ -288,7 +288,7 @@ proc_dev_snmp6_fail:
return -ENOMEM; return -ENOMEM;
} }
static void ipv6_proc_exit_net(struct net *net) static void __net_exit ipv6_proc_exit_net(struct net *net)
{ {
proc_net_remove(net, "sockstat6"); proc_net_remove(net, "sockstat6");
proc_net_remove(net, "dev_snmp6"); proc_net_remove(net, "dev_snmp6");

View File

@ -1275,7 +1275,7 @@ static const struct file_operations raw6_seq_fops = {
.release = seq_release_net, .release = seq_release_net,
}; };
static int raw6_init_net(struct net *net) static int __net_init raw6_init_net(struct net *net)
{ {
if (!proc_net_fops_create(net, "raw6", S_IRUGO, &raw6_seq_fops)) if (!proc_net_fops_create(net, "raw6", S_IRUGO, &raw6_seq_fops))
return -ENOMEM; return -ENOMEM;
@ -1283,7 +1283,7 @@ static int raw6_init_net(struct net *net)
return 0; return 0;
} }
static void raw6_exit_net(struct net *net) static void __net_exit raw6_exit_net(struct net *net)
{ {
proc_net_remove(net, "raw6"); proc_net_remove(net, "raw6");
} }

View File

@ -672,7 +672,7 @@ static struct ctl_table ip6_frags_ctl_table[] = {
{ } { }
}; };
static int ip6_frags_ns_sysctl_register(struct net *net) static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
{ {
struct ctl_table *table; struct ctl_table *table;
struct ctl_table_header *hdr; struct ctl_table_header *hdr;
@ -702,7 +702,7 @@ err_alloc:
return -ENOMEM; return -ENOMEM;
} }
static void ip6_frags_ns_sysctl_unregister(struct net *net) static void __net_exit ip6_frags_ns_sysctl_unregister(struct net *net)
{ {
struct ctl_table *table; struct ctl_table *table;
@ -745,7 +745,7 @@ static inline void ip6_frags_sysctl_unregister(void)
} }
#endif #endif
static int ipv6_frags_init_net(struct net *net) static int __net_init ipv6_frags_init_net(struct net *net)
{ {
net->ipv6.frags.high_thresh = 256 * 1024; net->ipv6.frags.high_thresh = 256 * 1024;
net->ipv6.frags.low_thresh = 192 * 1024; net->ipv6.frags.low_thresh = 192 * 1024;
@ -756,7 +756,7 @@ static int ipv6_frags_init_net(struct net *net)
return ip6_frags_ns_sysctl_register(net); return ip6_frags_ns_sysctl_register(net);
} }
static void ipv6_frags_exit_net(struct net *net) static void __net_exit ipv6_frags_exit_net(struct net *net)
{ {
ip6_frags_ns_sysctl_unregister(net); ip6_frags_ns_sysctl_unregister(net);
inet_frags_exit_net(&net->ipv6.frags, &ip6_frags); inet_frags_exit_net(&net->ipv6.frags, &ip6_frags);

View File

@ -2612,7 +2612,7 @@ ctl_table ipv6_route_table_template[] = {
{ } { }
}; };
struct ctl_table *ipv6_route_sysctl_init(struct net *net) struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net)
{ {
struct ctl_table *table; struct ctl_table *table;
@ -2637,7 +2637,7 @@ struct ctl_table *ipv6_route_sysctl_init(struct net *net)
} }
#endif #endif
static int ip6_route_net_init(struct net *net) static int __net_init ip6_route_net_init(struct net *net)
{ {
int ret = -ENOMEM; int ret = -ENOMEM;
@ -2702,7 +2702,7 @@ out_ip6_dst_ops:
goto out; goto out;
} }
static void ip6_route_net_exit(struct net *net) static void __net_exit ip6_route_net_exit(struct net *net)
{ {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
proc_net_remove(net, "ipv6_route"); proc_net_remove(net, "ipv6_route");

View File

@ -62,7 +62,6 @@
#define HASH_SIZE 16 #define HASH_SIZE 16
#define HASH(addr) (((__force u32)addr^((__force u32)addr>>4))&0xF) #define HASH(addr) (((__force u32)addr^((__force u32)addr>>4))&0xF)
static void ipip6_fb_tunnel_init(struct net_device *dev);
static void ipip6_tunnel_init(struct net_device *dev); static void ipip6_tunnel_init(struct net_device *dev);
static void ipip6_tunnel_setup(struct net_device *dev); static void ipip6_tunnel_setup(struct net_device *dev);
@ -1120,7 +1119,7 @@ static void ipip6_tunnel_init(struct net_device *dev)
ipip6_tunnel_bind_dev(dev); ipip6_tunnel_bind_dev(dev);
} }
static void ipip6_fb_tunnel_init(struct net_device *dev) static void __net_init ipip6_fb_tunnel_init(struct net_device *dev)
{ {
struct ip_tunnel *tunnel = netdev_priv(dev); struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph; struct iphdr *iph = &tunnel->parms.iph;
@ -1145,7 +1144,7 @@ static struct xfrm_tunnel sit_handler = {
.priority = 1, .priority = 1,
}; };
static void sit_destroy_tunnels(struct sit_net *sitn, struct list_head *head) static void __net_exit sit_destroy_tunnels(struct sit_net *sitn, struct list_head *head)
{ {
int prio; int prio;
@ -1162,7 +1161,7 @@ static void sit_destroy_tunnels(struct sit_net *sitn, struct list_head *head)
} }
} }
static int sit_init_net(struct net *net) static int __net_init sit_init_net(struct net *net)
{ {
struct sit_net *sitn = net_generic(net, sit_net_id); struct sit_net *sitn = net_generic(net, sit_net_id);
int err; int err;
@ -1195,7 +1194,7 @@ err_alloc_dev:
return err; return err;
} }
static void sit_exit_net(struct net *net) static void __net_exit sit_exit_net(struct net *net)
{ {
struct sit_net *sitn = net_generic(net, sit_net_id); struct sit_net *sitn = net_generic(net, sit_net_id);
LIST_HEAD(list); LIST_HEAD(list);

View File

@ -55,7 +55,7 @@ struct ctl_path net_ipv6_ctl_path[] = {
}; };
EXPORT_SYMBOL_GPL(net_ipv6_ctl_path); EXPORT_SYMBOL_GPL(net_ipv6_ctl_path);
static int ipv6_sysctl_net_init(struct net *net) static int __net_init ipv6_sysctl_net_init(struct net *net)
{ {
struct ctl_table *ipv6_table; struct ctl_table *ipv6_table;
struct ctl_table *ipv6_route_table; struct ctl_table *ipv6_route_table;
@ -98,7 +98,7 @@ out_ipv6_table:
goto out; goto out;
} }
static void ipv6_sysctl_net_exit(struct net *net) static void __net_exit ipv6_sysctl_net_exit(struct net *net)
{ {
struct ctl_table *ipv6_table; struct ctl_table *ipv6_table;
struct ctl_table *ipv6_route_table; struct ctl_table *ipv6_route_table;

View File

@ -2113,7 +2113,7 @@ static struct tcp_seq_afinfo tcp6_seq_afinfo = {
}, },
}; };
int tcp6_proc_init(struct net *net) int __net_init tcp6_proc_init(struct net *net)
{ {
return tcp_proc_register(net, &tcp6_seq_afinfo); return tcp_proc_register(net, &tcp6_seq_afinfo);
} }
@ -2182,18 +2182,18 @@ static struct inet_protosw tcpv6_protosw = {
INET_PROTOSW_ICSK, INET_PROTOSW_ICSK,
}; };
static int tcpv6_net_init(struct net *net) static int __net_init tcpv6_net_init(struct net *net)
{ {
return inet_ctl_sock_create(&net->ipv6.tcp_sk, PF_INET6, return inet_ctl_sock_create(&net->ipv6.tcp_sk, PF_INET6,
SOCK_RAW, IPPROTO_TCP, net); SOCK_RAW, IPPROTO_TCP, net);
} }
static void tcpv6_net_exit(struct net *net) static void __net_exit tcpv6_net_exit(struct net *net)
{ {
inet_ctl_sock_destroy(net->ipv6.tcp_sk); inet_ctl_sock_destroy(net->ipv6.tcp_sk);
} }
static void tcpv6_net_exit_batch(struct list_head *net_exit_list) static void __net_exit tcpv6_net_exit_batch(struct list_head *net_exit_list)
{ {
inet_twsk_purge(&tcp_hashinfo, &tcp_death_row, AF_INET6); inet_twsk_purge(&tcp_hashinfo, &tcp_death_row, AF_INET6);
} }

View File

@ -1396,7 +1396,7 @@ static struct udp_seq_afinfo udp6_seq_afinfo = {
}, },
}; };
int udp6_proc_init(struct net *net) int __net_init udp6_proc_init(struct net *net)
{ {
return udp_proc_register(net, &udp6_seq_afinfo); return udp_proc_register(net, &udp6_seq_afinfo);
} }

View File

@ -104,12 +104,12 @@ static struct udp_seq_afinfo udplite6_seq_afinfo = {
}, },
}; };
static int udplite6_proc_init_net(struct net *net) static int __net_init udplite6_proc_init_net(struct net *net)
{ {
return udp_proc_register(net, &udplite6_seq_afinfo); return udp_proc_register(net, &udplite6_seq_afinfo);
} }
static void udplite6_proc_exit_net(struct net *net) static void __net_exit udplite6_proc_exit_net(struct net *net)
{ {
udp_proc_unregister(net, &udplite6_seq_afinfo); udp_proc_unregister(net, &udplite6_seq_afinfo);
} }

View File

@ -3738,17 +3738,17 @@ static int __net_init pfkey_init_proc(struct net *net)
return 0; return 0;
} }
static void pfkey_exit_proc(struct net *net) static void __net_exit pfkey_exit_proc(struct net *net)
{ {
proc_net_remove(net, "pfkey"); proc_net_remove(net, "pfkey");
} }
#else #else
static int __net_init pfkey_init_proc(struct net *net) static inline int pfkey_init_proc(struct net *net)
{ {
return 0; return 0;
} }
static void pfkey_exit_proc(struct net *net) static inline void pfkey_exit_proc(struct net *net)
{ {
} }
#endif #endif

View File

@ -2448,7 +2448,7 @@ static const struct file_operations packet_seq_fops = {
#endif #endif
static int packet_net_init(struct net *net) static int __net_init packet_net_init(struct net *net)
{ {
rwlock_init(&net->packet.sklist_lock); rwlock_init(&net->packet.sklist_lock);
INIT_HLIST_HEAD(&net->packet.sklist); INIT_HLIST_HEAD(&net->packet.sklist);
@ -2459,7 +2459,7 @@ static int packet_net_init(struct net *net)
return 0; return 0;
} }
static void packet_net_exit(struct net *net) static void __net_exit packet_net_exit(struct net *net)
{ {
proc_net_remove(net, "packet"); proc_net_remove(net, "packet");
} }

View File

@ -311,7 +311,7 @@ static struct notifier_block phonet_device_notifier = {
}; };
/* Per-namespace Phonet devices handling */ /* Per-namespace Phonet devices handling */
static int phonet_init_net(struct net *net) static int __net_init phonet_init_net(struct net *net)
{ {
struct phonet_net *pnn = net_generic(net, phonet_net_id); struct phonet_net *pnn = net_generic(net, phonet_net_id);
@ -324,7 +324,7 @@ static int phonet_init_net(struct net *net)
return 0; return 0;
} }
static void phonet_exit_net(struct net *net) static void __net_exit phonet_exit_net(struct net *net)
{ {
struct phonet_net *pnn = net_generic(net, phonet_net_id); struct phonet_net *pnn = net_generic(net, phonet_net_id);
struct net_device *dev; struct net_device *dev;

View File

@ -71,7 +71,7 @@ static struct ctl_table_root net_sysctl_ro_root = {
.permissions = net_ctl_ro_header_perms, .permissions = net_ctl_ro_header_perms,
}; };
static int sysctl_net_init(struct net *net) static int __net_init sysctl_net_init(struct net *net)
{ {
setup_sysctl_set(&net->sysctls, setup_sysctl_set(&net->sysctls,
&net_sysctl_ro_root.default_set, &net_sysctl_ro_root.default_set,
@ -79,7 +79,7 @@ static int sysctl_net_init(struct net *net)
return 0; return 0;
} }
static void sysctl_net_exit(struct net *net) static void __net_exit sysctl_net_exit(struct net *net)
{ {
WARN_ON(!list_empty(&net->sysctls.list)); WARN_ON(!list_empty(&net->sysctls.list));
return; return;

View File

@ -2224,7 +2224,7 @@ static const struct net_proto_family unix_family_ops = {
}; };
static int unix_net_init(struct net *net) static int __net_init unix_net_init(struct net *net)
{ {
int error = -ENOMEM; int error = -ENOMEM;
@ -2243,7 +2243,7 @@ out:
return error; return error;
} }
static void unix_net_exit(struct net *net) static void __net_exit unix_net_exit(struct net *net)
{ {
unix_sysctl_unregister(net); unix_sysctl_unregister(net);
proc_net_remove(net, "unix"); proc_net_remove(net, "unix");

View File

@ -31,7 +31,7 @@ static struct ctl_path unix_path[] = {
{ }, { },
}; };
int unix_sysctl_register(struct net *net) int __net_init unix_sysctl_register(struct net *net)
{ {
struct ctl_table *table; struct ctl_table *table;

View File

@ -140,7 +140,7 @@ static const struct file_operations wireless_seq_fops = {
.release = seq_release_net, .release = seq_release_net,
}; };
int wext_proc_init(struct net *net) int __net_init wext_proc_init(struct net *net)
{ {
/* Create /proc/net/wireless entry */ /* Create /proc/net/wireless entry */
if (!proc_net_fops_create(net, "wireless", S_IRUGO, &wireless_seq_fops)) if (!proc_net_fops_create(net, "wireless", S_IRUGO, &wireless_seq_fops))
@ -149,7 +149,7 @@ int wext_proc_init(struct net *net)
return 0; return 0;
} }
void wext_proc_exit(struct net *net) void __net_exit wext_proc_exit(struct net *net)
{ {
proc_net_remove(net, "wireless"); proc_net_remove(net, "wireless");
} }

View File

@ -2,7 +2,7 @@
#include <net/net_namespace.h> #include <net/net_namespace.h>
#include <net/xfrm.h> #include <net/xfrm.h>
static void __xfrm_sysctl_init(struct net *net) static void __net_init __xfrm_sysctl_init(struct net *net)
{ {
net->xfrm.sysctl_aevent_etime = XFRM_AE_ETIME; net->xfrm.sysctl_aevent_etime = XFRM_AE_ETIME;
net->xfrm.sysctl_aevent_rseqth = XFRM_AE_SEQT_SIZE; net->xfrm.sysctl_aevent_rseqth = XFRM_AE_SEQT_SIZE;
@ -64,7 +64,7 @@ out_kmemdup:
return -ENOMEM; return -ENOMEM;
} }
void xfrm_sysctl_fini(struct net *net) void __net_exit xfrm_sysctl_fini(struct net *net)
{ {
struct ctl_table *table; struct ctl_table *table;