qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] qapi: Incorrect attempt to fix building with MC146818RTC


From: Paolo Bonzini
Subject: Re: [RFC PATCH] qapi: Incorrect attempt to fix building with MC146818RTC=n
Date: Wed, 22 Jan 2020 15:30:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 22/01/20 06:41, Markus Armbruster wrote:
> Paolo Bonzini <address@hidden> writes:
> 
>> Il mar 21 gen 2020, 15:22 Markus Armbruster <address@hidden> ha scritto:
>>
>>>> To see it a different way, these are the "C bindings" to QMP, just that
>>>> the implementation is an in-process call rather than RPC.  If the QAPI
>>>> code generator was also able to generate Python bindings and the like,
>>>> they would have to be the same for all QEMU binaries, wouldn't they?
>>>
>>> Ommitting the kind of #if we've been discussing is relatively harmless
>>> but what about this one, in qapi-types-block-core.h:
>>>
>>>     typedef enum BlockdevDriver {
>>>         BLOCKDEV_DRIVER_BLKDEBUG,
>>>         [...]
>>>     #if defined(CONFIG_REPLICATION)
>>>         BLOCKDEV_DRIVER_REPLICATION,
>>>     #endif /* defined(CONFIG_REPLICATION) */
>>>         [...]
>>>         BLOCKDEV_DRIVER__MAX,
>>>     } BlockdevDriver;
>>>
>>
>> Well, I don't think this should be conditional at all. Introspection is a
>> tool to detect unsupported features, not working features.
> 
> Isn't this what it does?  To detect "replication" is unsupported, check
> whether it's absent, and "supported" does not imply "works".

Indeed...

>>                                                            KVM will be
>> present in introspection data even if /dev/kvm doesn't exist on your
>> machine or you don't have permission to access it.
> 
> Yes.
> 
> QAPI/QMP introspection is compile-time static by design.  It can't tell
> you more than "this QEMU build supports X".

... and I think it would be fine even if it told you less: "this QEMU
will not give a parse error if X appears in QMP syntax".  For example,
QEMU could accept "replication" even if CONFIG_REPLICATION is not
defined and therefore using it would always fail.  This would allow
limiting even more use of conditional compilation.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]