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>
This commit is contained in:
Markus Armbruster 2015-02-12 16:37:44 +01:00
parent c5c6d7f81a
commit cccb7967bd
6 changed files with 19 additions and 18 deletions

5
vl.c
View file

@ -2222,7 +2222,7 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty)
}
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 @@ int main(int argc, char **argv, char **envp)
}
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");