From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH net-2.6.26 5/10][VLAN]: Add a net argument to proc init and cleanup calls.
Date: Tue, 15 Apr 2008 16:09:37 +0400 [thread overview]
Message-ID: <48049B01.80403@openvz.org> (raw)
In-Reply-To: <4804989F.1060503@openvz.org>
All proc files will be created in each net, so prepare them for
this change now, not to mess it with real creation patch.
The net != &init_net checks in them are for git-bisect sanity,
but I will drop them soon.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
net/8021q/vlan.c | 15 +++++++--------
net/8021q/vlanproc.c | 12 +++++++++---
net/8021q/vlanproc.h | 10 ++++++----
3 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 9296601..541542e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -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:
@@ -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);
}
@@ -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;
@@ -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;
@@ -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();
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index 24cd96e..4d13aeb 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -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);
@@ -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;
@@ -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;
}
diff --git a/net/8021q/vlanproc.h b/net/8021q/vlanproc.h
index da542ca..063f60a 100644
--- a/net/8021q/vlanproc.h
+++ b/net/8021q/vlanproc.h
@@ -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
--
1.5.3.4
next prev parent reply other threads:[~2008-04-15 11:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-15 11:59 [PATCH net-2.6.26 0/10][VLAN]: Make VLAN devices work in net namespaces Pavel Emelyanov
2008-04-15 12:01 ` [PATCH net-2.6.26 1/10][RTNL]: Relax for_each_netdev_safe in __rtnl_link_unregister Pavel Emelyanov
2008-04-15 12:00 ` Patrick McHardy
2008-04-15 12:03 ` [PATCH net-2.6.26 2/10][RTNL]: Introduce the rtnl_kill_links helper Pavel Emelyanov
2008-04-15 12:01 ` Patrick McHardy
2008-04-15 12:05 ` [PATCH net-2.6.26 3/10][VLAN]: Tag vlan_group_device with net device, not ifindex Pavel Emelyanov
2008-04-15 12:03 ` Patrick McHardy
2008-04-15 12:07 ` [PATCH net-2.6.26 4/10][VLAN]: Introduce the vlan_net structure and init/exit net ops Pavel Emelyanov
2008-04-15 12:09 ` Patrick McHardy
2008-04-15 12:50 ` Pavel Emelyanov
2008-04-15 12:24 ` Patrick McHardy
2008-04-15 12:09 ` Pavel Emelyanov [this message]
2008-04-15 12:26 ` [PATCH net-2.6.26 5/10][VLAN]: Add a net argument to proc init and cleanup calls Patrick McHardy
2008-04-15 13:05 ` Pavel Emelyanov
2008-04-15 12:31 ` Patrick McHardy
2008-04-15 12:12 ` [PATCH net-2.6.26 6/10][VLAN]: Create proc entries in the proper net Pavel Emelyanov
2008-04-15 12:28 ` Patrick McHardy
2008-04-15 12:13 ` [PATCH net-2.6.26 7/10][VLAN]: Make the /proc/net/vlan/conf file show per-net info Pavel Emelyanov
2008-04-15 12:28 ` Patrick McHardy
2008-04-15 12:15 ` [PATCH net-2.6.26 8/10][VLAN]: Make the vlan_name_type per-net Pavel Emelyanov
2008-04-15 12:17 ` [PATCH net-2.6.26 9/10][VLAN]: Allow vlan devices registration in net namespaces Pavel Emelyanov
2008-04-15 12:19 ` [PATCH net-2.6.26 10/10][VLAN]: Handle vlan devices net namespace changing Pavel Emelyanov
2008-04-15 12:30 ` Patrick McHardy
2008-04-16 8:02 ` [PATCH net-2.6.26 0/10][VLAN]: Make VLAN devices work in net namespaces David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48049B01.80403@openvz.org \
--to=xemul@openvz.org \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.