Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172045
b: refs/heads/master
c: c879a6f
h: refs/heads/master
i:
  172043: 94e2c39
v: v3
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Dec 2, 2009
1 parent fa1f5a3 commit a9e51a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 741a6fa210c5c8828af3819134f644842e0e9c09
refs/heads/master: c879a6fcd6382415015e246b443dc2a1eab604dc
38 changes: 8 additions & 30 deletions trunk/drivers/net/pppoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,59 +1139,37 @@ static struct pppox_proto pppoe_proto = {

static __net_init int pppoe_init_net(struct net *net)
{
struct pppoe_net *pn;
struct pppoe_net *pn = pppoe_pernet(net);
struct proc_dir_entry *pde;
int err;

pn = kzalloc(sizeof(*pn), GFP_KERNEL);
if (!pn)
return -ENOMEM;

rwlock_init(&pn->hash_lock);

err = net_assign_generic(net, pppoe_net_id, pn);
if (err)
goto out;

pde = proc_net_fops_create(net, "pppoe", S_IRUGO, &pppoe_seq_fops);
#ifdef CONFIG_PROC_FS
if (!pde) {
err = -ENOMEM;
goto out;
}
if (!pde)
return -ENOMEM;
#endif

return 0;

out:
kfree(pn);
return err;
}

static __net_exit void pppoe_exit_net(struct net *net)
{
struct pppoe_net *pn;

proc_net_remove(net, "pppoe");
pn = net_generic(net, pppoe_net_id);
/*
* if someone has cached our net then
* further net_generic call will return NULL
*/
net_assign_generic(net, pppoe_net_id, NULL);
kfree(pn);
}

static struct pernet_operations pppoe_net_ops = {
.init = pppoe_init_net,
.exit = pppoe_exit_net,
.id = &pppoe_net_id,
.size = sizeof(struct pppoe_net),
};

static int __init pppoe_init(void)
{
int err;

err = register_pernet_gen_device(&pppoe_net_id, &pppoe_net_ops);
err = register_pernet_device(&pppoe_net_ops);
if (err)
goto out;

Expand All @@ -1212,7 +1190,7 @@ static int __init pppoe_init(void)
out_unregister_pppoe_proto:
proto_unregister(&pppoe_sk_proto);
out_unregister_net_ops:
unregister_pernet_gen_device(pppoe_net_id, &pppoe_net_ops);
unregister_pernet_device(&pppoe_net_ops);
out:
return err;
}
Expand All @@ -1224,7 +1202,7 @@ static void __exit pppoe_exit(void)
dev_remove_pack(&pppoes_ptype);
unregister_pppox_proto(PX_PROTO_OE);
proto_unregister(&pppoe_sk_proto);
unregister_pernet_gen_device(pppoe_net_id, &pppoe_net_ops);
unregister_pernet_device(&pppoe_net_ops);
}

module_init(pppoe_init);
Expand Down

0 comments on commit a9e51a9

Please sign in to comment.