aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2009-11-29 10:46:04 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-01 19:15:53 -0500
commit15449745e5d181ae214ceaf0880350bb4e63512a (patch)
treeba5c67dda7bd17b91e7cef5d8905cf9eb793c6f4 /drivers/net/bonding
parente008b5fc8dc7f46d9904001c7a2155eb1e7d35ab (diff)
net: Simplify the bond drivers pernet operations.
Take advantage of the new pernet automatic storage management, and stop using compatibility network namespace functions. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 726bd755338f..ac3fe20abf8f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5103,42 +5103,28 @@ out_netdev:
5103 5103
5104static int bond_net_init(struct net *net) 5104static int bond_net_init(struct net *net)
5105{ 5105{
5106 struct bond_net *bn; 5106 struct bond_net *bn = net_generic(net, bond_net_id);
5107 int err;
5108
5109 err = -ENOMEM;
5110 bn = kzalloc(sizeof(struct bond_net), GFP_KERNEL);
5111 if (bn == NULL)
5112 goto out;
5113 5107
5114 bn->net = net; 5108 bn->net = net;
5115 INIT_LIST_HEAD(&bn->dev_list); 5109 INIT_LIST_HEAD(&bn->dev_list);
5116 5110
5117 err = net_assign_generic(net, bond_net_id, bn);
5118 if (err)
5119 goto out_free;
5120
5121 bond_create_proc_dir(bn); 5111 bond_create_proc_dir(bn);
5122out: 5112
5123 return err; 5113 return 0;
5124out_free:
5125 kfree(bn);
5126 goto out;
5127} 5114}
5128 5115
5129static void bond_net_exit(struct net *net) 5116static void bond_net_exit(struct net *net)
5130{ 5117{
5131 struct bond_net *bn; 5118 struct bond_net *bn = net_generic(net, bond_net_id);
5132
5133 bn = net_generic(net, bond_net_id);
5134 5119
5135 bond_destroy_proc_dir(bn); 5120 bond_destroy_proc_dir(bn);
5136 kfree(bn);
5137} 5121}
5138 5122
5139static struct pernet_operations bond_net_ops = { 5123static struct pernet_operations bond_net_ops = {
5140 .init = bond_net_init, 5124 .init = bond_net_init,
5141 .exit = bond_net_exit, 5125 .exit = bond_net_exit,
5126 .id = &bond_net_id,
5127 .size = sizeof(struct bond_net),
5142}; 5128};
5143 5129
5144static int __init bonding_init(void) 5130static int __init bonding_init(void)
@@ -5152,7 +5138,7 @@ static int __init bonding_init(void)
5152 if (res) 5138 if (res)
5153 goto out; 5139 goto out;
5154 5140
5155 res = register_pernet_gen_subsys(&bond_net_id, &bond_net_ops); 5141 res = register_pernet_subsys(&bond_net_ops);
5156 if (res) 5142 if (res)
5157 goto out; 5143 goto out;
5158 5144
@@ -5178,7 +5164,7 @@ out:
5178err: 5164err:
5179 rtnl_link_unregister(&bond_link_ops); 5165 rtnl_link_unregister(&bond_link_ops);
5180err_link: 5166err_link:
5181 unregister_pernet_gen_subsys(bond_net_id, &bond_net_ops); 5167 unregister_pernet_subsys(&bond_net_ops);
5182 goto out; 5168 goto out;
5183 5169
5184} 5170}
@@ -5192,7 +5178,7 @@ static void __exit bonding_exit(void)
5192 bond_destroy_sysfs(); 5178 bond_destroy_sysfs();
5193 5179
5194 rtnl_link_unregister(&bond_link_ops); 5180 rtnl_link_unregister(&bond_link_ops);
5195 unregister_pernet_gen_subsys(bond_net_id, &bond_net_ops); 5181 unregister_pernet_subsys(&bond_net_ops);
5196} 5182}
5197 5183
5198module_init(bonding_init); 5184module_init(bonding_init);