All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, armbru@redhat.com, dgilbert@redhat.com,
	pbonzini@redhat.com, marcandre.lureau@redhat.com
Subject: [PATCH 00/13] char: QAPIfy the command line parsing
Date: Thu, 12 Nov 2020 18:58:52 +0100	[thread overview]
Message-ID: <20201112175905.404472-1-kwolf@redhat.com> (raw)

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	other threads:[~2020-11-12 18:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 17:58 Kevin Wolf [this message]
2020-11-12 17:58 ` [PATCH 01/13] char: Factor out qemu_chr_print_types() Kevin Wolf
2020-11-12 17:58 ` [PATCH 02/13] char: Add ChardevOptions and qemu_chr_new_cli() Kevin Wolf
2020-11-12 17:58 ` [PATCH 03/13] char: Some QAPI aliases for CLI compatibility Kevin Wolf
2020-11-12 17:58 ` [PATCH 04/13] char: Add qemu_chr_translate_legacy_options() Kevin Wolf
2020-11-12 17:58 ` [PATCH 05/13] char-socket: Implement compat code for CLI QAPIfication Kevin Wolf
2020-11-12 17:58 ` [PATCH 06/13] char-udp: " Kevin Wolf
2020-11-12 17:58 ` [PATCH 07/13] char: Add qemu_chr_parse_cli_dict/str() Kevin Wolf
2020-11-12 17:59 ` [PATCH 08/13] char: Add mux option to ChardevOptions Kevin Wolf
2020-11-13 11:50   ` Paolo Bonzini
2020-11-13 13:20     ` Kevin Wolf
2020-11-13 14:16       ` Paolo Bonzini
2020-11-12 17:59 ` [PATCH 09/13] qemu-storage-daemon: QAPIfy --chardev Kevin Wolf
2020-11-12 17:59 ` [PATCH 10/13] char: Implement qemu_chr_new_from_opts() in terms of QAPI Kevin Wolf
2020-11-12 17:59 ` [PATCH 11/13] hmp/char: Use qemu_chr_parse_cli_str() for chardev-change Kevin Wolf
2020-11-13 18:44   ` Dr. David Alan Gilbert
2020-11-12 17:59 ` [PATCH 12/13] char: Remove qemu_chr_parse_opts() Kevin Wolf
2020-11-12 17:59 ` [PATCH 13/13] char: Remove ChardevClass.parse Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112175905.404472-1-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.