[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 26/28] qapi: Enforce struct member naming rules
From: |
Eric Blake |
Subject: |
Re: [PATCH 26/28] qapi: Enforce struct member naming rules |
Date: |
Tue, 23 Mar 2021 10:46:17 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
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.
> 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?
> # 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>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
- Re: [PATCH 10/28] qapi: Rework name checking in preparation of stricter checking, (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
- Re: [PATCH 26/28] qapi: Enforce struct member naming rules,
Eric Blake <=
- [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