mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 10:53:37 +08:00
block: bdrv_create_file is a coroutine_fn
It is always called in coroutine_fn callbacks, therefore it can directly call bdrv_co_create(). Rename it to bdrv_co_create_file too. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-Id: <20221128142337.657646-9-eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
84bdf21f97
commit
2475a0d0f4
5
block.c
5
block.c
@ -719,7 +719,8 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp)
|
int coroutine_fn bdrv_co_create_file(const char *filename, QemuOpts *opts,
|
||||||
|
Error **errp)
|
||||||
{
|
{
|
||||||
QemuOpts *protocol_opts;
|
QemuOpts *protocol_opts;
|
||||||
BlockDriver *drv;
|
BlockDriver *drv;
|
||||||
@ -760,7 +761,7 @@ int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = bdrv_create(drv, filename, protocol_opts, errp);
|
ret = bdrv_co_create(drv, filename, protocol_opts, errp);
|
||||||
out:
|
out:
|
||||||
qemu_opts_del(protocol_opts);
|
qemu_opts_del(protocol_opts);
|
||||||
qobject_unref(qdict);
|
qobject_unref(qdict);
|
||||||
|
@ -703,7 +703,7 @@ static int coroutine_fn block_crypto_co_create_opts_luks(BlockDriver *drv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create protocol layer */
|
/* Create protocol layer */
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -646,7 +646,7 @@ static int coroutine_fn parallels_co_create_opts(BlockDriver *drv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create and open the file (protocol layer) */
|
/* Create and open the file (protocol layer) */
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -973,7 +973,7 @@ static int coroutine_fn qcow_co_create_opts(BlockDriver *drv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create and open the file (protocol layer) */
|
/* Create and open the file (protocol layer) */
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -3871,7 +3871,7 @@ static int coroutine_fn qcow2_co_create_opts(BlockDriver *drv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create and open the file (protocol layer) */
|
/* Create and open the file (protocol layer) */
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
@ -3886,7 +3886,7 @@ static int coroutine_fn qcow2_co_create_opts(BlockDriver *drv,
|
|||||||
/* Create and open an external data file (protocol layer) */
|
/* Create and open an external data file (protocol layer) */
|
||||||
val = qdict_get_try_str(qdict, BLOCK_OPT_DATA_FILE);
|
val = qdict_get_try_str(qdict, BLOCK_OPT_DATA_FILE);
|
||||||
if (val) {
|
if (val) {
|
||||||
ret = bdrv_create_file(val, opts, errp);
|
ret = bdrv_co_create_file(val, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
@ -778,7 +778,7 @@ static int coroutine_fn bdrv_qed_co_create_opts(BlockDriver *drv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create and open the file (protocol layer) */
|
/* Create and open the file (protocol layer) */
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -433,7 +433,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
|||||||
QemuOpts *opts,
|
QemuOpts *opts,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
return bdrv_create_file(filename, opts, errp);
|
return bdrv_co_create_file(filename, opts, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
|
@ -934,7 +934,7 @@ static int coroutine_fn vdi_co_create_opts(BlockDriver *drv,
|
|||||||
qdict = qemu_opts_to_qdict_filtered(opts, NULL, &vdi_create_opts, true);
|
qdict = qemu_opts_to_qdict_filtered(opts, NULL, &vdi_create_opts, true);
|
||||||
|
|
||||||
/* Create and open the file (protocol layer) */
|
/* Create and open the file (protocol layer) */
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -2084,7 +2084,7 @@ static int coroutine_fn vhdx_co_create_opts(BlockDriver *drv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create and open the file (protocol layer) */
|
/* Create and open the file (protocol layer) */
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -2294,7 +2294,7 @@ static int coroutine_fn vmdk_create_extent(const char *filename,
|
|||||||
int ret;
|
int ret;
|
||||||
BlockBackend *blk = NULL;
|
BlockBackend *blk = NULL;
|
||||||
|
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1111,7 @@ static int coroutine_fn vpc_co_create_opts(BlockDriver *drv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create and open the file (protocol layer) */
|
/* Create and open the file (protocol layer) */
|
||||||
ret = bdrv_create_file(filename, opts, errp);
|
ret = bdrv_co_create_file(filename, opts, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,8 @@ BlockDriver *bdrv_find_protocol(const char *filename,
|
|||||||
BlockDriver *bdrv_find_format(const char *format_name);
|
BlockDriver *bdrv_find_format(const char *format_name);
|
||||||
int bdrv_create(BlockDriver *drv, const char* filename,
|
int bdrv_create(BlockDriver *drv, const char* filename,
|
||||||
QemuOpts *opts, Error **errp);
|
QemuOpts *opts, Error **errp);
|
||||||
int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp);
|
int coroutine_fn bdrv_co_create_file(const char *filename, QemuOpts *opts,
|
||||||
|
Error **errp);
|
||||||
|
|
||||||
BlockDriverState *bdrv_new(void);
|
BlockDriverState *bdrv_new(void);
|
||||||
int bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top,
|
int bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top,
|
||||||
|
Loading…
Reference in New Issue
Block a user