common flatdevtree code

Segher Boessenkool segher at kernel.crashing.org
Thu Sep 28 09:41:27 EST 2006


> I talked to David Gibson about this and he pointed out that there is a
> problem with using a void * to identify nodes (i.e. returned from
> ft_find_device and passed to ft_set_prop etc.).  The problem is that
> if we reallocate the space for the tree, then any void * handles that
> the user of the library has are then invalid.  Perhaps we have to use
> offsets from the beginning of the struct region instead - the offset
> for a node will be stable across changes of the node or any of its
> descendents, at least.

Or unpack the tree before you operate on it.  You can pack it
again later if you need to pass it as a flat tree again (or the
bootwrapper could implement a real OF client interface, which
is useful for many more things!)

A flat contiguous blob of bytes is convenient to pass around,
but not such a great data structure for basically anything else ;-)


Segher




More information about the Linuxppc-dev mailing list