Skip to content

RFC qemu-options: Remove some complexity

Fabiano Rosas qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest14 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14meson: Fix meson suites invocation from make checkscripts/mtest2make.py tests/qemu-iotests/meson.build+10 -31 reply
2/14qemu-options: Use g_autofree when calling get_opt_name_value()util/qemu-option.c+11 -151 reply
3/14qemu-options: Consolidate branches in opts_parseutil/qemu-option.c+2 -61 reply
4/14qemu-options: Add qemu_opts_parse_listinclude/qemu/option.h tests/unit/test-qemu-opts.c util/qemu-option.c +1 more+104 -821 reply
5/14qemu-options: Change qemu_parse_opts() to take the group nameinclude/qemu/option.h system/vl.c tests/unit/test-opts-visitor.c +1 more+18 -201 reply
6/14qemu-options: Call qemu_opts_print_help() one level downutil/qemu-option.c+12 -121 reply
7/14qemu-options: Consolidate qemu_opts_parse* functionstests/unit/test-opts-visitor.c util/qemu-option.c+19 -154 replies
8/14qemu-options: Add qemu_opts_parse_list_noisilyblock/monitor/block-hmp-cmds.c include/qemu/option.h monitor/hmp.c +12 more+43 -261 reply
9/14qemu-options: Change qemu_opts_parse_noisily() to take the groupblock/monitor/block-hmp-cmds.c blockdev.c chardev/char-hmp-cmds.c +10 more+54 -792 replies
10/14qemu-options: Check for NULL list at qemu_opts_parse()util/qemu-option.c+4 -01 reply
11/14qemu-options: pass an Error into get_opt_name_valueutil/qemu-option.c+17 -101 reply
12/14qemu-options: merge warn and help flagsutil/qemu-option.c+14 -160 replies
13/14qemu-options: Further simplify qemu_opts_parse_list()util/qemu-option.c+7 -80 replies
14/14qemu-options: Remove opts_parse()util/qemu-option.c+10 -230 replies

Reviews trailers per patch

7 of 14 patches have a Reviewed-by or Acked-by.

PatchStefan HajnocziDaniel P. Berrangé
1/14
2/14R-b
3/14R-b
4/14R-b
5/14R-b
6/14R-b
7/14
8/14
9/14R-b R-b
10/14R-b
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 00/14] qemu-options: Remove some complexity

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/[email protected]

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(-)
Signature · 1 line
2.53.0