100-25-cmd-ubi-allow-creating-volume-with-all-free-spaces.patch 750 B

123456789101112131415161718192021222324252627
  1. From f6a4130959af1e6d13d616203e42ed3c894666ad Mon Sep 17 00:00:00 2001
  2. From: Weijie Gao <[email protected]>
  3. Date: Mon, 25 Jul 2022 17:00:00 +0800
  4. Subject: [PATCH 60/71] cmd: ubi: allow creating volume with all free spaces
  5. Allow creating volume with all free spaces by giving a negative size value.
  6. Signed-off-by: Weijie Gao <[email protected]>
  7. ---
  8. cmd/ubi.c | 6 +++++-
  9. 1 file changed, 5 insertions(+), 1 deletion(-)
  10. --- a/cmd/ubi.c
  11. +++ b/cmd/ubi.c
  12. @@ -226,7 +226,11 @@ int ubi_create_vol(char *volume, int64_t
  13. req.vol_id = vol_id;
  14. req.alignment = 1;
  15. - req.bytes = size;
  16. +
  17. + if (size < 0)
  18. + req.bytes = ubi->avail_pebs * ubi->leb_size;
  19. + else
  20. + req.bytes = size;
  21. strcpy(req.name, volume);
  22. req.name_len = strlen(volume);