QemuOpts: Convert qemu_opt_set_bool() to Error, fix its use
Return the Error object instead of reporting it with
qerror_report_err().
Change callers that assume the function can't fail to pass
&error_abort, so that should the assumption ever break, it'll break
noisily.
Turns out all callers outside its unit test assume that. We could
drop the Error ** argument, but that would make the interface less
regular, so don't.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/vl.c b/vl.c
index e1ffd0a..27e738a 100644
--- a/vl.c
+++ b/vl.c
@@ -2222,7 +2222,7 @@
}
qemu_opt_set(opts, "mode", mode);
qemu_opt_set(opts, "chardev", label);
- qemu_opt_set_bool(opts, "pretty", pretty);
+ qemu_opt_set_bool(opts, "pretty", pretty, &error_abort);
if (def)
qemu_opt_set(opts, "default", "on");
monitor_device_index++;
@@ -3287,7 +3287,8 @@
}
qemu_opt_set_bool(fsdev, "readonly",
- qemu_opt_get_bool(opts, "readonly", 0));
+ qemu_opt_get_bool(opts, "readonly", 0),
+ &error_abort);
device = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
&error_abort);
qemu_opt_set(device, "driver", "virtio-9p-pci");