qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 00/13] char: QAPIfy the command line parsing


From: Kevin Wolf
Subject: [PATCH 00/13] char: QAPIfy the command line parsing
Date: Thu, 12 Nov 2020 18:58:52 +0100

The character device subsystem is special in that it uses QAPI objects
(ChardevBackend) internally to configure the backends, but for mapping
the command line to it, instead of making use of QAPI visitors, it uses
a hand-crafted parser. At the same time, the QMP command chardev-add
obviously does use the QAPI parser.

This is nasty because there is nothing that will make sure that the two
parsers provide access to the same feature set or that the syntax to
access features is consistent. We have also seen patches that changed
things for one path, but forgot that the other one needed to be changed,
too, resulting in regressions.

In order to solve this problem and make consistency between both paths
automatic, this series removes the hand-crafted parser that goes from
QemuOpts to ChardevBackend. Instead, QAPI aliases and only a few manual
tweaks of the input are used to make a keyval parser and QAPI visitors
suitable for parsing command lines while retaining backwards
compatibility.

As a welcome side effect, this also makes features available on the
command line that were previously restricted to QMP.

Another welcome side effect is the diffstat. :-)

QemuOpts is not entirely removed from the chardev interfaces yet. This
is mostly because -readconfig still uses it and changing vl.c to work
with a mix of QAPI object and QemuOpts would be harder than just keeping
some QemuOpts based interfaces that just internally translate. This can
be addressed after -readconfig has been reworked (probably resulting in
another nice diffstat).

A git tag is available that contains this series and its prerequisites:

    https://repo.or.cz/qemu/kevin.git qapi-alias-chardev-v1

Based-on: 20201111130834.33985-1-kwolf@redhat.com
('[PATCH 0/2] char: Deprecate backend aliases')

Based-on: 20201112172850.401925-1-kwolf@redhat.com
('[PATCH 0/6] qapi: Add support for aliases')

Kevin Wolf (13):
  char: Factor out qemu_chr_print_types()
  char: Add ChardevOptions and qemu_chr_new_cli()
  char: Some QAPI aliases for CLI compatibility
  char: Add qemu_chr_translate_legacy_options()
  char-socket: Implement compat code for CLI QAPIfication
  char-udp: Implement compat code for CLI QAPIfication
  char: Add qemu_chr_parse_cli_dict/str()
  char: Add mux option to ChardevOptions
  qemu-storage-daemon: QAPIfy --chardev
  char: Implement qemu_chr_new_from_opts() in terms of QAPI
  hmp/char: Use qemu_chr_parse_cli_str() for chardev-change
  char: Remove qemu_chr_parse_opts()
  char: Remove ChardevClass.parse

 qapi/char.json                       |  42 ++++-
 qapi/sockets.json                    |   6 +-
 include/chardev/char.h               |  56 ++++--
 chardev/char-file.c                  |  20 --
 chardev/char-mux.c                   |  17 --
 chardev/char-parallel.c              |  17 --
 chardev/char-pipe.c                  |  17 --
 chardev/char-ringbuf.c               |  18 --
 chardev/char-serial.c                |  17 --
 chardev/char-socket.c                | 121 +++++--------
 chardev/char-stdio.c                 |  13 --
 chardev/char-udp.c                   |  79 +++-----
 chardev/char.c                       | 262 ++++++++++++++++-----------
 chardev/spice.c                      |  34 ----
 monitor/hmp-cmds.c                   |  27 +--
 storage-daemon/qemu-storage-daemon.c |  17 +-
 ui/console.c                         |  35 ----
 ui/gtk.c                             |   1 -
 ui/spice-app.c                       |   1 -
 19 files changed, 321 insertions(+), 479 deletions(-)

-- 
2.28.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]