netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cleanup pernet operation without CONFIG_NET_NS
@ 2007-11-07 12:00 Denis V. Lunev
  2007-11-13 11:24 ` David Miller
  2007-11-15 14:13 ` Eric W. Biederman
  0 siblings, 2 replies; 3+ messages in thread
From: Denis V. Lunev @ 2007-11-07 12:00 UTC (permalink / raw)
  To: davem; +Cc: devel, containers, netdev, clg, benjamin.thery

If CONFIG_NET_NS is not set, the only namespace is possible.

This patch removes list of pernet_operations and cleanups code a bit.
This list is not needed if there are no namespaces. We should just call
->init method.

Additionally, the ->exit will be called on module unloading only. This
case is safe - the code is not discarded. For the in/kernel code, ->exit
should never be called.

Signed-off-by: Denis V. Lunev <den@openvz.org>

--- ./net/core/net_namespace.c.netinitdata	2007-10-15 13:55:25.000000000 +0400
+++ ./net/core/net_namespace.c	2007-11-06 14:33:14.000000000 +0300
@@ -179,6 +180,7 @@ static int __init net_ns_init(void)
 
 pure_initcall(net_ns_init);
 
+#ifdef CONFIG_NET_NS
 static int register_pernet_operations(struct list_head *list,
 				      struct pernet_operations *ops)
 {
@@ -220,6 +222,23 @@ static void unregister_pernet_operations
 			ops->exit(net);
 }
 
+#else
+
+static int register_pernet_operations(struct list_head *list,
+				      struct pernet_operations *ops)
+{
+	if (ops->init == NULL)
+		return 0;
+	return ops->init(&init_net);
+}
+
+static void unregister_pernet_operations(struct pernet_operations *ops)
+{
+	if (ops->exit)
+		ops->exit(&init_net);
+}
+#endif
+
 /**
  *      register_pernet_subsys - register a network namespace subsystem
  *	@ops:  pernet operations structure for the subsystem

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] cleanup pernet operation without CONFIG_NET_NS
  2007-11-07 12:00 [PATCH 1/2] cleanup pernet operation without CONFIG_NET_NS Denis V. Lunev
@ 2007-11-13 11:24 ` David Miller
  2007-11-15 14:13 ` Eric W. Biederman
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2007-11-13 11:24 UTC (permalink / raw)
  To: den; +Cc: devel, containers, netdev, clg, benjamin.thery

From: "Denis V. Lunev" <den@openvz.org>
Date: Wed, 7 Nov 2007 15:00:07 +0300

> If CONFIG_NET_NS is not set, the only namespace is possible.
> 
> This patch removes list of pernet_operations and cleanups code a bit.
> This list is not needed if there are no namespaces. We should just call
> ->init method.
> 
> Additionally, the ->exit will be called on module unloading only. This
> case is safe - the code is not discarded. For the in/kernel code, ->exit
> should never be called.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] cleanup pernet operation without CONFIG_NET_NS
  2007-11-07 12:00 [PATCH 1/2] cleanup pernet operation without CONFIG_NET_NS Denis V. Lunev
  2007-11-13 11:24 ` David Miller
@ 2007-11-15 14:13 ` Eric W. Biederman
  1 sibling, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2007-11-15 14:13 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: davem, containers, netdev, clg, benjamin.thery

"Denis V. Lunev" <den@openvz.org> writes:

> If CONFIG_NET_NS is not set, the only namespace is possible.
>
> This patch removes list of pernet_operations and cleanups code a bit.
> This list is not needed if there are no namespaces. We should just call
> ->init method.
>
> Additionally, the ->exit will be called on module unloading only. This
> case is safe - the code is not discarded. For the in/kernel code, ->exit
> should never be called.

This patch looks sane, and reasonable in the !CONFIG_NET_NS case.

Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-15 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07 12:00 [PATCH 1/2] cleanup pernet operation without CONFIG_NET_NS Denis V. Lunev
2007-11-13 11:24 ` David Miller
2007-11-15 14:13 ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).