aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-09-02 16:46:48 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-09-02 16:50:58 +0300
commit214ddd398850d003dcd1943da6a039f324646b5b (patch)
treeb9830bc7e4942a5aab8bcc61eead896bb21875ff /ubi-utils
parentdf0965a0b0dea9210078e616e1af696966fbb1ac (diff)
ubimkvol: check for free LEBs
Check for free LEBs before trying to create a volume. This fixes the following issue: $ ubimkvol /dev/ubi0 -n 0 -N test_fs -m ubimkvol: error!: cannot UBI create volume error 22 (Invalid argument) Error: cannot create UBI volume "Invalid argument" ? Not understandable. But the thing is that -m makes ubimkvol use available space, which is zero, then it passes zero to the ioctl, which fails in request validation code, because 0 invalid volume size. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils')
-rw-r--r--ubi-utils/new-utils/src/ubimkvol.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ubi-utils/new-utils/src/ubimkvol.c b/ubi-utils/new-utils/src/ubimkvol.c
index fd8c568..ad072c4 100644
--- a/ubi-utils/new-utils/src/ubimkvol.c
+++ b/ubi-utils/new-utils/src/ubimkvol.c
@@ -261,6 +261,11 @@ int main(int argc, char * const argv[])
goto out_libubi;
}
+ if (dev_info.avail_bytes == 0) {
+ errmsg("UBI device does not have free logical eraseblocks");
+ goto out_libubi;
+ }
+
if (args.maxavs) {
args.bytes = dev_info.avail_bytes;
printf("Set volume size to %lld\n", args.bytes);