From: Hollis Blanchard <hollisb@us.ibm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: linuxppc-dev <Linuxppc-dev@ozlabs.org>,
Paul Mackerras <paulus@samba.org>
Subject: Re: common flatdevtree code
Date: Wed, 27 Sep 2006 18:52:19 -0500 [thread overview]
Message-ID: <1159401139.7584.82.camel@basalt.austin.ibm.com> (raw)
In-Reply-To: <6897081F-DDAC-462A-8D4D-EE613231CA4B@kernel.crashing.org>
On Thu, 2006-09-28 at 01:41 +0200, Segher Boessenkool wrote:
> > 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 ;-)
I agree; I think this data structure's design is explicitly static, and
now we're trying to dynamically edit it.
We essentially need to do unpack/pack now whenever the size of the
structure changes (e.g. changing a property size, adding or removing
anything). Making that explicit (and one-time) might be a good idea:
tree = ft_unpack(blob);
n = ft_find_node(tree, "/node");
ft_set_prop(n, "property", value, len);
...
blob = ft_pack(tree);
--
Hollis Blanchard
IBM Linux Technology Center
next prev parent reply other threads:[~2006-09-27 23:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-31 18:40 common flatdevtree code Mark A. Greer
2006-09-06 3:52 ` Paul Mackerras
2006-09-06 18:14 ` Mark A. Greer
2006-09-07 0:36 ` Mark A. Greer
2006-09-07 7:43 ` Hollis Blanchard
2006-09-07 18:27 ` Mark A. Greer
2006-09-07 22:23 ` Hollis Blanchard
2006-09-08 0:56 ` Mark A. Greer
2006-09-08 1:11 ` Mark A. Greer
2006-09-08 13:23 ` Paul Mackerras
2006-09-08 16:51 ` Mark A. Greer
2006-09-19 19:45 ` Mark A. Greer
2006-09-27 22:32 ` Paul Mackerras
2006-09-27 22:55 ` Hollis Blanchard
2006-09-27 23:41 ` Segher Boessenkool
2006-09-27 23:52 ` Hollis Blanchard [this message]
2006-09-28 0:51 ` Segher Boessenkool
2006-09-28 19:34 ` Mark A. Greer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1159401139.7584.82.camel@basalt.austin.ibm.com \
--to=hollisb@us.ibm.com \
--cc=Linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).