[PATCH v2 01/18] abuf: Add a helper for initing and allocating a buffer

Tom Rini trini at konsulko.com
Mon May 5 22:38:10 CEST 2025


On Thu, May 01, 2025 at 07:37:01AM -0600, Simon Glass wrote:

> This construct appears in various places. Reduce code size by adding a
> function for it.
> 
> It inits the abuf, then allocates it to the requested size.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v2:
> - Add new patch with a helper for initing and allocating a buffer
> 
>  boot/cedit.c          |  3 +--
>  boot/scene.c          |  3 +--
>  boot/scene_textline.c |  3 +--
>  include/abuf.h        | 11 +++++++++++
>  lib/abuf.c            |  9 +++++++++
>  lib/of_live.c         |  3 +--
>  test/lib/abuf.c       | 22 ++++++++++++++++++++++
>  7 files changed, 46 insertions(+), 8 deletions(-)

This just made me look again at the abuf implementation itself and
become filled with regret I didn't reject it back in 2021. We're
introducing wrappers around standard functions and calling conventions /
patterns with something homegrown (and so not intuitive to others) that
mainly hides the "sysmem" challenge we also have and I wish you were
interested in revisiting how that part of sandbox works instead. And
even if this is a better design, for the sake of argument, it's not
something everyone else is used to. And that's important.

If we *really* need something different / new here, I'd rather see us go
and wrap common/dlmalloc.c with kmalloc/kfree/etc and so give people
something even more familiar-looking.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250505/2fedaf4d/attachment-0001.sig>


More information about the U-Boot mailing list