Enable creation of object with non-scalar properties. Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- qemu-nbd.c | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c index a7075c5419..b4bd21a21e 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -407,23 +407,6 @@ static QemuOptsList file_opts = { }, }; -static QemuOptsList qemu_object_opts = { - .name = "object", - .implied_opt_name = "qom-type", - .head = QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head), - .desc = { - { } - }, -}; - -static bool qemu_nbd_object_print_help(const char *type, QemuOpts *opts) -{ - if (user_creatable_print_help(type, opts)) { - exit(0); - } - return true; -} - static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, bool list, Error **errp) @@ -599,7 +582,6 @@ int main(int argc, char **argv) qcrypto_init(&error_fatal); module_call_init(MODULE_INIT_QOM); - qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_trace_opts); qemu_init_exec_dir(argv[0]); @@ -752,14 +734,20 @@ int main(int argc, char **argv) case '?': error_report("Try `%s --help' for more information.", argv[0]); exit(EXIT_FAILURE); - case QEMU_NBD_OPT_OBJECT: { - QemuOpts *opts; - opts = qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - exit(EXIT_FAILURE); + case QEMU_NBD_OPT_OBJECT: + { + QDict *args; + bool help; + + args = keyval_parse(optarg, "qom-type", &help, &error_fatal); + if (help) { + user_creatable_print_help_from_qdict(args); + exit(EXIT_SUCCESS); + } + user_creatable_add_dict(args, true, &error_fatal); + qobject_unref(args); + break; } - } break; case QEMU_NBD_OPT_TLSCREDS: tlscredsid = optarg; break; @@ -807,10 +795,6 @@ int main(int argc, char **argv) export_name = ""; } - qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_nbd_object_print_help, &error_fatal); - if (!trace_init_backends()) { exit(1); } -- 2.26.2