QemuOpts: Wean off qerror_report_err()

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.

The only remaining user in qemu-option.c is qemu_opts_parse().  Is it
used in QMP context?  If not, we can simply replace
qerror_report_err() by error_report_err().

The uses in qemu-img.c, qemu-io.c, qemu-nbd.c and under tests/ are
clearly not in QMP context.

The uses in vl.c aren't either, because the only QMP command handlers
there are qmp_query_status() and qmp_query_machines(), and they don't
call it.

Remaining uses:

* drive_def(): Command line -drive and such, HMP drive_add and pci_add

* hmp_chardev_add(): HMP chardev-add

* monitor_parse_command(): HMP core

* tmp_config_parse(): Command line -tpmdev

* net_host_device_add(): HMP host_net_add

* net_client_parse(): Command line -net and -netdev

* qemu_global_option(): Command line -global

* vnc_parse_func(): Command line -display, -vnc, default display, HMP
  change, QMP change.  Bummer.

* qemu_pci_hot_add_nic(): HMP pci_add

* usb_net_init(): Command line -usbdevice, HMP usb_add

Propagate errors through qemu_opts_parse().  Create a convenience
function qemu_opts_parse_noisily() that passes errors to
error_report_err().  Switch all non-QMP users outside tests to it.

That leaves vnc_parse_func().  Propagate errors through it.  Since I'm
touching it anyway, rename it to vnc_parse().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
master
Markus Armbruster 2015-02-13 12:50:26 +01:00
parent f006cf7fa9
commit 70b9433109
18 changed files with 109 additions and 62 deletions

View File

@ -174,7 +174,7 @@ static int drive_index_to_unit_id(BlockInterfaceType type, int index)
QemuOpts *drive_def(const char *optstr) QemuOpts *drive_def(const char *optstr)
{ {
return qemu_opts_parse(qemu_find_opts("drive"), optstr, 0); return qemu_opts_parse_noisily(qemu_find_opts("drive"), optstr, false);
} }
QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file, QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,

2
hmp.c
View File

@ -1839,7 +1839,7 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict)
Error *err = NULL; Error *err = NULL;
QemuOpts *opts; QemuOpts *opts;
opts = qemu_opts_parse(qemu_find_opts("chardev"), args, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("chardev"), args, true);
if (opts == NULL) { if (opts == NULL) {
error_setg(&err, "Parsing chardev args failed"); error_setg(&err, "Parsing chardev args failed");
} else { } else {

View File

@ -1397,7 +1397,7 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline)
QemuOpts *opts; QemuOpts *opts;
int idx; int idx;
opts = qemu_opts_parse(qemu_find_opts("net"), cmdline, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("net"), cmdline, false);
if (!opts) { if (!opts) {
return NULL; return NULL;
} }

View File

@ -119,7 +119,10 @@ void qemu_opts_del(QemuOpts *opts);
void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp); void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp);
void qemu_opts_do_parse(QemuOpts *opts, const char *params, void qemu_opts_do_parse(QemuOpts *opts, const char *params,
const char *firstname, Error **errp); const char *firstname, Error **errp);
QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, int permit_abbrev); QemuOpts *qemu_opts_parse_noisily(QemuOptsList *list, const char *params,
bool permit_abbrev);
QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params,
bool permit_abbrev, Error **errp);
void qemu_opts_set_defaults(QemuOptsList *list, const char *params, void qemu_opts_set_defaults(QemuOptsList *list, const char *params,
int permit_abbrev); int permit_abbrev);
QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict, QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,

View File

@ -369,7 +369,7 @@ char *vnc_display_local_addr(const char *id);
#ifdef CONFIG_VNC #ifdef CONFIG_VNC
int vnc_display_password(const char *id, const char *password); int vnc_display_password(const char *id, const char *password);
int vnc_display_pw_expire(const char *id, time_t expires); int vnc_display_pw_expire(const char *id, time_t expires);
QemuOpts *vnc_parse_func(const char *str); QemuOpts *vnc_parse(const char *str, Error **errp);
int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp); int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
#else #else
static inline int vnc_display_password(const char *id, const char *password) static inline int vnc_display_password(const char *id, const char *password)

View File

