[openib-general] [PATCH RFC 6/31] net: Add a helper to get a reference to the initial network namespace.
Eric W. Biederman
ebiederm at xmission.com
Thu Jan 25 11:00:08 PST 2007
From: Eric W. Biederman <ebiederm at xmission.com> - unquoted
The initial network namespace is special and we need to use it for various
things. Probably the biggest initial use will be to ensure code that
can't cope with multiple namespaces only sees the initial network namespace.
For that reason and because getting at the initial network namespace is just
a little clumsy add a helper function.
Signed-off-by: Eric W. Biederman <ebiederm at xmission.com>
---
include/net/net_namespace.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 06a9ba1..9208e2e 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -27,6 +27,12 @@ struct net_namespace_head {
struct work_struct work;
};
+/* Get the initial network namespace */
+static inline net_t init_net(void)
+{
+ return init_nsproxy.net_ns;
+}
+
static inline net_t get_net(net_t net) { return net; }
static inline void put_net(net_t net) {}
static inline net_t hold_net(net_t net) { return net; }
--
1.4.4.1.g278f
More information about the general
mailing list