Commit 15449745 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

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: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e008b5fc
...@@ -5103,42 +5103,28 @@ int bond_create(struct net *net, const char *name) ...@@ -5103,42 +5103,28 @@ int bond_create(struct net *net, const char *name)
static int bond_net_init(struct net *net) static int bond_net_init(struct net *net)
{ {
struct bond_net *bn; struct bond_net *bn = net_generic(net, bond_net_id);
int err;
err = -ENOMEM;
bn = kzalloc(sizeof(struct bond_net), GFP_KERNEL);
if (bn == NULL)
goto out;
bn->net = net; bn->net = net;
INIT_LIST_HEAD(&bn->dev_list); INIT_LIST_HEAD(&bn->dev_list);
err = net_assign_generic(net, bond_net_id, bn);
if (err)
goto out_free;
bond_create_proc_dir(bn); bond_create_proc_dir(bn);
out:
return err; return 0;
out_free:
kfree(bn);
goto out;
} }
static void bond_net_exit(struct net *net) static void bond_net_exit(struct net *net)
{ {
struct bond_net *bn; struct bond_net *bn = net_generic(net, bond_net_id);
bn = net_generic(net, bond_net_id);
bond_destroy_proc_dir(bn); bond_destroy_proc_dir(bn);
kfree(bn);
} }
static struct pernet_operations bond_net_ops = { static struct pernet_operations bond_net_ops = {
.init = bond_net_init, .init = bond_net_init,
.exit = bond_net_exit, .exit = bond_net_exit,
.id = &bond_net_id,
.size = sizeof(struct bond_net),
}; };
static int __init bonding_init(void) static int __init bonding_init(void)
...@@ -5152,7 +5138,7 @@ static int __init bonding_init(void) ...@@ -5152,7 +5138,7 @@ static int __init bonding_init(void)
if (res) if (res)
goto out; goto out;
res = register_pernet_gen_subsys(&bond_net_id, &bond_net_ops); res = register_pernet_subsys(&bond_net_ops);
if (res) if (res)
goto out; goto out;
...@@ -5178,7 +5164,7 @@ static int __init bonding_init(void) ...@@ -5178,7 +5164,7 @@ static int __init bonding_init(void)
err: err:
rtnl_link_unregister(&bond_link_ops); rtnl_link_unregister(&bond_link_ops);
err_link: err_link:
unregister_pernet_gen_subsys(bond_net_id, &bond_net_ops); unregister_pernet_subsys(&bond_net_ops);
goto out; goto out;
} }
...@@ -5192,7 +5178,7 @@ static void __exit bonding_exit(void) ...@@ -5192,7 +5178,7 @@ static void __exit bonding_exit(void)
bond_destroy_sysfs(); bond_destroy_sysfs();
rtnl_link_unregister(&bond_link_ops); rtnl_link_unregister(&bond_link_ops);
unregister_pernet_gen_subsys(bond_net_id, &bond_net_ops); unregister_pernet_subsys(&bond_net_ops);
} }
module_init(bonding_init); module_init(bonding_init);
......
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