Re: [PATCH] [2.4] Re: /proc/ioports overrun patch

From: viro
Date: Wed Sep 24 2003 - 15:00:43 EST


On Wed, Sep 24, 2003 at 08:51:33PM +0100, viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:

> Hmm... Why not make the iterator traverse the resource tree instead?
> After all, all it takes is addition of pointer to parent resource into
> struct resource. Goes for both 2.4 and 2.6...

Hey - it's already there. That makes life very easy - ->next() should
do the following:
if (resource->child)
return resource->child;
while (!resource->sibling) {
resource = resource->parent;
if (!resource)
return NULL;
}
return resource->sibling;

AFAICS that should be it - walks the tree in right order. Depth can be
trivially found by ->show(), so there's no problems either...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/