mirror of
https://github.com/qemu/qemu.git
synced 2024-11-27 05:43:47 +08:00
qemu-io: Use user_creatable_process_cmdline() for --object
This switches qemu-io from a QemuOpts-based parser for --object to user_creatable_process_cmdline() which uses a keyval parser and enforces the QAPI schema. Apart from being a cleanup, this makes non-scalar properties accessible. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
f375026606
commit
b3e79bc6f0
33
qemu-io.c
33
qemu-io.c
@ -477,23 +477,6 @@ enum {
|
|||||||
OPTION_IMAGE_OPTS = 257,
|
OPTION_IMAGE_OPTS = 257,
|
||||||
};
|
};
|
||||||
|
|
||||||
static QemuOptsList qemu_object_opts = {
|
|
||||||
.name = "object",
|
|
||||||
.implied_opt_name = "qom-type",
|
|
||||||
.head = QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head),
|
|
||||||
.desc = {
|
|
||||||
{ }
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool qemu_io_object_print_help(const char *type, QemuOpts *opts)
|
|
||||||
{
|
|
||||||
if (user_creatable_print_help(type, opts)) {
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QemuOptsList file_opts = {
|
static QemuOptsList file_opts = {
|
||||||
.name = "file",
|
.name = "file",
|
||||||
.implied_opt_name = "file",
|
.implied_opt_name = "file",
|
||||||
@ -550,7 +533,6 @@ int main(int argc, char **argv)
|
|||||||
qcrypto_init(&error_fatal);
|
qcrypto_init(&error_fatal);
|
||||||
|
|
||||||
module_call_init(MODULE_INIT_QOM);
|
module_call_init(MODULE_INIT_QOM);
|
||||||
qemu_add_opts(&qemu_object_opts);
|
|
||||||
qemu_add_opts(&qemu_trace_opts);
|
qemu_add_opts(&qemu_trace_opts);
|
||||||
bdrv_init();
|
bdrv_init();
|
||||||
|
|
||||||
@ -612,14 +594,9 @@ int main(int argc, char **argv)
|
|||||||
case 'U':
|
case 'U':
|
||||||
force_share = true;
|
force_share = true;
|
||||||
break;
|
break;
|
||||||
case OPTION_OBJECT: {
|
case OPTION_OBJECT:
|
||||||
QemuOpts *qopts;
|
user_creatable_process_cmdline(optarg);
|
||||||
qopts = qemu_opts_parse_noisily(&qemu_object_opts,
|
break;
|
||||||
optarg, true);
|
|
||||||
if (!qopts) {
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
case OPTION_IMAGE_OPTS:
|
case OPTION_IMAGE_OPTS:
|
||||||
imageOpts = true;
|
imageOpts = true;
|
||||||
break;
|
break;
|
||||||
@ -644,10 +621,6 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_opts_foreach(&qemu_object_opts,
|
|
||||||
user_creatable_add_opts_foreach,
|
|
||||||
qemu_io_object_print_help, &error_fatal);
|
|
||||||
|
|
||||||
if (!trace_init_backends()) {
|
if (!trace_init_backends()) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user