diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2020-06-24 15:10:37 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-07-07 14:54:29 +0200 |
commit | 0f8198f1b2f3c33df2381c412ad8d8fd219b90b2 (patch) | |
tree | 6a666f75e1c92b524ef3c1a1d5e00ded8b0bdbc0 /qom/object.c | |
parent | 28457744c345ca4ccb58c984c9552e9c5955a9de (diff) |
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
Diffstat (limited to 'qom/object.c')
-rw-r--r-- | qom/object.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c index 6ece96bc2b..34daaf1280 100644 --- a/qom/object.c +++ b/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); |