Re: [PATCH v15 06/16] of/fdt: add helper functions for handling properties

From: David Gibson
Date: Fri Oct 05 2018 - 03:03:43 EST


On Fri, Oct 05, 2018 at 02:06:29PM +0900, AKASHI, Takahiro wrote:
[snip]
> > >> +{
> > >> + return (strlen(prop_name) + 1) +
> > >> + sizeof(struct fdt_property) +
> > >> + FDT_TAGALIGN(len);
> > >
> > > Looks like you are using this to calculate how much space you need to
> > > allocate in addition to the current DTB for a couple of new or
> > > replaced properties. I'm not sure that this calculation is completely
> > > accurate. And it is strange there doesn't seem to be any libfdt
> > > function for this already. It would be simpler to just add some fixed
> > > additional amount.
> > >
> > > Maybe David G has comments on this?
>
> I'm not quit sure why it's not that accurate, but as I said in a reply to
> David's comment, I will take your suggestion.

I think it is accurate, but it is not robust. It might not be
accurate if we ever make further tweaks to the libfdt format. libfdt
is supposed to abstract those changes away, but if you make
assumptions like this, you break that abstraction.

--
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

Attachment: signature.asc
Description: PGP signature