diff options
author | Pavel Emelianov <xemul@openvz.org> | 2007-05-03 18:13:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-05-03 18:13:45 -0400 |
commit | 7562f876cd93800f2f8c89445f2a563590b24e09 (patch) | |
tree | 78a34c011af275efa0d55ba59c3bd49b771dd533 /net/ipv4/igmp.c | |
parent | 03fba0479600114f32d29eee74ca3eaa364606bf (diff) |
[NET]: Rework dev_base via list_head (v3)
Cleanup of dev_base list use, with the aim to simplify making device
list per-namespace. In almost every occasion, use of dev_base variable
and dev->next pointer could be easily replaced by for_each_netdev
loop. A few most complicated places were converted to using
first_netdev()/next_netdev().
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Acked-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/igmp.c')
-rw-r--r-- | net/ipv4/igmp.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 2506021c2935..f4dd47453108 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -2288,9 +2288,8 @@ static inline struct ip_mc_list *igmp_mc_get_first(struct seq_file *seq) | |||
2288 | struct ip_mc_list *im = NULL; | 2288 | struct ip_mc_list *im = NULL; |
2289 | struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq); | 2289 | struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq); |
2290 | 2290 | ||
2291 | for (state->dev = dev_base, state->in_dev = NULL; | 2291 | state->in_dev = NULL; |
2292 | state->dev; | 2292 | for_each_netdev(state->dev) { |
2293 | state->dev = state->dev->next) { | ||
2294 | struct in_device *in_dev; | 2293 | struct in_device *in_dev; |
2295 | in_dev = in_dev_get(state->dev); | 2294 | in_dev = in_dev_get(state->dev); |
2296 | if (!in_dev) | 2295 | if (!in_dev) |
@@ -2316,7 +2315,7 @@ static struct ip_mc_list *igmp_mc_get_next(struct seq_file *seq, struct ip_mc_li | |||
2316 | read_unlock(&state->in_dev->mc_list_lock); | 2315 | read_unlock(&state->in_dev->mc_list_lock); |
2317 | in_dev_put(state->in_dev); | 2316 | in_dev_put(state->in_dev); |
2318 | } | 2317 | } |
2319 | state->dev = state->dev->next; | 2318 | state->dev = next_net_device(state->dev); |
2320 | if (!state->dev) { | 2319 | if (!state->dev) { |
2321 | state->in_dev = NULL; | 2320 | state->in_dev = NULL; |
2322 | break; | 2321 | break; |
@@ -2450,9 +2449,9 @@ static inline struct ip_sf_list *igmp_mcf_get_first(struct seq_file *seq) | |||
2450 | struct ip_mc_list *im = NULL; | 2449 | struct ip_mc_list *im = NULL; |
2451 | struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq); | 2450 | struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq); |
2452 | 2451 | ||
2453 | for (state->dev = dev_base, state->idev = NULL, state->im = NULL; | 2452 | state->idev = NULL; |
2454 | state->dev; | 2453 | state->im = NULL; |
2455 | state->dev = state->dev->next) { | 2454 | for_each_netdev(state->dev) { |
2456 | struct in_device *idev; | 2455 | struct in_device *idev; |
2457 | idev = in_dev_get(state->dev); | 2456 | idev = in_dev_get(state->dev); |
2458 | if (unlikely(idev == NULL)) | 2457 | if (unlikely(idev == NULL)) |
@@ -2488,7 +2487,7 @@ static struct ip_sf_list *igmp_mcf_get_next(struct seq_file *seq, struct ip_sf_l | |||
2488 | read_unlock(&state->idev->mc_list_lock); | 2487 | read_unlock(&state->idev->mc_list_lock); |
2489 | in_dev_put(state->idev); | 2488 | in_dev_put(state->idev); |
2490 | } | 2489 | } |
2491 | state->dev = state->dev->next; | 2490 | state->dev = next_net_device(state->dev); |
2492 | if (!state->dev) { | 2491 | if (!state->dev) { |
2493 | state->idev = NULL; | 2492 | state->idev = NULL; |
2494 | goto out; | 2493 | goto out; |