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 (14):
meson: Fix meson suites invocation from make check
qemu-options: Use g_autofree when calling get_opt_name_value()
qemu-options: Consolidate branches in opts_parse
qemu-options: Add qemu_opts_parse_list
qemu-options: Change qemu_parse_opts() to take the group name
qemu-options: Call qemu_opts_print_help() one level down
qemu-options: Consolidate qemu_opts_parse* functions
qemu-options: Add qemu_opts_parse_list_noisily
qemu-options: Change qemu_opts_parse_noisily() to take the group
qemu-options: Check for NULL list at qemu_opts_parse()
qemu-options: pass an Error into get_opt_name_value
qemu-options: merge warn and help flags
qemu-options: Further simplify qemu_opts_parse_list()
qemu-options: Remove opts_parse()
block/monitor/block-hmp-cmds.c | 4 +-
blockdev.c | 2 +-
chardev/char-hmp-cmds.c | 5 +-
include/qemu/option.h | 8 +-
monitor/hmp.c | 2 +-
net/net.c | 2 +-
plugins/loader.c | 2 +-
qemu-img.c | 13 +-
qemu-io-cmds.c | 2 +-
qemu-io.c | 7 +-
qemu-nbd.c | 6 +-
scripts/mtest2make.py | 11 +-
semihosting/config.c | 4 +-
storage-daemon/qemu-storage-daemon.c | 4 +-
system/qdev-monitor.c | 2 +-
system/tpm.c | 2 +-
system/vl.c | 86 +++++-------
tests/qemu-iotests/meson.build | 2 +-
tests/unit/test-char.c | 12 +-
tests/unit/test-opts-visitor.c | 12 +-
tests/unit/test-qemu-opts.c | 169 ++++++++++++-----------
tests/unit/test-replication.c | 6 +-
tests/unit/test-seccomp.c | 6 +-
tools/qemu-vnc/qemu-vnc.c | 2 +-
trace/control.c | 3 +-
ui/vnc.c | 3 +-
util/qemu-option.c | 197 ++++++++++++++++-----------
util/qemu-sockets.c | 2 +-
28 files changed, 293 insertions(+), 283 deletions(-)
--
2.53.0