From: Fabiano Rosas <farosas@suse.de>
To: qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>
Subject: [PATCH v2 00/11] qemu-options: Spring cleanup
Date: Wed, 30 Sep 2026 19:10:54 -0300 [thread overview]
Message-ID: <20260930221105.2262063-1-farosas@suse.de> (raw)
Remove support for command-line option parameters without values. Only
key=val from now on. However, keep 'help' without a value.
Stop passing around pointers to booleans. This is mostly due to the
handling of 'help'. In the process, fix 'help=foo' which is currently
accepted.
Cleanup the arguments of qemu_opts_parse* (due to the above, but also)
to stop passing in the return of qemu_opts_find() as first argument,
which can return NULL and lead to segfault. Add _parse_list and
_parse_list_noisily versions to keep things clear.
Replace instances of the _parse_*noisily functions with the
non-noisily variant wherever possible.
CI run: https://gitlab.com/farosas/qemu/-/pipelines/2897412802
Thanks!
---
RFC:
https://lore.kernel.org/r/20260918223002.1892021-1-farosas@suse.de
The call chain around qemu_opts_parse() is a bit convoluted. The main
issues are:
- It's split in two versions, one that uses Error and another that
prints messages directly.
- Callers sometimes fetch the QemuOptsList with qemu_opts_find()
before calling into qemu_opts_parse, sometimes a list is already
available.
- The printing of help options, warnings and errors is done at
different levels, passing booleans and pointers to booleans around
to get the information at the right place.
- It can't always handle a NULL list (segfaults).
https://lore.kernel.org/r/20260915134412.4187164-1-farosas@suse.de
This series attempts to make it simpler by:
- Merging the code into a single function with wrappers taking either
QemuOpts or QemuOptsList;
- Removing a couple of function arguments by always setting the Error
at the leaf level and letting the callers decide what to do with it.
Plain refactoring, no functional change intended.
CI run: https://gitlab.com/farosas/qemu/-/pipelines/2862893421
Fabiano Rosas (11):
qemu-option: Use g_autofree when calling get_opt_name_value()
tests/unit/test-qemu-opts: Validate help=foo options
qemu-option: Remove short form options support
qemu-option: Fix 'help' parameter parsing
qemu-option: Add qemu_opts_parse_list
qemu-option: Change qemu_parse_opts() to take the group name
qemu-option: Add qemu_opts_parse_list_noisily
qemu-option: Use qemu_opts_parse_list_noisily where appropriate
qemu-option: Change qemu_opts_parse_noisily() to take the group
qemu-option: Check for NULL list at qemu_opts_parse()
qemu-option: Remove a few instances of noisily parsing
block/monitor/block-hmp-cmds.c | 6 +-
blockdev.c | 2 +-
chardev/char-hmp-cmds.c | 5 +-
docs/about/deprecated.rst | 13 --
include/qemu/option.h | 8 +-
include/qemu/option_int.h | 1 +
include/system/tpm.h | 3 +-
monitor/hmp.c | 4 +-
net/net.c | 4 +-
plugins/loader.c | 5 +-
qemu-img.c | 14 +-
qemu-io-cmds.c | 2 +-
qemu-io.c | 10 +-
qemu-nbd.c | 6 +-
semihosting/config.c | 4 +-
storage-daemon/qemu-storage-daemon.c | 4 +-
system/qdev-monitor.c | 2 +-
system/tpm.c | 8 +-
system/vl.c | 114 +++++-------
tests/qemu-iotests/084 | 2 +-
tests/qemu-iotests/146 | 2 +-
tests/qemu-iotests/197 | 2 +-
tests/qemu-iotests/215 | 2 +-
tests/unit/test-char.c | 12 +-
tests/unit/test-opts-visitor.c | 12 +-
tests/unit/test-qemu-opts.c | 252 ++++++++++++++++-----------
tests/unit/test-replication.c | 17 +-
tests/unit/test-seccomp.c | 6 +-
tests/unit/test-util-sockets.c | 33 ----
tools/qemu-vnc/qemu-vnc.c | 2 +-
trace/control.c | 3 +-
ui/vnc.c | 3 +-
util/qemu-option.c | 202 +++++++++++++--------
util/qemu-sockets.c | 2 +-
34 files changed, 395 insertions(+), 372 deletions(-)
--
2.53.0
next reply other threads:[~2026-09-30 22:13 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 22:10 Fabiano Rosas [this message]
2026-09-30 22:10 ` [PATCH v2 01/11] qemu-option: Use g_autofree when calling get_opt_name_value() Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-09-30 22:10 ` [PATCH v2 02/11] tests/unit/test-qemu-opts: Validate help=foo options Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-09-30 22:10 ` [PATCH v2 03/11] qemu-option: Remove short form options support Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-10-07 7:08 ` Markus Armbruster
2026-10-07 12:43 ` Fabiano Rosas
2026-10-08 4:42 ` Markus Armbruster
2026-10-10 0:04 ` Fabiano Rosas
2026-10-07 8:16 ` Markus Armbruster
2026-09-30 22:10 ` [PATCH v2 04/11] qemu-option: Fix 'help' parameter parsing Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-10-01 15:43 ` Fabiano Rosas
2026-09-30 22:10 ` [PATCH v2 05/11] qemu-option: Add qemu_opts_parse_list Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-09-30 22:11 ` [PATCH v2 06/11] qemu-option: Change qemu_parse_opts() to take the group name Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-09-30 22:11 ` [PATCH v2 07/11] qemu-option: Add qemu_opts_parse_list_noisily Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-10-07 12:54 ` Eric Blake
2026-09-30 22:11 ` [PATCH v2 08/11] qemu-option: Use qemu_opts_parse_list_noisily where appropriate Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-09-30 22:11 ` [PATCH v2 09/11] qemu-option: Change qemu_opts_parse_noisily() to take the group Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-10-07 12:54 ` Eric Blake
2026-09-30 22:11 ` [PATCH v2 10/11] qemu-option: Check for NULL list at qemu_opts_parse() Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
2026-09-30 22:11 ` [PATCH v2 11/11] qemu-option: Remove a few instances of noisily parsing Fabiano Rosas
2026-10-01 9:42 ` marcandre.lureau
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=20260930221105.2262063-1-farosas@suse.de \
--to=farosas@suse.de \
--cc=armbru@redhat.com \
--cc=berrange@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.