[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 4/7] keyval: Parse help options
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v4 4/7] keyval: Parse help options |
Date: |
Mon, 19 Oct 2020 11:04:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Kevin Wolf <kwolf@redhat.com> writes:
> Am 11.10.2020 um 09:35 hat Markus Armbruster geschrieben:
>> From: Kevin Wolf <kwolf@redhat.com>
>>
>> This adds a special meaning for 'help' and '?' as options to the keyval
>> parser. Instead of being an error (because of a missing value) or a
>> value for an implied key, they now request help, which is a new boolean
>> output of the parser in addition to the QDict.
>>
>> A new parameter 'p_help' is added to keyval_parse() that contains on
>> return whether help was requested. If NULL is passed, requesting help
>> results in an error and all other cases work like before.
>>
>> Turning previous error cases into help is a compatible extension. The
>> behaviour potentially changes for implied keys: They could previously
>> get 'help' as their value, which is now interpreted as requesting help.
>>
>> This is not a problem in practice because 'help' and '?' are not a valid
>> values for the implied key of any option parsed with keyval_parse():
>>
>> * audiodev: union Audiodev, implied key "driver" is enum AudiodevDriver,
>> "help" and "?" are not among its values
>>
>> * display: union DisplayOptions, implied key "type" is enum
>> DisplayType, "help" and "?" are not among its values
>>
>> * blockdev: union BlockdevOptions, implied key "driver is enum
>> BlockdevDriver, "help" and "?" are not among its values
>>
>> * export: union BlockExport, implied key "type" is enum BlockExportType,
>> "help" and "?" are not among its values
>>
>> * monitor: struct MonitorOptions, implied key "mode" is enum MonitorMode,
>> "help" and "?" are not among its values
>>
>> * nbd-server: struct NbdServerOptions, no implied key.
>>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
>> diff --git a/tests/test-keyval.c b/tests/test-keyval.c
>> index 04c62cf045..7b459900af 100644
>> --- a/tests/test-keyval.c
>> +++ b/tests/test-keyval.c
>> @@ -1,3 +1,4 @@
>> +
>> /*
>> * Unit tests for parsing of KEY=VALUE,... strings
>> *
>
> This hunk looks unintentional.
It is. Thanks for fixing it up!
- [PATCH v4 1/7] keyval: Fix and clarify grammar, (continued)
- [PATCH v4 1/7] keyval: Fix and clarify grammar, Markus Armbruster, 2020/10/11
- [PATCH v4 3/7] keyval: Fix parsing of ',' in value of implied key, Markus Armbruster, 2020/10/11
- [PATCH v4 7/7] qemu-storage-daemon: Remove QemuOpts from --object parser, Markus Armbruster, 2020/10/11
- [PATCH v4 4/7] keyval: Parse help options, Markus Armbruster, 2020/10/11
- Re: [PATCH v4 0/7] qemu-storage-daemon: Remove QemuOpts from --object, Kevin Wolf, 2020/10/12