@ -3749,7 +3749,7 @@ static QDict *monitor_parse_arguments(Monitor *mon,
if (get_str(buf, sizeof(buf), &p) < 0) { if (get_str(buf, sizeof(buf), &p) < 0) {
goto fail; goto fail;
} }
opts = qemu_opts_parse(opts_list, buf, 1); opts = qemu_opts_parse_noisily(opts_list, buf, true);
if (!opts) { if (!opts) {
goto fail; goto fail;
} }

View File

@ -1049,7 +1049,8 @@ void hmp_host_net_add(Monitor *mon, const QDict *qdict)
return; return;
} }
opts = qemu_opts_parse(qemu_find_opts("net"), opts_str ? opts_str : "", 0); opts = qemu_opts_parse_noisily(qemu_find_opts("net"),
opts_str ? opts_str : "", false);
if (!opts) { if (!opts) {
return; return;
} }
@ -1412,7 +1413,7 @@ int net_client_parse(QemuOptsList *opts_list, const char *optarg)
} }
#endif #endif
if (!qemu_opts_parse(opts_list, optarg, 1)) { if (!qemu_opts_parse_noisily(opts_list, optarg, true)) {
return -1; return -1;
} }

View File

@ -853,7 +853,7 @@ int qemu_global_option(const char *str)
return 0; return 0;
} }
opts = qemu_opts_parse(&qemu_global_opts, str, false); opts = qemu_opts_parse_noisily(&qemu_global_opts, str, false);
if (!opts) { if (!opts) {
return -1; return -1;
} }

View File

