[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070503.032540.101470158.davem@davemloft.net>
Date: Thu, 03 May 2007 03:25:40 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: xemul@...ru
Cc: netdev@...r.kernel.org, dev@...ru
Subject: Re: [PATCH] Rework dev_base via list_head
From: Pavel Emelianov <xemul@...ru>
Date: Wed, 02 May 2007 17:40:56 +0400
> 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().
>
> Fits 2.6.21-rc7 tree.
>
> Signed-off-by: Pavel Emelianov <xemul@...nvz.org>
> Acked-by: Kirill Korotaev <dev@...nvz.org>
Overall this looks mostly good.
One thing I want to audit before applying this is
loop termination conditions.
With the old loop, if you do something like this:
for (dev = dev_base; dev; dev = dev->next) {
if (dev == what_I_want)
break;
}
you can test for a successful find after the loop with:
if (dev) {
I_found_it();
}
That doesn't work with for_each_netdev(), if the loop
runs till the end of the list, the iterator will not
be left at NULL.
I just want to make sure you didn't leave any code around which wants
that behavior still.
This is one of the subtle things about using the list iterators in
linux/list.h, vs. a traditional by-hand singly linked list
implementation.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists