summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2015-08-26 19:47:48 +0200
committerKevin Wolf <kwolf@redhat.com>2015-09-14 16:51:36 +0200
commite6641719fed794be8e0c48a69761528ae6c95ed9 (patch)
tree2d468a3f566630548503d9aa83ecde588f165976 /block
parent2b750d9d261bda7f75b39dfc1e1e5f22502929d5 (diff)
downloadhqemu-e6641719fed794be8e0c48a69761528ae6c95ed9.zip
hqemu-e6641719fed794be8e0c48a69761528ae6c95ed9.tar.gz
block: Always pass NULL as drv for bdrv_open()
Change all callers of bdrv_open() to pass the driver name in the options QDict instead of passing its BlockDriver pointer. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2.c16
-rw-r--r--block/vvfat.c8
2 files changed, 17 insertions, 7 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index ea34ae2..867b43b 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1873,8 +1873,10 @@ static int qcow2_create2(const char *filename, int64_t total_size,
QemuOpts *opts, int version, int refcount_order,
Error **errp)
{
- /* Calculate cluster_bits */
int cluster_bits;
+ QDict *options;
+
+ /* Calculate cluster_bits */
cluster_bits = ctz32(cluster_size);
if (cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BITS ||
(1 << cluster_bits) != cluster_size)
@@ -2032,9 +2034,11 @@ static int qcow2_create2(const char *filename, int64_t total_size,
* refcount of the cluster that is occupied by the header and the refcount
* table)
*/
- ret = bdrv_open(&bs, filename, NULL, NULL,
+ options = qdict_new();
+ qdict_put(options, "driver", qstring_from_str("qcow2"));
+ ret = bdrv_open(&bs, filename, NULL, options,
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,
- &bdrv_qcow2, &local_err);
+ NULL, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
goto out;
@@ -2084,9 +2088,11 @@ static int qcow2_create2(const char *filename, int64_t total_size,
bs = NULL;
/* Reopen the image without BDRV_O_NO_FLUSH to flush it before returning */
- ret = bdrv_open(&bs, filename, NULL, NULL,
+ options = qdict_new();
+ qdict_put(options, "driver", qstring_from_str("qcow2"));
+ ret = bdrv_open(&bs, filename, NULL, options,
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING,
- &bdrv_qcow2, &local_err);
+ NULL, &local_err);
if (local_err) {
error_propagate(errp, local_err);
goto out;
diff --git a/block/vvfat.c b/block/vvfat.c
index 2068697..bffe8ad 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2926,6 +2926,8 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp)
QemuOpts *opts = NULL;
int ret;
int size = sector2cluster(s, s->sector_count);
+ QDict *options;
+
s->used_clusters = calloc(size, 1);
array_init(&(s->commits), sizeof(commit_t));
@@ -2956,9 +2958,11 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp)
}
s->qcow = NULL;
- ret = bdrv_open(&s->qcow, s->qcow_filename, NULL, NULL,
+ options = qdict_new();
+ qdict_put(options, "driver", qstring_from_str("qcow"));
+ ret = bdrv_open(&s->qcow, s->qcow_filename, NULL, options,
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,
- bdrv_qcow, errp);
+ NULL, errp);
if (ret < 0) {
goto err;
}
OpenPOWER on IntegriCloud