Skip to content

Commit

Permalink
net: spread __net_init, __net_exit
Browse files Browse the repository at this point in the history
__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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and davem330 committed Jan 18, 2010
1 parent 72659ec commit 2c8c1e7
Show file tree
Hide file tree
Showing 44 changed files with 107 additions and 112 deletions.
12 changes: 6 additions & 6 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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)
{
}

Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions net/8021q/vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion net/8021q/vlanproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion net/core/fib_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions net/dccp/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions net/dccp/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/fib_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/igmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions net/ipv4/ip_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions net/ipv4/ipip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/udplite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/af_inet6.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/anycast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 2c8c1e7

Please sign in to comment.