[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 35/37] qemu-io: Use purely string blockdev options
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 35/37] qemu-io: Use purely string blockdev options |
Date: |
Tue, 15 May 2018 17:40:31 +0200 |
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>
---
qemu-io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index 72fee0d8b7..73c638ff8b 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");
qobject_unref(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.13.6
- [Qemu-block] [PULL 18/37] Fix error message about compressed clusters with OFLAG_COPIED, (continued)
- [Qemu-block] [PULL 18/37] Fix error message about compressed clusters with OFLAG_COPIED, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 23/37] iotests: Skip 181 and 201 without userfaultfd, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 27/37] block: Set BDRV_REQ_WRITE_UNCHANGED for COR writes, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 25/37] block: BLK_PERM_WRITE includes ..._UNCHANGED, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 31/37] iotests: Copy 197 for COR filter driver, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 29/37] block: Support BDRV_REQ_WRITE_UNCHANGED in filters, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 24/37] block: Add COR filter driver, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 34/37] block: Document BDRV_REQ_WRITE_UNCHANGED support, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 30/37] iotests: Clean up wrap image in 197, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 33/37] qemu-img: Check post-truncation size, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 35/37] qemu-io: Use purely string blockdev options,
Kevin Wolf <=
- [Qemu-block] [PULL 32/37] iotests: Add test for COR across nodes, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 36/37] qemu-img: Use only string options in img_open_opts, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 37/37] iotests: Add test for -U/force-share conflicts, Kevin Wolf, 2018/05/15
- Re: [Qemu-block] [Qemu-devel] [PULL 00/37] Block layer patches, Peter Maydell, 2018/05/15