[PATCH] dtc: Add ability to delete nodes and properties

David Gibson david at gibson.dropbear.id.au
Wed Mar 21 17:13:40 EST 2012


On Tue, Mar 20, 2012 at 12:03:35PM -0600, Stephen Warren wrote:
> On 03/13/2012 04:48 PM, Stephen Warren wrote:
> > dtc currently allows the contents of properties to be changed, and the
> > contents of nodes to be added to. There are situations where removing
> > properties or nodes may be useful. This change implements the following
> > syntax to do that:
> > 
> >     / {
> >         propname /delprop/;
> >         nodename /delnode/;
> >     };
> > 
> > or:
> > 
> >     &noderef /delnode/;
> 
> Jon, David, any thoughts on this?

Hrm, some, but not terribly clear ones.

So, superficially, your patch looks fine, making the obvious
straightforward implementation of deletion.  I'm about 85% convinced
the syntax for it is as good as we can reasonably get.

Unfortunately the obvious deletion implementation raises some issues
with labels.  With this patch, for the first time ever, it's possible
to delete labels (along with the node or property they're attached
to).  And further, having deleted a labelled node or property a new
one could created using the same label.

Our label semantics have been worked out with the assumption that
labels are immutable, so the order of anything to do with them doesn't
matter.  Now, if a label is attached, removed then reassigned,
references to that label could resolve differently depending on the
not-obvious-to-the-user internal order of processing.

I think the sanest way to resolve this from the user visible point of
view is to keep the assumption that labels are always fixed.  That
means that even if a labelled node is removed, the label cannot be
reused.  Attempting to re-use the label will give an error as will
referencing the label (from anywhere that's not itself deleted).

But implementing that means doing a rework on how we store labels /
nodes / properties and manage their lifetimes.  It's not a huge body
of work, but it's not completely trivial either.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson


More information about the devicetree-discuss mailing list