[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/13] qemu-storage-daemon: QAPIfy --chardev
|
From: |
Kevin Wolf |
|
Subject: |
[PATCH 09/13] qemu-storage-daemon: QAPIfy --chardev |
|
Date: |
Thu, 12 Nov 2020 18:59:01 +0100 |
Make use of the QAPIfied command line interface of the chardev
subsystem. With this, --chardev supports QMP-like syntax (i.e.
chardev-add mapped to the command line) as well as the legacy
syntax that it already supported and which is shared with the
system emulator.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
storage-daemon/qemu-storage-daemon.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/storage-daemon/qemu-storage-daemon.c
b/storage-daemon/qemu-storage-daemon.c
index e419ba9f19..149d08ad6d 100644
--- a/storage-daemon/qemu-storage-daemon.c
+++ b/storage-daemon/qemu-storage-daemon.c
@@ -128,8 +128,6 @@ enum {
OPTION_OBJECT,
};
-extern QemuOptsList qemu_chardev_opts;
-
static QemuOptsList qemu_object_opts = {
.name = "object",
.implied_opt_name = "qom-type",
@@ -207,18 +205,15 @@ static void process_options(int argc, char *argv[])
}
case OPTION_CHARDEV:
{
- /* TODO This interface is not stable until we QAPIfy it */
- QemuOpts *opts = qemu_opts_parse_noisily(&qemu_chardev_opts,
- optarg, true);
- if (opts == NULL) {
- exit(EXIT_FAILURE);
- }
+ ChardevOptions *options;
- if (!qemu_chr_new_from_opts(opts, NULL, &error_fatal)) {
- /* No error, but NULL returned means help was printed */
+ options = qemu_chr_parse_cli_str(optarg, &error_fatal);
+ if (!options) {
+ /* Help was printed */
exit(EXIT_SUCCESS);
}
- qemu_opts_del(opts);
+ qemu_chr_new_cli(options, &error_fatal);
+ qapi_free_ChardevOptions(options);
break;
}
case OPTION_EXPORT:
--
2.28.0
- [PATCH 03/13] char: Some QAPI aliases for CLI compatibility, (continued)
- [PATCH 03/13] char: Some QAPI aliases for CLI compatibility, Kevin Wolf, 2020/11/12
- [PATCH 02/13] char: Add ChardevOptions and qemu_chr_new_cli(), Kevin Wolf, 2020/11/12
- [PATCH 04/13] char: Add qemu_chr_translate_legacy_options(), Kevin Wolf, 2020/11/12
- [PATCH 05/13] char-socket: Implement compat code for CLI QAPIfication, Kevin Wolf, 2020/11/12
- [PATCH 06/13] char-udp: Implement compat code for CLI QAPIfication, Kevin Wolf, 2020/11/12
- [PATCH 07/13] char: Add qemu_chr_parse_cli_dict/str(), Kevin Wolf, 2020/11/12
- [PATCH 08/13] char: Add mux option to ChardevOptions, Kevin Wolf, 2020/11/12
- [PATCH 09/13] qemu-storage-daemon: QAPIfy --chardev,
Kevin Wolf <=
- [PATCH 10/13] char: Implement qemu_chr_new_from_opts() in terms of QAPI, Kevin Wolf, 2020/11/12
- [PATCH 11/13] hmp/char: Use qemu_chr_parse_cli_str() for chardev-change, Kevin Wolf, 2020/11/12
- [PATCH 12/13] char: Remove qemu_chr_parse_opts(), Kevin Wolf, 2020/11/12
- [PATCH 13/13] char: Remove ChardevClass.parse, Kevin Wolf, 2020/11/12