diff options
author | Kevin Wolf <kwolf@redhat.com> | 2009-10-28 11:36:07 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-11-09 08:43:03 -0600 |
commit | 9f56640c8536a8dfb78fc05a39c1bf9921483b12 (patch) | |
tree | bf818afac854674d719b03ada11537eaaf3dd81f /qemu-img.c | |
parent | 5819c91806911e0976a187cf908b429ecb138da5 (diff) | |
download | qemu-9f56640c8536a8dfb78fc05a39c1bf9921483b12.zip qemu-9f56640c8536a8dfb78fc05a39c1bf9921483b12.tar.gz qemu-9f56640c8536a8dfb78fc05a39c1bf9921483b12.tar.bz2 |
qemu-img: Allow creating zero sized images
A size of 0 should be valid and cannot be treated as "missing value". Use -1
for this purpose instead.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -297,13 +297,16 @@ static int img_create(int argc, char **argv) return 0; } + /* Create parameter list with default values */ + param = parse_option_parameters("", drv->create_options, param); + set_option_parameter_int(param, BLOCK_OPT_SIZE, -1); + + /* Parse -o options */ if (options) { param = parse_option_parameters(options, drv->create_options, param); if (param == NULL) { error("Invalid options for file format '%s'.", fmt); } - } else { - param = parse_option_parameters("", drv->create_options, param); } /* Get the filename */ @@ -321,7 +324,7 @@ static int img_create(int argc, char **argv) // The size for the image must always be specified, with one exception: // If we are using a backing file, we can obtain the size from there - if (get_option_parameter(param, BLOCK_OPT_SIZE)->value.n == 0) { + if (get_option_parameter(param, BLOCK_OPT_SIZE)->value.n == -1) { QEMUOptionParameter *backing_file = get_option_parameter(param, BLOCK_OPT_BACKING_FILE); |