dect
/
linux-2.6
Archived
13
0
Fork 0

net: Cleanup of neighbour code

Using read_pnet() and write_pnet() in neighbour code ease the reading
of code.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2008-11-12 00:54:54 -08:00 committed by David S. Miller
parent 7a9546ee35
commit e42ea986e4
2 changed files with 5 additions and 19 deletions

View File

@ -220,11 +220,7 @@ extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *p
static inline static inline
struct net *neigh_parms_net(const struct neigh_parms *parms) struct net *neigh_parms_net(const struct neigh_parms *parms)
{ {
#ifdef CONFIG_NET_NS return read_pnet(&parms->net);
return parms->net;
#else
return &init_net;
#endif
} }
extern unsigned long neigh_rand_reach_time(unsigned long base); extern unsigned long neigh_rand_reach_time(unsigned long base);
@ -241,11 +237,7 @@ extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void
static inline static inline
struct net *pneigh_net(const struct pneigh_entry *pneigh) struct net *pneigh_net(const struct pneigh_entry *pneigh)
{ {
#ifdef CONFIG_NET_NS return read_pnet(&pneigh->net);
return pneigh->net;
#else
return &init_net;
#endif
} }
extern void neigh_app_ns(struct neighbour *n); extern void neigh_app_ns(struct neighbour *n);

View File

@ -531,9 +531,7 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl,
if (!n) if (!n)
goto out; goto out;
#ifdef CONFIG_NET_NS write_pnet(&n->net, hold_net(net));
n->net = hold_net(net);
#endif
memcpy(n->key, pkey, key_len); memcpy(n->key, pkey, key_len);
n->dev = dev; n->dev = dev;
if (dev) if (dev)
@ -1350,9 +1348,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
dev_hold(dev); dev_hold(dev);
p->dev = dev; p->dev = dev;
#ifdef CONFIG_NET_NS write_pnet(&p->net, hold_net(net));
p->net = hold_net(net);
#endif
p->sysctl_table = NULL; p->sysctl_table = NULL;
write_lock_bh(&tbl->lock); write_lock_bh(&tbl->lock);
p->next = tbl->parms.next; p->next = tbl->parms.next;
@ -1407,9 +1403,7 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
unsigned long now = jiffies; unsigned long now = jiffies;
unsigned long phsize; unsigned long phsize;
#ifdef CONFIG_NET_NS write_pnet(&tbl->parms.net, &init_net);
tbl->parms.net = &init_net;
#endif
atomic_set(&tbl->parms.refcnt, 1); atomic_set(&tbl->parms.refcnt, 1);
tbl->parms.reachable_time = tbl->parms.reachable_time =
neigh_rand_reach_time(tbl->parms.base_reachable_time); neigh_rand_reach_time(tbl->parms.base_reachable_time);