]> err.no Git - linux-2.6/commitdiff
[NET]: Hide the net_ns kmem cache
authorPavel Emelyanov <xemul@openvz.org>
Thu, 1 Nov 2007 07:46:50 +0000 (00:46 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Nov 2007 07:46:50 +0000 (00:46 -0700)
This cache is only required to create new namespaces,
but we won't have them in CONFIG_NET_NS=n case.

Hide it under the appropriate ifdef.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/net_namespace.c

index a044e2d9a8f0ef7e988d394066f7aea1574d58cc..e9f0964ce70bf89eef873b23c2ad9c2f80a4cf57 100644 (file)
@@ -17,8 +17,6 @@ static DEFINE_MUTEX(net_mutex);
 
 LIST_HEAD(net_namespace_list);
 
-static struct kmem_cache *net_cachep;
-
 struct net init_net;
 EXPORT_SYMBOL_GPL(init_net);
 
@@ -59,6 +57,8 @@ out_undo:
 }
 
 #ifdef CONFIG_NET_NS
+static struct kmem_cache *net_cachep;
+
 static struct net *net_alloc(void)
 {
        return kmem_cache_zalloc(net_cachep, GFP_KERNEL);
@@ -167,9 +167,11 @@ static int __init net_ns_init(void)
        int err;
 
        printk(KERN_INFO "net_namespace: %zd bytes\n", sizeof(struct net));
+#ifdef CONFIG_NET_NS
        net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
                                        SMP_CACHE_BYTES,
                                        SLAB_PANIC, NULL);
+#endif
        mutex_lock(&net_mutex);
        err = setup_net(&init_net);