Skip to content

qemu-options: Spring cleanup

Fabiano Rosas qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest11 patches 20 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11qemu-option: Use g_autofree when calling get_opt_name_value()util/qemu-option.c+11 -151 reply
2/11tests/unit/test-qemu-opts: Validate help=foo optionstests/unit/test-qemu-opts.c+27 -01 reply
3/11qemu-option: Remove short form options supportdocs/about/deprecated.rst tests/qemu-iotests/084 tests/qemu-iotests/146 +5 more+73 -1057 replies
4/11qemu-option: Fix 'help' parameter parsinginclude/qemu/option_int.h tests/unit/test-qemu-opts.c util/qemu-option.c+63 -512 replies
5/11qemu-option: Add qemu_opts_parse_listinclude/qemu/option.h tests/unit/test-qemu-opts.c util/qemu-option.c +1 more+109 -871 reply
6/11qemu-option: 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
7/11qemu-option: Add qemu_opts_parse_list_noisilyinclude/qemu/option.h util/qemu-option.c+16 -02 replies
8/11qemu-option: Use qemu_opts_parse_list_noisily where appropriateblock/monitor/block-hmp-cmds.c monitor/hmp.c net/net.c +10 more+26 -251 reply
9/11qemu-option: Change qemu_opts_parse_noisily() to take the groupblock/monitor/block-hmp-cmds.c blockdev.c chardev/char-hmp-cmds.c +10 more+52 -792 replies
10/11qemu-option: Check for NULL list at qemu_opts_parse()util/qemu-option.c+4 -01 reply
11/11qemu-option: Remove a few instances of noisily parsingblock/monitor/block-hmp-cmds.c include/system/tpm.h monitor/hmp.c +9 more+55 -491 reply

Reviews trailers per patch

10 of 11 patches have a Reviewed-by or Acked-by.

PatchDaniel P. BerrangéStefan HajnocziMarc-André Lureau
1/11R-b R-b
2/11R-b
3/11R-b
4/11
5/11R-b R-b
6/11R-b R-b
7/11R-b
8/11R-b
9/11R-b R-b R-b
10/11R-b R-b
11/11R-b

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 v2 thread

Cover letter [PATCH v2 00/11] qemu-options: Spring cleanup

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

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