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:
Maxim Levitsky 2020-03-26 03:12:17 +02:00 committed by Max Reitz
parent 66c8672d24
commit b92902dfea
19 changed files with 49 additions and 20 deletions

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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);

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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);