Re: [PATCH 01/27] include/qemu/target-info-qom.h: declare TYPE_TARGET_SPECIFIC interface

Daniel P. BerrangĂ© <[email protected]> Wed, 5 Aug 2026 15:05:39 +0100
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On Fri, Jul 24, 2026 at 12:09:21AM +0000, Pierrick Bouvier wrote:
> In the next commits, We'll replace the logic to filter QOM types per
> target from a static one (based on INTERFACES) to a runtime one, based
> on is_available() function, that can be overriden per class.
> 
> Introduce the new interface we'll use for that.
> 
> Signed-off-by: Pierrick Bouvier <[email protected]>
> ---
>  include/qemu/target-info-qom.h | 15 +++++++++++++++
>  target-info-qom.c              |  5 +++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/include/qemu/target-info-qom.h b/include/qemu/target-info-qom.h
> index 91be415ed33..83eb537333b 100644
> --- a/include/qemu/target-info-qom.h
> +++ b/include/qemu/target-info-qom.h
> @@ -14,6 +14,21 @@
>  
>  #define TYPE_TARGET_INFO "target-info"
>  
> +#define TYPE_TARGET_SPECIFIC "target-specific"
> +
> +typedef struct TargetSpecific TargetSpecific;
> +
> +typedef struct TargetSpecificClass {
> +    InterfaceClass parent_class;
> +
> +    bool (*is_available)(void);
> +} TargetSpecificClass;
> +
> +#define TARGET_SPECIFIC(obj) \
> +    INTERFACE_CHECK(TargetSpecific, (obj), TYPE_TARGET_SPECIFIC)
> +DECLARE_CLASS_CHECKERS(TargetSpecificClass, TARGET_SPECIFIC,
> +                       TYPE_TARGET_SPECIFIC)

Looking through the series,I don't really see the point
in this interface.   Why is this not possible to do by
adding 'is_available' to MachineClass.  It would make
the rest of the series simpler and especially avoid the
need to introduced yet more series of macros for defining
machine classes.

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|