From 388f9a8a022edab605a9d3b7009818cedc50d925 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 1 Nov 2007 00:43:49 -0700 Subject: [PATCH] --- yaml --- r: 72980 b: refs/heads/master c: d46557955f2a35e58772518775464cdf354b3245 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/net/net_namespace.h | 33 +++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 12c65e5536e4..91aae913b460 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1dba323b3f92cf4a475236763b0373cb7d49395d +refs/heads/master: d46557955f2a35e58772518775464cdf354b3245 diff --git a/trunk/include/net/net_namespace.h b/trunk/include/net/net_namespace.h index 5279466606d2..1fd449a6530b 100644 --- a/trunk/include/net/net_namespace.h +++ b/trunk/include/net/net_namespace.h @@ -51,13 +51,12 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) } #endif +#ifdef CONFIG_NET_NS 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; } @@ -75,26 +74,44 @@ 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 } +#else +static inline struct net *get_net(struct net *net) +{ + return net; +} + +static inline void put_net(struct net *net) +{ +} + +static inline struct net *hold_net(struct net *net) +{ + return net; +} + +static inline void release_net(struct net *net) +{ +} + +static inline struct net *maybe_get_net(struct net *net) +{ + return net; +} +#endif #define for_each_net(VAR) \ list_for_each_entry(VAR, &net_namespace_list, list)