When the CONFIG_NET_NS is n there's no need in refcounting
the initial net namespace. So relax this code by making a
stupid stubs for the "n" case.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
extern void __put_net(struct net *net);
static inline struct net *get_net(struct net *net)
{
extern void __put_net(struct net *net);
static inline struct net *get_net(struct net *net)
{
static inline void put_net(struct net *net)
{
static inline void put_net(struct net *net)
{
if (atomic_dec_and_test(&net->count))
__put_net(net);
if (atomic_dec_and_test(&net->count))
__put_net(net);
}
static inline struct net *hold_net(struct net *net)
{
}
static inline struct net *hold_net(struct net *net)
{
atomic_inc(&net->use_count);
atomic_inc(&net->use_count);
return net;
}
static inline void release_net(struct net *net)
{
return net;
}
static inline void release_net(struct net *net)
{
atomic_dec(&net->use_count);
atomic_dec(&net->use_count);
+#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)
#define for_each_net(VAR) \
list_for_each_entry(VAR, &net_namespace_list, list)