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/core/rtnetlink.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/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index cec111109155..8c971a2efe2a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -539,13 +539,16 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
539 | int s_idx = cb->args[0]; | 539 | int s_idx = cb->args[0]; |
540 | struct net_device *dev; | 540 | struct net_device *dev; |
541 | 541 | ||
542 | for (dev=dev_base, idx=0; dev; dev = dev->next, idx++) { | 542 | idx = 0; |
543 | for_each_netdev(dev) { | ||
543 | if (idx < s_idx) | 544 | if (idx < s_idx) |
544 | continue; | 545 | goto cont; |
545 | if (rtnl_fill_ifinfo(skb, dev, NULL, 0, RTM_NEWLINK, | 546 | if (rtnl_fill_ifinfo(skb, dev, NULL, 0, RTM_NEWLINK, |
546 | NETLINK_CB(cb->skb).pid, | 547 | NETLINK_CB(cb->skb).pid, |
547 | cb->nlh->nlmsg_seq, 0, NLM_F_MULTI) <= 0) | 548 | cb->nlh->nlmsg_seq, 0, NLM_F_MULTI) <= 0) |
548 | break; | 549 | break; |
550 | cont: | ||
551 | idx++; | ||
549 | } | 552 | } |
550 | cb->args[0] = idx; | 553 | cb->args[0] = idx; |
551 | 554 | ||