qom: allow user-creatable classes to be in modules

There is no real reason to make user-creatable classes different
from other backends in this respect.  This also allows modularized
character devices to be treated by qom-list-properties just like
builtin ones.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2024-10-29 10:46:38 +01:00
parent 02009a12bc
commit f41823e059
2 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ Object *user_creatable_add_type(const char *type, const char *id,
return NULL; return NULL;
} }
klass = object_class_by_name(type); klass = module_object_class_by_name(type);
if (!klass) { if (!klass) {
error_setg(errp, "invalid object type: %s", type); error_setg(errp, "invalid object type: %s", type);
return NULL; return NULL;

View File

@ -186,7 +186,7 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
ObjectPropertyIterator iter; ObjectPropertyIterator iter;
ObjectPropertyInfoList *prop_list = NULL; ObjectPropertyInfoList *prop_list = NULL;
klass = object_class_by_name(typename); klass = module_object_class_by_name(typename);
if (klass == NULL) { if (klass == NULL) {
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
"Class '%s' not found", typename); "Class '%s' not found", typename);