Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90749
b: refs/heads/master
c: cd1c701
h: refs/heads/master
i:
  90747: 5816ae3
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Apr 16, 2008
1 parent a5d3e55 commit 7c08896
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 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: d9ed0f0e2dba45eec79ffbdd841757f87712349b
refs/heads/master: cd1c701432fbf84ad5ea1d8012ddd398a560bccc
15 changes: 7 additions & 8 deletions trunk/net/8021q/vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,14 @@ static int vlan_init_net(struct net *net)
if (err < 0)
goto err_assign;

err = vlan_proc_init(net);
if (err < 0)
goto err_proc;

return 0;

err_proc:
/* nothing */
err_assign:
kfree(vn);
err_alloc:
Expand All @@ -655,6 +661,7 @@ static void vlan_exit_net(struct net *net)
struct vlan_net *vn;

vn = net_generic(net, vlan_net_id);
vlan_proc_cleanup(net);
kfree(vn);
}

Expand All @@ -674,10 +681,6 @@ static int __init vlan_proto_init(void)
if (err < 0)
goto err0;

err = vlan_proc_init();
if (err < 0)
goto err1;

err = register_netdevice_notifier(&vlan_notifier_block);
if (err < 0)
goto err2;
Expand All @@ -693,8 +696,6 @@ static int __init vlan_proto_init(void)
err3:
unregister_netdevice_notifier(&vlan_notifier_block);
err2:
vlan_proc_cleanup();
err1:
unregister_pernet_gen_device(vlan_net_id, &vlan_net_ops);
err0:
return err;
Expand All @@ -715,8 +716,6 @@ static void __exit vlan_cleanup_module(void)
for (i = 0; i < VLAN_GRP_HASH_SIZE; i++)
BUG_ON(!hlist_empty(&vlan_group_hash[i]));

vlan_proc_cleanup();

unregister_pernet_gen_device(vlan_net_id, &vlan_net_ops);

synchronize_net();
Expand Down
12 changes: 9 additions & 3 deletions trunk/net/8021q/vlanproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ static const char *vlan_name_type_str[VLAN_NAME_TYPE_HIGHEST] = {
* Clean up /proc/net/vlan entries
*/

void vlan_proc_cleanup(void)
void vlan_proc_cleanup(struct net *net)
{
if (net != &init_net)
return;

if (proc_vlan_conf)
remove_proc_entry(name_conf, proc_vlan_dir);

Expand All @@ -155,8 +158,11 @@ void vlan_proc_cleanup(void)
* Create /proc/net/vlan entries
*/

int __init vlan_proc_init(void)
int vlan_proc_init(struct net *net)
{
if (net != &init_net)
return 0;

proc_vlan_dir = proc_mkdir(name_root, init_net.proc_net);
if (!proc_vlan_dir)
goto err;
Expand All @@ -169,7 +175,7 @@ int __init vlan_proc_init(void)

err:
pr_err("%s: can't create entry in proc filesystem!\n", __func__);
vlan_proc_cleanup();
vlan_proc_cleanup(net);
return -ENOBUFS;
}

Expand Down
10 changes: 6 additions & 4 deletions trunk/net/8021q/vlanproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
#define __BEN_VLAN_PROC_INC__

#ifdef CONFIG_PROC_FS
int vlan_proc_init(void);
struct net;

int vlan_proc_init(struct net *net);
int vlan_proc_rem_dev(struct net_device *vlandev);
int vlan_proc_add_dev(struct net_device *vlandev);
void vlan_proc_cleanup(void);
void vlan_proc_cleanup(struct net *net);

#else /* No CONFIG_PROC_FS */

#define vlan_proc_init() (0)
#define vlan_proc_cleanup() do {} while (0)
#define vlan_proc_init(net) (0)
#define vlan_proc_cleanup(net) do {} while (0)
#define vlan_proc_add_dev(dev) ({(void)(dev), 0; })
#define vlan_proc_rem_dev(dev) ({(void)(dev), 0; })
#endif
Expand Down

0 comments on commit 7c08896

Please sign in to comment.