On Wed, Jun 18, 2025 at 04:01:02PM -0400, Raymond Mao wrote: > Hi Tom, > > On Wed, 18 Jun 2025 at 13:40, Tom Rini <[email protected]> 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 <[email protected]> > > [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).
Yeah, I think I'd like to add the if/else later if we need it rather than preemptively. -- Tom
signature.asc
Description: PGP signature

