lkml.org 
[lkml]   [2011]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 3/5 v3] net: restore net_create and make it globally visible
Date
This reverts commit 911cb193f3eb0370f20fbba712211e55ffede4de and
makes net_create() globally visible. net_create() will be needed
for fake_net in fs/proc/proc_net.c.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
---
include/net/net_namespace.h | 2 ++
net/core/net_namespace.c | 12 ++++++++----
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 2bf9ed9..5d5328c 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -116,6 +116,8 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
}
#endif /* CONFIG_NET */

+extern struct net *net_create(void);
+

extern struct list_head net_namespace_list;

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 6c6b86d..c90f0db 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -210,14 +210,11 @@ static void net_free(struct net *net)
kmem_cache_free(net_cachep, net);
}

-struct net *copy_net_ns(unsigned long flags, struct net *old_net)
+struct net *net_create(void)
{
struct net *net;
int rv;

- if (!(flags & CLONE_NEWNET))
- return get_net(old_net);
-
net = net_alloc();
if (!net)
return ERR_PTR(-ENOMEM);
@@ -236,6 +233,13 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net)
return net;
}

+struct net *copy_net_ns(unsigned long flags, struct net *old_net)
+{
+ if (!(flags & CLONE_NEWNET))
+ return get_net(old_net);
+ return net_create();
+}
+
static DEFINE_SPINLOCK(cleanup_list_lock);
static LIST_HEAD(cleanup_list); /* Must hold cleanup_list_lock to touch */

--
1.7.0.4


\
 
 \ /
  Last update: 2011-06-15 16:01    [W:0.019 / U:11.040 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site