Skip to contentSkip to conversation

net: Fix build without CONFIG_NET_NS

PATCH In review Benjamin Herrenschmidt 2 participants 2 messages Feb 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Fix build without CONFIG_NET_NS

Commit 486a87f1e5624096bd1c09e9e716239597d48dca broke build without CONFIG_NET_NS due to calling net_alloc_generic() always while defining it inside an #ifdef CONFIG_NET_NS block. This moves the function definition out of that block.

---

 net/core/net_namespace.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
net/core/net_namespace.c +5 -5
@@ -63,10 +63,6 @@ out_undo:
 	goto out;
 }
 
-#ifdef CONFIG_NET_NS
-static struct kmem_cache *net_cachep;
-static struct workqueue_struct *netns_wq;
-
 static struct net_generic *net_alloc_generic(void)
 {
 	struct net_generic *ng;
@@ -80,6 +76,10 @@ static struct net_generic *net_alloc_gen
 	return ng;
 }
 
+#ifdef CONFIG_NET_NS
+static struct kmem_cache *net_cachep;
+static struct workqueue_struct *netns_wq;
+
 static struct net *net_alloc(void)
 {
 	struct net *net = NULL;
@@ -218,7 +218,7 @@ static int __init net_ns_init(void)
 	netns_wq = create_singlethread_workqueue("netns");
 	if (!netns_wq)
 		panic("Could not create netns workq");
-#endif
+#endif /* CONFIG_NET_NS */
 
 	ng = net_alloc_generic();
 	if (!ng)
maintainer
#1 lore raw

From: Benjamin Herrenschmidt <[email protected]>
Date: Tue, 24 Feb 2009 13:26:45 +1100

Quoted 6 lines

Commit 486a87f1e5624096bd1c09e9e716239597d48dca broke build without CONFIG_NET_NS due to calling net_alloc_generic() always while defining it inside an #ifdef CONFIG_NET_NS block. This moves the function definition out of that block.

Yep, sorry about that.

commit ebe47d47b7b7fed72dabcce4717da727b4e2367d

Author: Clemens Noss <[email protected]>
Date:   Mon Feb 23 15:37:35 2009 -0800

netns: build fix for net_alloc_generic

net_alloc_generic was defined in #ifdef CONFIG_NET_NS, but used unconditionally. Move net_alloc_generic out of #ifdef.

net/core/net_namespace.c +4 -4
index b0767ab..2adb1a7 100644
@@ -63,10 +63,6 @@ out_undo:
 	goto out;
 }
 
-#ifdef CONFIG_NET_NS
-static struct kmem_cache *net_cachep;
-static struct workqueue_struct *netns_wq;
-
 static struct net_generic *net_alloc_generic(void)
 {
 	struct net_generic *ng;
@@ -80,6 +76,10 @@ static struct net_generic *net_alloc_generic(void)
 	return ng;
 }
 
+#ifdef CONFIG_NET_NS
+static struct kmem_cache *net_cachep;
+static struct workqueue_struct *netns_wq;
+
 static struct net *net_alloc(void)
 {
 	struct net *net = NULL;