mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
block/vmdk: Simplify vmdk_co_create() to return directly
Cc: Fam Zheng <fam@euphon.net> Cc: Kevin Wolf <kwolf@redhat.com> Cc: Hanna Reitz <hreitz@redhat.com> Cc: qemu-block@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221122134917.1217307-3-armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
66997c42e0
commit
851fd4a01d
1 changed files with 11 additions and 17 deletions
28
block/vmdk.c
28
block/vmdk.c
|
@ -2821,7 +2821,6 @@ static BlockBackend *vmdk_co_create_cb(int64_t size, int idx,
|
||||||
static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,
|
static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
BlockdevCreateOptionsVmdk *opts;
|
BlockdevCreateOptionsVmdk *opts;
|
||||||
|
|
||||||
opts = &create_options->u.vmdk;
|
opts = &create_options->u.vmdk;
|
||||||
|
@ -2829,24 +2828,19 @@ static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,
|
||||||
/* Validate options */
|
/* Validate options */
|
||||||
if (!QEMU_IS_ALIGNED(opts->size, BDRV_SECTOR_SIZE)) {
|
if (!QEMU_IS_ALIGNED(opts->size, BDRV_SECTOR_SIZE)) {
|
||||||
error_setg(errp, "Image size must be a multiple of 512 bytes");
|
error_setg(errp, "Image size must be a multiple of 512 bytes");
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = vmdk_co_do_create(opts->size,
|
return vmdk_co_do_create(opts->size,
|
||||||
opts->subformat,
|
opts->subformat,
|
||||||
opts->adapter_type,
|
opts->adapter_type,
|
||||||
opts->backing_file,
|
opts->backing_file,
|
||||||
opts->hwversion,
|
opts->hwversion,
|
||||||
opts->toolsversion,
|
opts->toolsversion,
|
||||||
false,
|
false,
|
||||||
opts->zeroed_grain,
|
opts->zeroed_grain,
|
||||||
vmdk_co_create_cb,
|
vmdk_co_create_cb,
|
||||||
opts, errp);
|
opts, errp);
|
||||||
return ret;
|
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vmdk_close(BlockDriverState *bs)
|
static void vmdk_close(BlockDriverState *bs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue