Skip to content

char: QAPIfy the command line parsing

Kevin Wolf qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13char: Factor out qemu_chr_print_types()chardev/char.c include/chardev/char.h+11 -60 replies
2/13char: Add ChardevOptions and qemu_chr_new_cli()chardev/char.c include/chardev/char.h qapi/char.json+42 -60 replies
3/13char: Some QAPI aliases for CLI compatibilityqapi/char.json+10 -50 replies
4/13char: Add qemu_chr_translate_legacy_options()chardev/char.c include/chardev/char.h+36 -00 replies
5/13char-socket: Implement compat code for CLI QAPIficationchardev/char-socket.c chardev/char.c include/chardev/char.h +2 more+70 -30 replies
6/13char-udp: Implement compat code for CLI QAPIficationchardev/char-udp.c chardev/char.c qapi/char.json+39 -20 replies
7/13char: Add qemu_chr_parse_cli_dict/str()chardev/char.c include/chardev/char.h+75 -00 replies
8/13char: Add mux option to ChardevOptionschardev/char.c qapi/char.json+38 -73 replies
9/13qemu-storage-daemon: QAPIfy --chardevstorage-daemon/qemu-storage-daemon.c+6 -110 replies
10/13char: Implement qemu_chr_new_from_opts() in terms of QAPIchardev/char.c+45 -710 replies
11/13hmp/char: Use qemu_chr_parse_cli_str() for chardev-changemonitor/hmp-cmds.c+9 -181 reply
12/13char: Remove qemu_chr_parse_opts()chardev/char.c include/chardev/char.h+0 -470 replies
13/13char: Remove ChardevClass.parsechardev/char-file.c chardev/char-mux.c chardev/char-parallel.c +12 more+0 -3630 replies

Reviews trailers per patch

2 of 13 patches have a Reviewed-by or Acked-by.

PatchMarc-André LureauMarkus ArmbrusterDr. David Alan Gilbert
1/13R-b R-b
2/13
3/13
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13A-b
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

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

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: [email protected]
('[PATCH 0/2] char: Deprecate backend aliases')

Based-on: [email protected] ('[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(-)
Signature · 1 line
2.28.0