Paolo Bonzini <pbonz...@redhat.com> writes: > Il mar 21 gen 2020, 15:22 Markus Armbruster <arm...@redhat.com> 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". > 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. Likewise, "nfs" is present in introspection data even if no NFS server exists on your network, or you don't have permission to use it. QAPI/QMP introspection is compile-time static by design. It can't tell you more than "this QEMU build supports X". That's it's mission. > I would restrict very > much #if usage in QAPI to the very minimum necessary. I'm not sure I understand how you propose to change introspection.