From 0f8198f1b2f3c33df2381c412ad8d8fd219b90b2 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 24 Jun 2020 15:10:37 +0200 Subject: object: qom module support Little helper function to load modules on demand. In most cases adding module loading support for devices and other objects is just s/object_class_by_name/module_object_class_by_name/ in the right spot. Signed-off-by: Gerd Hoffmann Message-id: 20200624131045.14512-3-kraxel@redhat.com --- include/qom/object.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/qom') diff --git a/include/qom/object.h b/include/qom/object.h index 94a61cc..51f1881 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -994,6 +994,18 @@ bool object_class_is_abstract(ObjectClass *klass); */ ObjectClass *object_class_by_name(const char *typename); +/** + * module_object_class_by_name: + * @typename: The QOM typename to obtain the class for. + * + * For objects which might be provided by a module. Behaves like + * object_class_by_name, but additionally tries to load the module + * needed in case the class is not available. + * + * Returns: The class for @typename or %NULL if not found. + */ +ObjectClass *module_object_class_by_name(const char *typename); + void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque), const char *implements_type, bool include_abstract, void *opaque); -- cgit v1.1