[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 34/38] qemu-nbd: Use user_creatable_process_cmdline() for --object
From: |
Kevin Wolf |
Subject: |
[PULL 34/38] qemu-nbd: Use user_creatable_process_cmdline() for --object |
Date: |
Thu, 11 Mar 2021 15:48:07 +0100 |
This switches qemu-nbd 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>
---
qemu-nbd.c | 34 +++-------------------------------
1 file changed, 3 insertions(+), 31 deletions(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c
index b1b9430a8f..93ef4e288f 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -401,24 +401,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)
{
@@ -594,7 +576,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]);
@@ -747,14 +728,9 @@ 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);
- }
- } break;
+ case QEMU_NBD_OPT_OBJECT:
+ user_creatable_process_cmdline(optarg);
+ break;
case QEMU_NBD_OPT_TLSCREDS:
tlscredsid = optarg;
break;
@@ -802,10 +778,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.29.2
- [PULL 22/38] qapi/qom: Add ObjectOptions for colo-compare, (continued)
- [PULL 22/38] qapi/qom: Add ObjectOptions for colo-compare, Kevin Wolf, 2021/03/11
- [PULL 27/38] qapi/qom: Add ObjectOptions for x-remote-object, Kevin Wolf, 2021/03/11
- [PULL 23/38] qapi/qom: Add ObjectOptions for filter-*, Kevin Wolf, 2021/03/11
- [PULL 29/38] qom: Make "object" QemuOptsList optional, Kevin Wolf, 2021/03/11
- [PULL 32/38] qom: Factor out user_creatable_process_cmdline(), Kevin Wolf, 2021/03/11
- [PULL 31/38] qom: Remove user_creatable_add_dict(), Kevin Wolf, 2021/03/11
- [PULL 25/38] qapi/qom: Add ObjectOptions for confidential-guest-support, Kevin Wolf, 2021/03/11
- [PULL 28/38] qapi/qom: QAPIfy object-add, Kevin Wolf, 2021/03/11
- [PULL 26/38] qapi/qom: Add ObjectOptions for input-*, Kevin Wolf, 2021/03/11
- [PULL 30/38] qemu-storage-daemon: Implement --object with qmp_object_add(), Kevin Wolf, 2021/03/11
- [PULL 34/38] qemu-nbd: Use user_creatable_process_cmdline() for --object,
Kevin Wolf <=
- [PULL 33/38] qemu-io: Use user_creatable_process_cmdline() for --object, Kevin Wolf, 2021/03/11
- [PULL 35/38] qom: Add user_creatable_add_from_str(), Kevin Wolf, 2021/03/11
- [PULL 38/38] qom: Add user_creatable_parse_str(), Kevin Wolf, 2021/03/11
- [PULL 37/38] hmp: QAPIfy object_add, Kevin Wolf, 2021/03/11
- [PULL 36/38] qemu-img: Use user_creatable_process_cmdline() for --object, Kevin Wolf, 2021/03/11
- Re: [PULL 00/38] Block layer patches and object-add QAPIfication, Peter Maydell, 2021/03/12