[PATCH 2/3] cmd: ubi: allow creating volume with all free spaces in ubi_create_vol
Weijie Gao
weijie.gao at mediatek.com
Mon Apr 20 09:25:12 CEST 2026
On Sat, 2026-04-18 at 12:47 +1200, Simon Glass wrote:
> Hi Weijie,
>
> On 2026-04-17T02:35:14, Weijie Gao <weijie.gao at mediatek.com> wrote:
> > cmd: ubi: allow creating volume with all free spaces in
> > ubi_create_vol
> >
> > Although the ubi command itself supports creating volume with all
> > free spaces, the api ubi_create_vol() does not.
> >
> > Since negative size in invalid, this patch replaces negative size
>
> is invalid
>
> > with all free space size in ubi_create_vol().
> >
> > Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> >
> > cmd/ubi.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> > diff --git a/cmd/ubi.c b/cmd/ubi.c
> > @@ -226,7 +226,11 @@ int ubi_create_vol(char *volume, int64_t size,
> > int dynamic, int vol_id,
> > + if (size < 0)
> > + req.bytes = ubi->avail_pebs * ubi->leb_size;
> > + else
> > + req.bytes = size;
>
> When size is negative, the printf() below still prints the original
> negative size rather than the computed req.bytes
OK. As you mentioned in patch 3/3, I think maybe we can move these
printf logs to the command's main function to avoid logs being printed
every time these API functions are called.
>
> Regards,
> Simon
More information about the U-Boot
mailing list