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 <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
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);