[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 26/28] qapi: Enforce struct member naming rules
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 26/28] qapi: Enforce struct member naming rules |
Date: |
Tue, 23 Mar 2021 22:23:35 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Eric Blake <eblake@redhat.com> writes:
> On 3/23/21 4:40 AM, Markus Armbruster wrote:
>> Struct members, including command arguments, event data, and union
>> inline base members, should use '-', not '_'. Enforce this. Fix the
>> fixable offenders (all in tests/), and add the remainder to pragma
>> member-name-exceptions.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>
>> +++ b/qapi/pragma.json
>> @@ -31,10 +31,27 @@
>> # Externally visible types whose member names may use uppercase
>> 'member-name-exceptions': [ # visible in:
>> 'ACPISlotType', # query-acpi-ospm-status
>> + 'AcpiTableOptions', # -acpitable
>> + 'BlkdebugSetStateOptions', # blockdev-add, -blockdev
>> + 'BlockDeviceInfo', # query-block
>> + 'BlockDeviceStats', # query-blockstats
>> + 'BlockDeviceTimedStats', # query-blockstats
>> + 'BlockIOThrottle', # block_set_io_throttle
>> + 'BlockInfo', # query-block
>> 'BlockdevVmdkAdapterType', # blockdev-create (to match VMDK spec)
>> 'BlockdevVmdkSubformat', # blockdev-create (to match VMDK spec)
>> + 'ColoCompareProperties', # object_add, -object
>> + 'FilterMirrorProperties', # object_add, -object
>> + 'FilterRedirectorProperties', # object_add, -object
>> + 'FilterRewriterProperties', # object_add, -object
>> + 'InputLinuxProperties', # object_add, -object
>> + 'NetdevTapOptions', # netdev_add, query-netdev, -netdev
>> + 'PciBusInfo', # query-pci
>> + 'PciDeviceInfo', # query-pci
>> + 'PciMemoryRegion', # query-pci
>> 'QapiErrorClass', # QMP error replies
>> 'UuidInfo', # query-uuid
>> + 'VncClientInfo', # query-vnc, query-vnc-servers, ...
>> 'X86CPURegister32' # qom-get of x86 CPU properties
>> # feature-words, filtered-features
>> ] } }
>
> I was worried the list might be even longer. And as before, we might
> have future patches that want to add aliases and/or deprecate the old
> spellings, as long as introspection can easily see new spellings.
>
> At any rate, I'm in agreement with letting the computer flag new
> instances instead of relying on me to notice during review.
Saves us review - fix up cycles. Everybody wins.
>> diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
>> index 2b08b761c2..fb17eebde3 100644
>> --- a/qga/qapi-schema.json
>> +++ b/qga/qapi-schema.json
>> @@ -19,6 +19,10 @@
>> # Whitelists to permit QAPI rule violations; think twice before you
>
> Did you want to fix this instance of the word 'Whitelists' somewhere in
> the series?
There's more than just this one. We can replace them on top if we care.
>> # add to them!
>> { 'pragma': {
>> + # Types whose member names may use '_'
>> + 'member-name-exceptions': [
>> + 'GuestAgentInfo'
>> + ],
>> # Commands allowed to return a non-dictionary:
>> 'command-returns-exceptions': [
>> 'guest-file-open',
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
Thanks!
- [PATCH 08/28] qapi: Support flat unions tag values with leading digit, (continued)
- [PATCH 07/28] qapi: Fix to reject optional members with reserved names, Markus Armbruster, 2021/03/23
- [PATCH 26/28] qapi: Enforce struct member naming rules, Markus Armbruster, 2021/03/23
- [PATCH 15/28] tests/qapi-schema: Rename redefined-builtin to redefined-predefined, Markus Armbruster, 2021/03/23
- [PATCH 22/28] qapi: Prepare for rejecting underscore in command and member names, Markus Armbruster, 2021/03/23
- [PATCH 17/28] tests/qapi-schema: Rename pragma-*-crap to pragma-value-not-*, Markus Armbruster, 2021/03/23
- [PATCH 12/28] qapi: Consistently permit any case in downstream prefixes, Markus Armbruster, 2021/03/23
- [PATCH 19/28] qapi: Rename pragma *-whitelist to *-exceptions, Markus Armbruster, 2021/03/23