This replaces the QemuOpts-based help code for --object in the storage daemon with code based on the keyval parser.
Review of v3 led me to preexisting issues. Instead of posting my fixes separately, then working with Kevin to rebase his work on top of mine, I did the rebase myself and am posting it together with my fixes as v4. Hope that's okay. Note: to test qemu-storage-daemon --object help, you need Philippe's "[PATCH v3] hw/nvram: Always register FW_CFG_DATA_GENERATOR_INTERFACE" and its prerequisites (first 10 patches of Paolo's "[PULL 00/39] SCSI, qdev, qtest, meson patches for 2020-10-10"), so it doesn't crash with "missing interface 'fw_cfg-data-generator' for object 'tls-creds'". v4: - PATCH 1-3: New - PATCH 4: * Rebased * Commit message typos [Eric] * Replace flawed is_help_option_n() by starts_with_help_option() [me] * Update grammar and accompanying prose [me] * Update keyval_parse_one()'s contract, tweak keyval_parse()'s [me] * Revert the keyval_parse_one() change to a rebased version of v1, because it's simpler and the edge case that led to the more complicated version no longer exists [me]. * Rearrange tests so the simple cases come first - PATCH 5-7: Unchanged v3: - Always parse help options, no matter if the caller implements help or not. If it doesn't, return an error. [Markus] - Document changes to the keyval parser grammar [Markus] - Support both 'help' and '?' [Eric] - Test case fixes [Eric] - Improved documentation of user_creatable_print_help(_from_qdict) [Markus] v2: - Fixed double comma by reusing the existing key and value parsers [Eric] - More tests to cover the additional cases Kevin Wolf (4): keyval: Parse help options qom: Factor out helpers from user_creatable_print_help() qom: Add user_creatable_print_help_from_qdict() qemu-storage-daemon: Remove QemuOpts from --object parser Markus Armbruster (3): keyval: Fix and clarify grammar test-keyval: Demonstrate misparse of ',' with implied key keyval: Fix parsing of ',' in value of implied key include/qemu/help_option.h | 11 ++ include/qemu/option.h | 2 +- include/qom/object_interfaces.h | 21 ++- qapi/qobject-input-visitor.c | 2 +- qom/object_interfaces.c | 99 ++++++++------ storage-daemon/qemu-storage-daemon.c | 15 +-- tests/test-keyval.c | 187 ++++++++++++++++++--------- util/keyval.c | 103 +++++++++++---- 8 files changed, 297 insertions(+), 143 deletions(-) -- 2.26.2