[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/99] qemu-io: Use purely string blockdev options
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 14/99] qemu-io: Use purely string blockdev options |
Date: |
Mon, 23 Jul 2018 15:16:23 -0500 |
From: Max Reitz <address@hidden>
Currently, qemu-io only uses string-valued blockdev options (as all are
converted directly from QemuOpts) -- with one exception: -U adds the
force-share option as a boolean. This in itself is already a bit
questionable, but a real issue is that it also assumes the value already
existing in the options QDict would be a boolean, which is wrong.
That has the following effect:
$ ./qemu-io -r -U --image-opts \
driver=file,filename=/dev/null,force-share=off
[1] 15200 segmentation fault (core dumped) ./qemu-io -r -U
--image-opts driver=file,filename=/dev/null,force-share=off
Since @opts is converted from QemuOpts, the value must be a string, and
we have to compare it as such. Consequently, it makes sense to also set
it as a string instead of a boolean.
Cc: address@hidden
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
(cherry picked from commit 2a01c01f9ecb43af4c0a85fe6adc429ffc9c31b5)
Signed-off-by: Michael Roth <address@hidden>
---
qemu-io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index e692c555e0..0755a30447 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -95,12 +95,12 @@ static int openfile(char *name, int flags, bool
writethrough, bool force_share,
opts = qdict_new();
}
if (qdict_haskey(opts, BDRV_OPT_FORCE_SHARE)
- && !qdict_get_bool(opts, BDRV_OPT_FORCE_SHARE)) {
+ && strcmp(qdict_get_str(opts, BDRV_OPT_FORCE_SHARE), "on")) {
error_report("-U conflicts with image options");
QDECREF(opts);
return 1;
}
- qdict_put_bool(opts, BDRV_OPT_FORCE_SHARE, true);
+ qdict_put_str(opts, BDRV_OPT_FORCE_SHARE, "on");
}
qemuio_blk = blk_new_open(name, NULL, opts, flags, &local_err);
if (!qemuio_blk) {
--
2.17.1
- [Qemu-devel] [PATCH 00/99] Patch Round-up for stable 2.12.1, freeze on 2018-07-30, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 99/99] tcg/i386: Mark xmm registers call-clobbered, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 09/99] spapr: don't advertise radix GTSE if max-compat-cpu < power9, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 10/99] qxl: fix local renderer crash, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 11/99] configure: recognize more rpmbuild macros, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 13/99] iotests: Add test for rebasing with relative paths, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 12/99] qemu-img: Resolve relative backing paths in rebase, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 14/99] qemu-io: Use purely string blockdev options,
Michael Roth <=
- [Qemu-devel] [PATCH 15/99] qemu-img: Use only string options in img_open_opts, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 17/99] lm32: take BQL before writing IP/IM register, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 16/99] iotests: Add test for -U/force-share conflicts, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 18/99] raw: Check byte range uniformly, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 19/99] s390x/css: disabled subchannels cannot be status pending, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 01/99] tests: fix tpm-crb tpm-tis tests race, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 20/99] pc-bios/s390-ccw: struct tpi_info must be declared as aligned(4), Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 21/99] virtio-ccw: common reset handler, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 22/99] s390x/ccw: make sure all ccw devices are properly reset, Michael Roth, 2018/07/23
- [Qemu-devel] [PATCH 24/99] hw/intc/arm_gicv3: Fix APxR<n> register dispatching, Michael Roth, 2018/07/23