summaryrefslogtreecommitdiffstats
path: root/blockdev.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-03-03 01:28:54 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-03-03 01:28:54 +0000
commit5efde22aa781d37df58f0060430f459491dcfd62 (patch)
tree49fa5a0ded22f789863a85bc27e42d4165e442ec /blockdev.c
parent0856579cac2f1dacecd847cfcd89680d26ff78f5 (diff)
parentb3adf5acb57dee14a74e57ab4f16cd1a83e5a7d2 (diff)
downloadhqemu-5efde22aa781d37df58f0060430f459491dcfd62.zip
hqemu-5efde22aa781d37df58f0060430f459491dcfd62.tar.gz
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2015-02-26' into staging
QemuOpts: Convert various setters to Error # gpg: Signature made Thu Feb 26 13:56:43 2015 GMT using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-error-2015-02-26: qtest: Use qemu_opt_set() instead of qemu_opts_parse() pc: Use qemu_opt_set() instead of qemu_opts_parse() qemu-sockets: Simplify setting numeric and boolean options block: Simplify setting numeric options qemu-img: Suppress unhelpful extra errors in convert, amend QemuOpts: Propagate errors through opts_parse() QemuOpts: Propagate errors through opts_do_parse() QemuOpts: Drop qemu_opt_set(), rename qemu_opt_set_err(), fix use block: Suppress unhelpful extra errors in bdrv_img_create() qemu-img: Suppress unhelpful extra errors in convert, resize QemuOpts: Convert qemu_opts_set() to Error, fix its use QemuOpts: Convert qemu_opt_set_number() to Error, fix its use QemuOpts: Convert qemu_opt_set_bool() to Error, fix its use Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/blockdev.c b/blockdev.c
index ae73539..b9c1c0c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -180,21 +180,19 @@ QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
const char *optstr)
{
QemuOpts *opts;
- char buf[32];
opts = drive_def(optstr);
if (!opts) {
return NULL;
}
if (type != IF_DEFAULT) {
- qemu_opt_set(opts, "if", if_name[type]);
+ qemu_opt_set(opts, "if", if_name[type], &error_abort);
}
if (index >= 0) {
- snprintf(buf, sizeof(buf), "%d", index);
- qemu_opt_set(opts, "index", buf);
+ qemu_opt_set_number(opts, "index", index, &error_abort);
}
if (file)
- qemu_opt_set(opts, "file", file);
+ qemu_opt_set(opts, "file", file, &error_abort);
return opts;
}
@@ -584,7 +582,7 @@ static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to,
/* rename all items in opts */
while ((value = qemu_opt_get(opts, from))) {
- qemu_opt_set(opts, to, value);
+ qemu_opt_set(opts, to, value, &error_abort);
qemu_opt_unset(opts, from);
}
}
@@ -737,15 +735,15 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
/* Specific options take precedence */
if (!qemu_opt_get(all_opts, "cache.writeback")) {
qemu_opt_set_bool(all_opts, "cache.writeback",
- !!(flags & BDRV_O_CACHE_WB));
+ !!(flags & BDRV_O_CACHE_WB), &error_abort);
}
if (!qemu_opt_get(all_opts, "cache.direct")) {
qemu_opt_set_bool(all_opts, "cache.direct",
- !!(flags & BDRV_O_NOCACHE));
+ !!(flags & BDRV_O_NOCACHE), &error_abort);
}
if (!qemu_opt_get(all_opts, "cache.no-flush")) {
qemu_opt_set_bool(all_opts, "cache.no-flush",
- !!(flags & BDRV_O_NO_FLUSH));
+ !!(flags & BDRV_O_NO_FLUSH), &error_abort);
}
qemu_opt_unset(all_opts, "cache");
}
@@ -935,13 +933,14 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
devopts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
&error_abort);
if (arch_type == QEMU_ARCH_S390X) {
- qemu_opt_set(devopts, "driver", "virtio-blk-s390");
+ qemu_opt_set(devopts, "driver", "virtio-blk-s390", &error_abort);
} else {
- qemu_opt_set(devopts, "driver", "virtio-blk-pci");
+ qemu_opt_set(devopts, "driver", "virtio-blk-pci", &error_abort);
}
- qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"));
+ qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"),
+ &error_abort);
if (devaddr) {
- qemu_opt_set(devopts, "addr", devaddr);
+ qemu_opt_set(devopts, "addr", devaddr, &error_abort);
}
}
OpenPOWER on IntegriCloud