Hi,

object_class_dynamic_cast() checks whether a class implements
a type name, and return the class casted appropriately. This
also works with interfaces, except when an interface is
implemented multiple times (by intermediate abstract parents /
interfaces).

This series factors object_class_implements_type() out of
object_class_dynamic_cast() and use it (at least the meaning
seems clearer to me when reviewing).

I could get it working with object_class_foreach() but for
some reason fail at writing a proper test. Posting the last
patch as RFC so we can discuss it on the list.

Regards,

Phil.

Philippe Mathieu-Daudé (6):
  qom: Factor object_class_dynamic_cast_ambiguous() out
  qom: Add object_class_implements_type()
  qom: Test object_class_implements_type()
  qom: Prefer object_class_implements_type() to check type
    implementation
  qom: Use object_class_implements_type() in object_class_foreach()
  XXX qom: Test object_class_get_list()

 include/qom/object.h             | 10 ++++++
 chardev/char.c                   |  2 +-
 hw/arm/xlnx-versal-virt.c        |  2 +-
 hw/core/cpu-common.c             |  2 +-
 hw/core/machine.c                |  4 +--
 hw/i386/xen/xen_platform.c       |  2 +-
 hw/pci/pci.c                     |  6 ++--
 qom/object.c                     | 29 ++++++++++++++---
 qom/object_interfaces.c          |  2 +-
 qom/qom-qmp-cmds.c               |  4 +--
 system/qdev-monitor.c            |  4 +--
 system/tpm.c                     |  2 +-
 target/alpha/cpu.c               |  2 +-
 target/rx/cpu.c                  |  2 +-
 tests/unit/check-qom-interface.c | 56 ++++++++++++++++++++++++++++++++
 15 files changed, 108 insertions(+), 21 deletions(-)

-- 
2.47.1


Reply via email to