block: pass BlockDriver reference to the .bdrv_co_create
This will allow the reuse of a single generic .bdrv_co_create implementation for several drivers. No functional changes. Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20200326011218.29230-2-mlevitsk@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
66c8672d24
commit
b92902dfea
3
block.c
3
block.c
@ -483,7 +483,8 @@ static void coroutine_fn bdrv_create_co_entry(void *opaque)
|
||||
CreateCo *cco = opaque;
|
||||
assert(cco->drv);
|
||||
|
||||
ret = cco->drv->bdrv_co_create_opts(cco->filename, cco->opts, &local_err);
|
||||
ret = cco->drv->bdrv_co_create_opts(cco->drv,
|
||||
cco->filename, cco->opts, &local_err);
|
||||
error_propagate(&cco->err, local_err);
|
||||
cco->ret = ret;
|
||||
}
|
||||
|
@ -601,7 +601,8 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename,
|
||||
static int coroutine_fn block_crypto_co_create_opts_luks(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -2405,7 +2405,9 @@ out:
|
||||
return result;
|
||||
}
|
||||
|
||||
static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions options;
|
||||
|
@ -588,7 +588,9 @@ static int raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions options;
|
||||
|
@ -1130,7 +1130,8 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn qemu_gluster_co_create_opts(const char *filename,
|
||||
static int coroutine_fn qemu_gluster_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -662,7 +662,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn nfs_file_co_create_opts(const char *url, QemuOpts *opts,
|
||||
static int coroutine_fn nfs_file_co_create_opts(BlockDriver *drv,
|
||||
const char *url,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options;
|
||||
|
@ -609,7 +609,8 @@ exit:
|
||||
goto out;
|
||||
}
|
||||
|
||||
static int coroutine_fn parallels_co_create_opts(const char *filename,
|
||||
static int coroutine_fn parallels_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -934,7 +934,8 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn qcow_co_create_opts(const char *filename,
|
||||
static int coroutine_fn qcow_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts, Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options = NULL;
|
||||
|
@ -3558,7 +3558,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
static int coroutine_fn qcow2_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options = NULL;
|
||||
|
@ -720,7 +720,8 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
|
||||
static int coroutine_fn bdrv_qed_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -419,7 +419,9 @@ static int raw_has_zero_init_truncate(BlockDriverState *bs)
|
||||
return bdrv_has_zero_init_truncate(bs->file->bs);
|
||||
}
|
||||
|
||||
static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
return bdrv_create_file(filename, opts, errp);
|
||||
|
@ -437,7 +437,8 @@ static int qemu_rbd_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||
return qemu_rbd_do_create(options, NULL, NULL, errp);
|
||||
}
|
||||
|
||||
static int coroutine_fn qemu_rbd_co_create_opts(const char *filename,
|
||||
static int coroutine_fn qemu_rbd_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -2157,7 +2157,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
static int coroutine_fn sd_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options = NULL;
|
||||
|
@ -963,7 +963,9 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn ssh_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
static int coroutine_fn ssh_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options;
|
||||
|
@ -896,7 +896,9 @@ static int coroutine_fn vdi_co_create(BlockdevCreateOptions *create_options,
|
||||
return vdi_co_do_create(create_options, DEFAULT_CLUSTER_SIZE, errp);
|
||||
}
|
||||
|
||||
static int coroutine_fn vdi_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
static int coroutine_fn vdi_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
QDict *qdict = NULL;
|
||||
|
@ -2046,7 +2046,8 @@ delete_and_exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn vhdx_co_create_opts(const char *filename,
|
||||
static int coroutine_fn vhdx_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -2588,7 +2588,9 @@ exit:
|
||||
return blk;
|
||||
}
|
||||
|
||||
static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
static int coroutine_fn vmdk_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
|
@ -1089,8 +1089,10 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn vpc_co_create_opts(const char *filename,
|
||||
QemuOpts *opts, Error **errp)
|
||||
static int coroutine_fn vpc_co_create_opts(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options = NULL;
|
||||
QDict *qdict;
|
||||
|
@ -135,7 +135,8 @@ struct BlockDriver {
|
||||
void (*bdrv_close)(BlockDriverState *bs);
|
||||
int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts,
|
||||
Error **errp);
|
||||
int coroutine_fn (*bdrv_co_create_opts)(const char *filename,
|
||||
int coroutine_fn (*bdrv_co_create_opts)(BlockDriver *drv,
|
||||
const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp);
|
||||
int (*bdrv_make_empty)(BlockDriverState *bs);
|
||||
|
Loading…
Reference in New Issue
Block a user