@ -1590,7 +1590,8 @@ static int img_convert(int argc, char **argv)
break; break;
case 'l': case 'l':
if (strstart(optarg, SNAPSHOT_OPT_BASE, NULL)) { if (strstart(optarg, SNAPSHOT_OPT_BASE, NULL)) {
sn_opts = qemu_opts_parse(&internal_snapshot_opts, optarg, 0); sn_opts = qemu_opts_parse_noisily(&internal_snapshot_opts,
optarg, false);
if (!sn_opts) { if (!sn_opts) {
error_report("Failed in parsing snapshot param '%s'", error_report("Failed in parsing snapshot param '%s'",
optarg); optarg);

View File

@ -153,7 +153,7 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
readonly = 1; readonly = 1;
break; break;
case 'o': case 'o':
if (!qemu_opts_parse(&empty_opts, optarg, 0)) { if (!qemu_opts_parse_noisily(&empty_opts, optarg, false)) {
printf("could not parse option list -- %s\n", optarg); printf("could not parse option list -- %s\n", optarg);
qemu_opts_reset(&empty_opts); qemu_opts_reset(&empty_opts);
return 0; return 0;

View File

@ -549,7 +549,8 @@ int main(int argc, char **argv)
break; break;
case 'l': case 'l':
if (strstart(optarg, SNAPSHOT_OPT_BASE, NULL)) { if (strstart(optarg, SNAPSHOT_OPT_BASE, NULL)) {
sn_opts = qemu_opts_parse(&internal_snapshot_opts, optarg, 0); sn_opts = qemu_opts_parse_noisily(&internal_snapshot_opts,
optarg, false);
if (!sn_opts) { if (!sn_opts) {
errx(EXIT_FAILURE, "Failed in parsing snapshot param `%s'", errx(EXIT_FAILURE, "Failed in parsing snapshot param `%s'",
optarg); optarg);

2
qmp.c
View File

@ -387,7 +387,7 @@ static void qmp_change_vnc_listen(const char *target, Error **errp)
if (opts) { if (opts) {
qemu_opts_del(opts); qemu_opts_del(opts);
} }
opts = vnc_parse_func(target); opts = vnc_parse(target, errp);
if (!opts) { if (!opts) {
return; return;
} }

View File

@ -39,7 +39,8 @@ setup_fixture(OptsVisitorFixture *f, gconstpointer test_data)
QemuOpts *opts; QemuOpts *opts;
OptsVisitor *ov; OptsVisitor *ov;
opts = qemu_opts_parse(qemu_find_opts("userdef"), opts_string, 0); opts = qemu_opts_parse(qemu_find_opts("userdef"), opts_string, false,
NULL);
g_assert(opts != NULL); g_assert(opts != NULL);
ov = opts_visitor_new(opts); ov = opts_visitor_new(opts);

View File

@ -323,7 +323,7 @@ static void test_qemu_opt_unset(void)
int ret; int ret;
/* dynamically initialized (parsed) opts */ /* dynamically initialized (parsed) opts */
opts = qemu_opts_parse(&opts_list_03, "key=value", 0); opts = qemu_opts_parse(&opts_list_03, "key=value", false, NULL);
g_assert(opts != NULL); g_assert(opts != NULL);
/* check default/parsed value */ /* check default/parsed value */

2
tpm.c
View File

@ -228,7 +228,7 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
tpm_display_backend_drivers(); tpm_display_backend_drivers();
return -1; return -1;
} }
opts = qemu_opts_parse(opts_list, optarg, 1); opts = qemu_opts_parse_noisily(opts_list, optarg, true);
if (!opts) { if (!opts) {
return -1; return -1;
} }

View File

@ -3749,10 +3749,10 @@ static void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts)
qemu_opts_set_id(opts, id); qemu_opts_set_id(opts, id);
} }
QemuOpts *vnc_parse_func(const char *str) QemuOpts *vnc_parse(const char *str, Error **errp)
{ {
QemuOptsList *olist = qemu_find_opts("vnc"); QemuOptsList *olist = qemu_find_opts("vnc");
QemuOpts *opts = qemu_opts_parse(olist, str, 1); QemuOpts *opts = qemu_opts_parse(olist, str, true, errp);
const char *id; const char *id;
if (!opts) { if (!opts) {

View File

@ -820,7 +820,7 @@ void qemu_opts_do_parse(QemuOpts *opts, const char *params,
} }
static QemuOpts *opts_parse(QemuOptsList *list, const char *params, static QemuOpts *opts_parse(QemuOptsList *list, const char *params,
int permit_abbrev, bool defaults, Error **errp) bool permit_abbrev, bool defaults, Error **errp)
{ {
const char *firstname; const char *firstname;
char value[1024], *id = NULL; char value[1024], *id = NULL;
@ -867,19 +867,32 @@ static QemuOpts *opts_parse(QemuOptsList *list, const char *params,
* Create a QemuOpts in @list and with options parsed from @params. * Create a QemuOpts in @list and with options parsed from @params.
* If @permit_abbrev, the first key=value in @params may omit key=, * If @permit_abbrev, the first key=value in @params may omit key=,
* and is treated as if key was @list->implied_opt_name. * and is treated as if key was @list->implied_opt_name.
* Report errors with qerror_report_err(). * On error, store an error object through @errp if non-null.
* Return the new QemuOpts on success, null pointer on error. * Return the new QemuOpts on success, null pointer on error.
*/ */
QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params,
int permit_abbrev) bool permit_abbrev, Error **errp)
{
return opts_parse(list, params, permit_abbrev, false, errp);
}
/**
* Create a QemuOpts in @list and with options parsed from @params.
* If @permit_abbrev, the first key=value in @params may omit key=,
* and is treated as if key was @list->implied_opt_name.
* Report errors with error_report_err(). This is inappropriate in
* QMP context. Do not use this function there!
* Return the new QemuOpts on success, null pointer on error.
*/
QemuOpts *qemu_opts_parse_noisily(QemuOptsList *list, const char *params,
bool permit_abbrev)
{ {
Error *err = NULL; Error *err = NULL;
QemuOpts *opts; QemuOpts *opts;
opts = opts_parse(list, params, permit_abbrev, false, &err); opts = opts_parse(list, params, permit_abbrev, false, &err);
if (!opts) { if (err) {
qerror_report_err(err); error_report_err(err);
error_free(err);
} }
return opts; return opts;
} }

103
vl.c
View File

@ -2046,6 +2046,7 @@ static void select_vgahw (const char *p)
static DisplayType select_display(const char *p) static DisplayType select_display(const char *p)
{ {
Error *err = NULL;
const char *opts; const char *opts;
DisplayType display = DT_DEFAULT; DisplayType display = DT_DEFAULT;
@ -2114,7 +2115,8 @@ static DisplayType select_display(const char *p)
} else if (strstart(p, "vnc", &opts)) { } else if (strstart(p, "vnc", &opts)) {
#ifdef CONFIG_VNC #ifdef CONFIG_VNC
if (*opts == '=') { if (*opts == '=') {
if (vnc_parse_func(opts+1) == NULL) { if (vnc_parse(opts + 1, &err) == NULL) {
error_report_err(err);
exit(1); exit(1);
} }
} else { } else {
@ -2188,7 +2190,8 @@ static int balloon_parse(const char *arg)
if (!strncmp(arg, "virtio", 6)) { if (!strncmp(arg, "virtio", 6)) {
if (arg[6] == ',') { if (arg[6] == ',') {
/* have params -> parse them */ /* have params -> parse them */
opts = qemu_opts_parse(qemu_find_opts("device"), arg+7, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("device"), arg + 7,
false);
if (!opts) if (!opts)
return -1; return -1;
} else { } else {
@ -3067,7 +3070,7 @@ int main(int argc, char **argv, char **envp)
switch(popt->index) { switch(popt->index) {
case QEMU_OPTION_no_kvm_irqchip: { case QEMU_OPTION_no_kvm_irqchip: {
olist = qemu_find_opts("machine"); olist = qemu_find_opts("machine");
qemu_opts_parse(olist, "kernel_irqchip=off", 0); qemu_opts_parse_noisily(olist, "kernel_irqchip=off", false);
break; break;
} }
case QEMU_OPTION_cpu: case QEMU_OPTION_cpu:
@ -3184,7 +3187,8 @@ int main(int argc, char **argv, char **envp)
} }
break; break;
case QEMU_OPTION_numa: case QEMU_OPTION_numa:
opts = qemu_opts_parse(qemu_find_opts("numa"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("numa"),
optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3235,7 +3239,8 @@ int main(int argc, char **argv, char **envp)
drive_add(IF_DEFAULT, 2, optarg, CDROM_OPTS); drive_add(IF_DEFAULT, 2, optarg, CDROM_OPTS);
break; break;
case QEMU_OPTION_boot: case QEMU_OPTION_boot:
opts = qemu_opts_parse(qemu_find_opts("boot-opts"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("boot-opts"),
optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3260,7 +3265,8 @@ int main(int argc, char **argv, char **envp)
break; break;
#ifdef CONFIG_LIBISCSI #ifdef CONFIG_LIBISCSI
case QEMU_OPTION_iscsi: case QEMU_OPTION_iscsi:
opts = qemu_opts_parse(qemu_find_opts("iscsi"), optarg, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("iscsi"),
optarg, false);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3296,8 +3302,8 @@ int main(int argc, char **argv, char **envp)
exit(0); exit(0);
break; break;
case QEMU_OPTION_m: case QEMU_OPTION_m:
opts = qemu_opts_parse(qemu_find_opts("memory"), opts = qemu_opts_parse_noisily(qemu_find_opts("memory"),
optarg, 1); optarg, true);
if (!opts) { if (!opts) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -3409,14 +3415,16 @@ int main(int argc, char **argv, char **envp)
default_monitor = 0; default_monitor = 0;
break; break;
case QEMU_OPTION_mon: case QEMU_OPTION_mon:
opts = qemu_opts_parse(qemu_find_opts("mon"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("mon"), optarg,
true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
default_monitor = 0; default_monitor = 0;
break; break;
case QEMU_OPTION_chardev: case QEMU_OPTION_chardev:
opts = qemu_opts_parse(qemu_find_opts("chardev"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("chardev"),
optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3427,7 +3435,7 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "fsdev is not supported by this qemu build.\n"); fprintf(stderr, "fsdev is not supported by this qemu build.\n");
exit(1); exit(1);
} }
opts = qemu_opts_parse(olist, optarg, 1); opts = qemu_opts_parse_noisily(olist, optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3442,7 +3450,7 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "virtfs is not supported by this qemu build.\n"); fprintf(stderr, "virtfs is not supported by this qemu build.\n");
exit(1); exit(1);
} }
opts = qemu_opts_parse(olist, optarg, 1); opts = qemu_opts_parse_noisily(olist, optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3602,40 +3610,43 @@ int main(int argc, char **argv, char **envp)
break; break;
} }
case QEMU_OPTION_acpitable: case QEMU_OPTION_acpitable:
opts = qemu_opts_parse(qemu_find_opts("acpi"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("acpi"),
optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
do_acpitable_option(opts); do_acpitable_option(opts);
break; break;
case QEMU_OPTION_smbios: case QEMU_OPTION_smbios:
opts = qemu_opts_parse(qemu_find_opts("smbios"), optarg, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("smbios"),
optarg, false);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
do_smbios_option(opts); do_smbios_option(opts);
break; break;
case QEMU_OPTION_fwcfg: case QEMU_OPTION_fwcfg:
opts = qemu_opts_parse(qemu_find_opts("fw_cfg"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("fw_cfg"),
optarg, true);
if (opts == NULL) { if (opts == NULL) {
exit(1); exit(1);
} }
break; break;
case QEMU_OPTION_enable_kvm: case QEMU_OPTION_enable_kvm:
olist = qemu_find_opts("machine"); olist = qemu_find_opts("machine");
qemu_opts_parse(olist, "accel=kvm", 0); qemu_opts_parse_noisily(olist, "accel=kvm", false);
break; break;
case QEMU_OPTION_M: case QEMU_OPTION_M:
case QEMU_OPTION_machine: case QEMU_OPTION_machine:
olist = qemu_find_opts("machine"); olist = qemu_find_opts("machine");
opts = qemu_opts_parse(olist, optarg, 1); opts = qemu_opts_parse_noisily(olist, optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
break; break;
case QEMU_OPTION_no_kvm: case QEMU_OPTION_no_kvm:
olist = qemu_find_opts("machine"); olist = qemu_find_opts("machine");
qemu_opts_parse(olist, "accel=tcg", 0); qemu_opts_parse_noisily(olist, "accel=tcg", false);
break; break;
case QEMU_OPTION_no_kvm_pit: { case QEMU_OPTION_no_kvm_pit: {
fprintf(stderr, "Warning: KVM PIT can no longer be disabled " fprintf(stderr, "Warning: KVM PIT can no longer be disabled "
@ -3659,26 +3670,32 @@ int main(int argc, char **argv, char **envp)
} }
case QEMU_OPTION_usb: case QEMU_OPTION_usb:
olist = qemu_find_opts("machine"); olist = qemu_find_opts("machine");
qemu_opts_parse(olist, "usb=on", 0); qemu_opts_parse_noisily(olist, "usb=on", false);
break; break;
case QEMU_OPTION_usbdevice: case QEMU_OPTION_usbdevice:
olist = qemu_find_opts("machine"); olist = qemu_find_opts("machine");
qemu_opts_parse(olist, "usb=on", 0); qemu_opts_parse_noisily(olist, "usb=on", false);
add_device_config(DEV_USB, optarg); add_device_config(DEV_USB, optarg);
break; break;
case QEMU_OPTION_device: case QEMU_OPTION_device:
if (!qemu_opts_parse(qemu_find_opts("device"), optarg, 1)) { if (!qemu_opts_parse_noisily(qemu_find_opts("device"),
optarg, true)) {
exit(1); exit(1);
} }
break; break;
case QEMU_OPTION_smp: case QEMU_OPTION_smp:
if (!qemu_opts_parse(qemu_find_opts("smp-opts"), optarg, 1)) { if (!qemu_opts_parse_noisily(qemu_find_opts("smp-opts"),
optarg, true)) {
exit(1); exit(1);
} }
break; break;
case QEMU_OPTION_vnc: case QEMU_OPTION_vnc:
{
#ifdef CONFIG_VNC #ifdef CONFIG_VNC
if (vnc_parse_func(optarg) == NULL) { Error *local_err = NULL;
if (vnc_parse(optarg, &local_err) == NULL) {
error_report_err(local_err);
exit(1); exit(1);
} }
#else #else
@ -3686,6 +3703,7 @@ int main(int argc, char **argv, char **envp)
exit(1); exit(1);
#endif #endif
break; break;
}
case QEMU_OPTION_no_acpi: case QEMU_OPTION_no_acpi:
acpi_enabled = 0; acpi_enabled = 0;
break; break;
@ -3720,7 +3738,8 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "Too many option ROMs\n"); fprintf(stderr, "Too many option ROMs\n");
exit(1); exit(1);
} }
opts = qemu_opts_parse(qemu_find_opts("option-rom"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("option-rom"),
optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3739,8 +3758,8 @@ int main(int argc, char **argv, char **envp)
break; break;
case QEMU_OPTION_semihosting_config: case QEMU_OPTION_semihosting_config:
semihosting.enabled = true; semihosting.enabled = true;
opts = qemu_opts_parse(qemu_find_opts("semihosting-config"), opts = qemu_opts_parse_noisily(qemu_find_opts("semihosting-config"),
optarg, 0); optarg, false);
if (opts != NULL) { if (opts != NULL) {
semihosting.enabled = qemu_opt_get_bool(opts, "enable", semihosting.enabled = qemu_opt_get_bool(opts, "enable",
true); true);
@ -3775,7 +3794,8 @@ int main(int argc, char **argv, char **envp)
"is no longer supported.\n"); "is no longer supported.\n");
break; break;
case QEMU_OPTION_name: case QEMU_OPTION_name:
opts = qemu_opts_parse(qemu_find_opts("name"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("name"),
optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3800,7 +3820,8 @@ int main(int argc, char **argv, char **envp)
configure_rtc_date_offset(optarg, 1); configure_rtc_date_offset(optarg, 1);
break; break;
case QEMU_OPTION_rtc: case QEMU_OPTION_rtc:
opts = qemu_opts_parse(qemu_find_opts("rtc"), optarg, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("rtc"), optarg,
false);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3813,8 +3834,8 @@ int main(int argc, char **argv, char **envp)
} }
break; break;
case QEMU_OPTION_icount: case QEMU_OPTION_icount:
icount_opts = qemu_opts_parse(qemu_find_opts("icount"), icount_opts = qemu_opts_parse_noisily(qemu_find_opts("icount"),
optarg, 1); optarg, true);
if (!icount_opts) { if (!icount_opts) {
exit(1); exit(1);
} }
@ -3851,7 +3872,8 @@ int main(int argc, char **argv, char **envp)
break; break;
case QEMU_OPTION_trace: case QEMU_OPTION_trace:
{ {
opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("trace"),
optarg, false);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3875,7 +3897,7 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "spice is not supported by this qemu build.\n"); fprintf(stderr, "spice is not supported by this qemu build.\n");
exit(1); exit(1);
} }
opts = qemu_opts_parse(olist, optarg, 0); opts = qemu_opts_parse_noisily(olist, optarg, false);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3906,14 +3928,16 @@ int main(int argc, char **argv, char **envp)
qtest_log = optarg; qtest_log = optarg;
break; break;
case QEMU_OPTION_sandbox: case QEMU_OPTION_sandbox:
opts = qemu_opts_parse(qemu_find_opts("sandbox"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("sandbox"),
optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
break; break;
case QEMU_OPTION_add_fd: case QEMU_OPTION_add_fd:
#ifndef _WIN32 #ifndef _WIN32
opts = qemu_opts_parse(qemu_find_opts("add-fd"), optarg, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("add-fd"),
optarg, false);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -3924,20 +3948,23 @@ int main(int argc, char **argv, char **envp)
#endif #endif
break; break;
case QEMU_OPTION_object: case QEMU_OPTION_object:
opts = qemu_opts_parse(qemu_find_opts("object"), optarg, 1); opts = qemu_opts_parse_noisily(qemu_find_opts("object"),
optarg, true);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
break; break;
case QEMU_OPTION_realtime: case QEMU_OPTION_realtime:
opts = qemu_opts_parse(qemu_find_opts("realtime"), optarg, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("realtime"),
optarg, false);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
enable_mlock = qemu_opt_get_bool(opts, "mlock", true); enable_mlock = qemu_opt_get_bool(opts, "mlock", true);
break; break;
case QEMU_OPTION_msg: case QEMU_OPTION_msg:
opts = qemu_opts_parse(qemu_find_opts("msg"), optarg, 0); opts = qemu_opts_parse_noisily(qemu_find_opts("msg"), optarg,
false);
if (!opts) { if (!opts) {
exit(1); exit(1);
} }
@ -4189,7 +4216,7 @@ int main(int argc, char **argv, char **envp)
#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA) #elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
display_type = DT_SDL; display_type = DT_SDL;
#elif defined(CONFIG_VNC) #elif defined(CONFIG_VNC)
vnc_parse_func("localhost:0,to=99,id=default"); vnc_parse("localhost:0,to=99,id=default", &error_abort);
show_vnc_port = 1; show_vnc_port = 1;
#else #else
display_type = DT_NONE; display_type = DT_NONE;