[PATCH 4/6] bloblist: expose 'expand_by' as an output argument
Raymond Mao
raymond.mao at linaro.org
Wed Jun 18 22:01:02 CEST 2025
Hi Tom,
On Wed, 18 Jun 2025 at 13:40, Tom Rini <trini at konsulko.com> wrote:
>
> On Wed, Jun 18, 2025 at 07:59:26AM -0700, Raymond Mao wrote:
>
> > Some advanced usecases of bloblist needs to know the actual bytes
> > expanded or shrunk after blob resizing.
> > For example, to support applying DT overlay from bloblist, firstly
> > the FDT blob needs to be resized for potential size increasing after
> > applying overlay. If the DT overlay blob is one of the following blobs
> > of the FDT, its address will be shifted after FDT blob resizing.
> > Thus, returning 'expand_by' helps the caller to get the shifted data
> > pointer when it comes to get the overlay for applying.
> >
> > Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
> [snip]
> > @@ -337,6 +338,7 @@ void *bloblist_ensure(uint tag, int size);
> > */
> > int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp);
> >
> > +#if CONFIG_IS_ENABLED(BLOBLIST)
> > /**
> > * bloblist_resize() - resize a blob
> > *
> > @@ -345,10 +347,17 @@ int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp);
> > *
> > * @tag: Tag to add (enum bloblist_tag_t)
> > * @new_size: New size of the blob (>0 to expand, <0 to contract)
> > + * @expand_by: Number of bytes actually expanded by (-ve to contract)
> > * Return: 0 if OK, -ENOSPC if the bloblist does not have enough space, -ENOENT
> > * if the tag is not found
> > */
> > -int bloblist_resize(uint tag, int new_size);
> > +int bloblist_resize(uint tag, int new_size, int *expand_by);
> > +#else
> > +static inline int bloblist_resize(uint tag, int new_size, int *expand_by)
> > +{
> > + return -EPERM;
> > +}
> > +#endif
>
> Do we really need to be doing this if/else in the header? What's failing
> otherwise, and can we not guard that with:
> if (IS_ENABLED(CONFIG_BLOBLIST)) {
> ..
> }
> in the code?
>
This function is needed to be called in fdtdec, if it is not guarded
in the header file, we have to guard it from all its callers to avoid
linker error when BLOBLIST is not selected (In the future, there might
be more than one caller).
Regards,
Raymond
> --
> Tom
More information about the U-Boot
mailing list