mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
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 <kraxel@redhat.com> Message-id: 20200624131045.14512-3-kraxel@redhat.com
This commit is contained in:
parent
28457744c3
commit
0f8198f1b2
2 changed files with 26 additions and 0 deletions
14
qom/object.c
14
qom/object.c
|
@ -985,6 +985,20 @@ ObjectClass *object_class_by_name(const char *typename)
|
|||
return type->class;
|
||||
}
|
||||
|
||||
ObjectClass *module_object_class_by_name(const char *typename)
|
||||
{
|
||||
ObjectClass *oc;
|
||||
|
||||
oc = object_class_by_name(typename);
|
||||
#ifdef CONFIG_MODULES
|
||||
if (!oc) {
|
||||
module_load_qom_one(typename);
|
||||
oc = object_class_by_name(typename);
|
||||
}
|
||||
#endif
|
||||
return oc;
|
||||
}
|
||||
|
||||
ObjectClass *object_class_get_parent(ObjectClass *class)
|
||||
{
|
||||
TypeImpl *type = type_get_parent(class->type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue