|
@@ -95,6 +95,11 @@ extern struct list_head net_namespace_list;
|
|
#ifdef CONFIG_NET_NS
|
|
#ifdef CONFIG_NET_NS
|
|
extern void __put_net(struct net *net);
|
|
extern void __put_net(struct net *net);
|
|
|
|
|
|
|
|
+static inline int net_alive(struct net *net)
|
|
|
|
+{
|
|
|
|
+ return net && atomic_read(&net->count);
|
|
|
|
+}
|
|
|
|
+
|
|
static inline struct net *get_net(struct net *net)
|
|
static inline struct net *get_net(struct net *net)
|
|
{
|
|
{
|
|
atomic_inc(&net->count);
|
|
atomic_inc(&net->count);
|
|
@@ -125,6 +130,12 @@ int net_eq(const struct net *net1, const struct net *net2)
|
|
return net1 == net2;
|
|
return net1 == net2;
|
|
}
|
|
}
|
|
#else
|
|
#else
|
|
|
|
+
|
|
|
|
+static inline int net_alive(struct net *net)
|
|
|
|
+{
|
|
|
|
+ return 1;
|
|
|
|
+}
|
|
|
|
+
|
|
static inline struct net *get_net(struct net *net)
|
|
static inline struct net *get_net(struct net *net)
|
|
{
|
|
{
|
|
return net;
|
|
return net;
|