The new macro will be similar to DECLARE_INSTANCE_CHECKER, but for interface types (that use INTEFACE_CHECK instead of OBJECT_CHECK).
Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: "Daniel P. Berrangé" <berra...@redhat.com> Cc: Eduardo Habkost <ehabk...@redhat.com> Cc: qemu-devel@nongnu.org --- include/qom/object.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 056f67ab3b..faf96aed3c 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -571,6 +571,20 @@ struct Object OBJ_NAME(const void *obj) \ { return OBJECT_CHECK(InstanceType, obj, TYPENAME); } +/** + * DECLARE_INTERFACE_CHECKER: + * @InstanceType: instance type + * @OBJ_NAME: the object name in uppercase with underscore separators + * @TYPENAME: type name + * + * This macro will provide the instance type cast functions for a + * QOM interface type. + */ +#define DECLARE_INTERFACE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \ + static inline G_GNUC_UNUSED InstanceType * \ + OBJ_NAME(const void *obj) \ + { return INTERFACE_CHECK(InstanceType, obj, TYPENAME); } + /** * DECLARE_CLASS_CHECKERS: * @ClassType: class struct name -- 2.26.2