block: Drop drv parameter from bdrv_open()
Now that this parameter is effectively unused, we can drop it and just pass NULL on to bdrv_open_inherit(). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
e6641719fe
commit
6ebf9aa2ef
9
block.c
9
block.c
@ -1391,7 +1391,7 @@ int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp)
|
|||||||
bs_snapshot = bdrv_new();
|
bs_snapshot = bdrv_new();
|
||||||
|
|
||||||
ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options,
|
ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options,
|
||||||
flags, NULL, &local_err);
|
flags, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto out;
|
goto out;
|
||||||
@ -1637,11 +1637,10 @@ close_and_fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int bdrv_open(BlockDriverState **pbs, const char *filename,
|
int bdrv_open(BlockDriverState **pbs, const char *filename,
|
||||||
const char *reference, QDict *options, int flags,
|
const char *reference, QDict *options, int flags, Error **errp)
|
||||||
BlockDriver *drv, Error **errp)
|
|
||||||
{
|
{
|
||||||
return bdrv_open_inherit(pbs, filename, reference, options, flags, NULL,
|
return bdrv_open_inherit(pbs, filename, reference, options, flags, NULL,
|
||||||
NULL, drv, errp);
|
NULL, NULL, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct BlockReopenQueueEntry {
|
typedef struct BlockReopenQueueEntry {
|
||||||
@ -3846,7 +3845,7 @@ void bdrv_img_create(const char *filename, const char *fmt,
|
|||||||
|
|
||||||
bs = NULL;
|
bs = NULL;
|
||||||
ret = bdrv_open(&bs, full_backing, NULL, backing_options,
|
ret = bdrv_open(&bs, full_backing, NULL, backing_options,
|
||||||
back_flags, NULL, &local_err);
|
back_flags, &local_err);
|
||||||
g_free(full_backing);
|
g_free(full_backing);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -126,7 +126,7 @@ BlockBackend *blk_new_open(const char *name, const char *filename,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = bdrv_open(&blk->bs, filename, reference, options, flags, NULL, errp);
|
ret = bdrv_open(&blk->bs, filename, reference, options, flags, errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
blk_unref(blk);
|
blk_unref(blk);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -476,7 +476,7 @@ static int parallels_create(const char *filename, QemuOpts *opts, Error **errp)
|
|||||||
|
|
||||||
file = NULL;
|
file = NULL;
|
||||||
ret = bdrv_open(&file, filename, NULL, NULL,
|
ret = bdrv_open(&file, filename, NULL, NULL,
|
||||||
BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err);
|
BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -793,7 +793,7 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)
|
|||||||
|
|
||||||
qcow_bs = NULL;
|
qcow_bs = NULL;
|
||||||
ret = bdrv_open(&qcow_bs, filename, NULL, NULL,
|
ret = bdrv_open(&qcow_bs, filename, NULL, NULL,
|
||||||
BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err);
|
BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -1975,7 +1975,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
|
|||||||
|
|
||||||
bs = NULL;
|
bs = NULL;
|
||||||
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
||||||
NULL, &local_err);
|
&local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
return ret;
|
return ret;
|
||||||
@ -2038,7 +2038,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
|
|||||||
qdict_put(options, "driver", qstring_from_str("qcow2"));
|
qdict_put(options, "driver", qstring_from_str("qcow2"));
|
||||||
ret = bdrv_open(&bs, filename, NULL, options,
|
ret = bdrv_open(&bs, filename, NULL, options,
|
||||||
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,
|
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,
|
||||||
NULL, &local_err);
|
&local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto out;
|
goto out;
|
||||||
@ -2092,7 +2092,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
|
|||||||
qdict_put(options, "driver", qstring_from_str("qcow2"));
|
qdict_put(options, "driver", qstring_from_str("qcow2"));
|
||||||
ret = bdrv_open(&bs, filename, NULL, options,
|
ret = bdrv_open(&bs, filename, NULL, options,
|
||||||
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING,
|
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING,
|
||||||
NULL, &local_err);
|
&local_err);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -583,7 +583,7 @@ static int qed_create(const char *filename, uint32_t cluster_size,
|
|||||||
|
|
||||||
bs = NULL;
|
bs = NULL;
|
||||||
ret = bdrv_open(&bs, filename, NULL, NULL,
|
ret = bdrv_open(&bs, filename, NULL, NULL,
|
||||||
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL, NULL,
|
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_PROTOCOL,
|
||||||
&local_err);
|
&local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
@ -1554,7 +1554,7 @@ static int sd_prealloc(const char *filename, Error **errp)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
||||||
NULL, errp);
|
errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto out_with_err_set;
|
goto out_with_err_set;
|
||||||
}
|
}
|
||||||
@ -1746,8 +1746,7 @@ static int sd_create(const char *filename, QemuOpts *opts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bs = NULL;
|
bs = NULL;
|
||||||
ret = bdrv_open(&bs, backing_file, NULL, NULL, BDRV_O_PROTOCOL, NULL,
|
ret = bdrv_open(&bs, backing_file, NULL, NULL, BDRV_O_PROTOCOL, errp);
|
||||||
errp);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -764,7 +764,7 @@ static int vdi_create(const char *filename, QemuOpts *opts, Error **errp)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
||||||
NULL, &local_err);
|
&local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -1842,7 +1842,7 @@ static int vhdx_create(const char *filename, QemuOpts *opts, Error **errp)
|
|||||||
|
|
||||||
bs = NULL;
|
bs = NULL;
|
||||||
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
||||||
NULL, &local_err);
|
&local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -1632,7 +1632,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
|||||||
|
|
||||||
assert(bs == NULL);
|
assert(bs == NULL);
|
||||||
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
||||||
NULL, &local_err);
|
&local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -1905,8 +1905,7 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp)
|
|||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
ret = bdrv_open(&bs, full_backing, NULL, NULL, BDRV_O_NO_BACKING, NULL,
|
ret = bdrv_open(&bs, full_backing, NULL, NULL, BDRV_O_NO_BACKING, errp);
|
||||||
errp);
|
|
||||||
g_free(full_backing);
|
g_free(full_backing);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -1977,7 +1976,7 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp)
|
|||||||
}
|
}
|
||||||
assert(new_bs == NULL);
|
assert(new_bs == NULL);
|
||||||
ret = bdrv_open(&new_bs, filename, NULL, NULL,
|
ret = bdrv_open(&new_bs, filename, NULL, NULL,
|
||||||
BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err);
|
BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -794,7 +794,7 @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
|
||||||
NULL, &local_err);
|
&local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -2962,7 +2962,7 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp)
|
|||||||
qdict_put(options, "driver", qstring_from_str("qcow"));
|
qdict_put(options, "driver", qstring_from_str("qcow"));
|
||||||
ret = bdrv_open(&s->qcow, s->qcow_filename, NULL, options,
|
ret = bdrv_open(&s->qcow, s->qcow_filename, NULL, options,
|
||||||
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,
|
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,
|
||||||
NULL, errp);
|
errp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -1527,7 +1527,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
|||||||
* extended QMP command? */
|
* extended QMP command? */
|
||||||
assert(state->new_bs == NULL);
|
assert(state->new_bs == NULL);
|
||||||
ret = bdrv_open(&state->new_bs, new_image_file, NULL, options,
|
ret = bdrv_open(&state->new_bs, new_image_file, NULL, options,
|
||||||
flags | BDRV_O_NO_BACKING, NULL, &local_err);
|
flags | BDRV_O_NO_BACKING, &local_err);
|
||||||
/* We will manually add the backing_hd field to the bs later */
|
/* We will manually add the backing_hd field to the bs later */
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
@ -1901,7 +1901,7 @@ static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename,
|
|||||||
qdict_put(options, "driver", qstring_from_str(format));
|
qdict_put(options, "driver", qstring_from_str(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = bdrv_open(&bs, filename, NULL, options, bdrv_flags, NULL, &local_err);
|
ret = bdrv_open(&bs, filename, NULL, options, bdrv_flags, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
return;
|
return;
|
||||||
@ -2546,7 +2546,7 @@ void qmp_drive_backup(const char *device, const char *target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
target_bs = NULL;
|
target_bs = NULL;
|
||||||
ret = bdrv_open(&target_bs, target, NULL, options, flags, NULL, &local_err);
|
ret = bdrv_open(&target_bs, target, NULL, options, flags, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto out;
|
goto out;
|
||||||
@ -2801,7 +2801,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
|||||||
*/
|
*/
|
||||||
target_bs = NULL;
|
target_bs = NULL;
|
||||||
ret = bdrv_open(&target_bs, target, NULL, options,
|
ret = bdrv_open(&target_bs, target, NULL, options,
|
||||||
flags | BDRV_O_NO_BACKING, NULL, &local_err);
|
flags | BDRV_O_NO_BACKING, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -218,8 +218,7 @@ void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd);
|
|||||||
int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp);
|
int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp);
|
||||||
int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp);
|
int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp);
|
||||||
int bdrv_open(BlockDriverState **pbs, const char *filename,
|
int bdrv_open(BlockDriverState **pbs, const char *filename,
|
||||||
const char *reference, QDict *options, int flags,
|
const char *reference, QDict *options, int flags, Error **errp);
|
||||||
BlockDriver *drv, Error **errp);
|
|
||||||
BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue,
|
BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue,
|
||||||
BlockDriverState *bs, int flags);
|
BlockDriverState *bs, int flags);
|
||||||
int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp);
|
int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp);
|
||||||
|
Loading…
Reference in New Issue
Block a user