diff options
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r-- | include/net/net_namespace.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index ac8f8304094e..3ea4194613ed 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -38,11 +38,23 @@ extern struct net init_net; | |||
38 | 38 | ||
39 | extern struct list_head net_namespace_list; | 39 | extern struct list_head net_namespace_list; |
40 | 40 | ||
41 | #ifdef CONFIG_NET | ||
42 | extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); | ||
43 | #else | ||
44 | static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) | ||
45 | { | ||
46 | /* There is nothing to copy so this is a noop */ | ||
47 | return net_ns; | ||
48 | } | ||
49 | #endif | ||
50 | |||
41 | extern void __put_net(struct net *net); | 51 | extern void __put_net(struct net *net); |
42 | 52 | ||
43 | static inline struct net *get_net(struct net *net) | 53 | static inline struct net *get_net(struct net *net) |
44 | { | 54 | { |
55 | #ifdef CONFIG_NET | ||
45 | atomic_inc(&net->count); | 56 | atomic_inc(&net->count); |
57 | #endif | ||
46 | return net; | 58 | return net; |
47 | } | 59 | } |
48 | 60 | ||
@@ -60,19 +72,25 @@ static inline struct net *maybe_get_net(struct net *net) | |||
60 | 72 | ||
61 | static inline void put_net(struct net *net) | 73 | static inline void put_net(struct net *net) |
62 | { | 74 | { |
75 | #ifdef CONFIG_NET | ||
63 | if (atomic_dec_and_test(&net->count)) | 76 | if (atomic_dec_and_test(&net->count)) |
64 | __put_net(net); | 77 | __put_net(net); |
78 | #endif | ||
65 | } | 79 | } |
66 | 80 | ||
67 | static inline struct net *hold_net(struct net *net) | 81 | static inline struct net *hold_net(struct net *net) |
68 | { | 82 | { |
83 | #ifdef CONFIG_NET | ||
69 | atomic_inc(&net->use_count); | 84 | atomic_inc(&net->use_count); |
85 | #endif | ||
70 | return net; | 86 | return net; |
71 | } | 87 | } |
72 | 88 | ||
73 | static inline void release_net(struct net *net) | 89 | static inline void release_net(struct net *net) |
74 | { | 90 | { |
91 | #ifdef CONFIG_NET | ||
75 | atomic_dec(&net->use_count); | 92 | atomic_dec(&net->use_count); |
93 | #endif | ||
76 | } | 94 | } |
77 | 95 | ||
78 | extern void net_lock(void); | 96 | extern void net_lock(void); |