summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeijie Gao <[email protected]>2026-05-20 16:27:40 +0800
committerHeiko Schocher <[email protected]>2026-07-08 11:34:44 +0200
commitc719d2627ae67903199045c6072a3370b395b7ef (patch)
treedc1aecca9dc66217fe1d07cdd7e204cff8aee772
parent14fe02ac5e5260a0dad58804cc6c922827bf9d7e (diff)
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 is invalid, this patch replaces negative size with all free space size in ubi_create_vol(). Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Weijie Gao <[email protected]>
-rw-r--r--cmd/ubi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/ubi.c b/cmd/ubi.c
index eea863ac303..2b206141a21 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -226,7 +226,11 @@ int ubi_create_vol(const char *volume, int64_t size, bool dynamic, int vol_id,
req.vol_id = vol_id;
req.alignment = 1;
- req.bytes = size;
+
+ if (size < 0)
+ req.bytes = ubi->avail_pebs * ubi->leb_size;
+ else
+ req.bytes = size;
strcpy(req.name, volume);
req.name_len = strlen(volume);