aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/net/net_namespace.h18
2 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 313c6b6e774..a4a141055c4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -27,6 +27,7 @@
#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
#define CLONE_NEWIPC 0x08000000 /* New ipcs */
#define CLONE_NEWUSER 0x10000000 /* New user namespace */
+#define CLONE_NEWNET 0x20000000 /* New network namespace */
/*
* Scheduling policies
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ac8f8304094..3ea4194613e 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -38,11 +38,23 @@ extern struct net init_net;
extern struct list_head net_namespace_list;
+#ifdef CONFIG_NET
+extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns);
+#else
+static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
+{
+ /* There is nothing to copy so this is a noop */
+ return net_ns;
+}
+#endif
+
extern void __put_net(struct net *net);
static inline struct net *get_net(struct net *net)
{
+#ifdef CONFIG_NET
atomic_inc(&net->count);
+#endif
return net;
}
@@ -60,19 +72,25 @@ static inline struct net *maybe_get_net(struct net *net)
static inline void put_net(struct net *net)
{
+#ifdef CONFIG_NET
if (atomic_dec_and_test(&net->count))
__put_net(net);
+#endif
}
static inline struct net *hold_net(struct net *net)
{
+#ifdef CONFIG_NET
atomic_inc(&net->use_count);
+#endif
return net;
}
static inline void release_net(struct net *net)
{
+#ifdef CONFIG_NET
atomic_dec(&net->use_count);
+#endif
}
extern void net_lock(void);