[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 2/5] arm: qmp: add query-gic-capabilities int
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v5 2/5] arm: qmp: add query-gic-capabilities interface |
Date: |
Wed, 23 Mar 2016 10:52:29 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Peter Xu <address@hidden> writes:
> On Tue, Mar 22, 2016 at 07:28:13PM +0100, Markus Armbruster wrote:
>> Peter Xu <address@hidden> writes:
>> > diff --git a/scripts/qapi.py b/scripts/qapi.py
>> > index 6b2aa6e..716474e 100644
>> > --- a/scripts/qapi.py
>> > +++ b/scripts/qapi.py
>> > @@ -46,6 +46,7 @@ returns_whitelist = [
>> # Whitelist of commands allowed to return a non-dictionary
>> returns_whitelist = [
>> 'human-monitor-command',
>> 'qom-get',
>> 'query-migrate-cache-size',
>> > 'query-tpm-models',
>> > 'query-tpm-types',
>> > 'ringbuf-read',
>> > + 'query-gic-capability',
>> >
>> > # From QGA:
>> > 'guest-file-open',
>>
>> The whitelist exists to except existing commands from design rules on
>> return types. New commands don't get to violate the rules without a
>> really, really compelling reason.
>>
>> Do you actually need this?
I've since tested it and double-checked the code: you don't need this.
>> If yes, why should your command be permitted to violate the design
>> rules?
>
> This might not be required. Agree with you and Eric. Will use a hash
> instead with single key.
The rule against returning non-dictionaries exists to avoid interfaces
that cannot evolve. With a dictionary, you can evolve by adding
members.
The rule does *not* forbid returning lists of dictionaries. When a
command fundamentally returns a list of things, being able to evolve the
things suffices.
query-gic-capabilities looks like it fundamentally returns a list of
capabilities. Returning ['GICCapability'] is just fine then.
Only if query-gic-capabilities doesn't have this list nature should you
complicate its return value by wrapping it in another object type.
In either case, drop the change to returns_whitelist.
[...]
- Re: [Qemu-devel] [PATCH v5 1/5] arm: qmp: add GICCapability struct, (continued)
Re: [Qemu-devel] [PATCH v5 1/5] arm: qmp: add GICCapability struct, Eric Blake, 2016/03/22
[Qemu-devel] [PATCH v5 2/5] arm: qmp: add query-gic-capabilities interface, Peter Xu, 2016/03/17
Re: [Qemu-devel] [PATCH v5 2/5] arm: qmp: add query-gic-capabilities interface, Eric Blake, 2016/03/22
[Qemu-devel] [PATCH v5 3/5] arm: enhance kvm_arm_create_scratch_host_vcpu, Peter Xu, 2016/03/17
[Qemu-devel] [PATCH v5 4/5] kvm: add kvm_support_device() helper function, Peter Xu, 2016/03/17
[Qemu-devel] [PATCH v5 5/5] arm: implement query-gic-capabilities, Peter Xu, 2016/03/17