Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 72980
b: refs/heads/master
c: d465579
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Nov 1, 2007
1 parent 1e38f55 commit 388f9a8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1dba323b3f92cf4a475236763b0373cb7d49395d
refs/heads/master: d46557955f2a35e58772518775464cdf354b3245
33 changes: 25 additions & 8 deletions trunk/include/net/net_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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)
Expand Down

0 comments on commit 388f9a8

Please sign in to comment.