qom/qmp: populate description & default-value in qom_property_info()
Move description and default_value population from the individual QMP handlers into qom_property_info(), so all callers get them. This also adds description and default-value to qom-list responses, which previously only returned name and type. The handler doesn't care. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20261101201717.3911097-14-armbru@redhat.com>
This commit is contained in:
1 parent
366600c811
commit
fc99cdc709
1 file changed
+4
-13
+4
-13
@@ -35,6 +35,8 @@ static ObjectPropertyInfo *qom_property_info(ObjectProperty *prop)
|
||||
|
||||
info->name = g_strdup(prop->name);
|
||||
info->type = g_strdup(prop->type);
|
||||
info->description = g_strdup(prop->description);
|
||||
info->default_value = qobject_ref(prop->defval);
|
||||
if (prop->qapi_type) {
|
||||
assert(prop->qapi_type->masked_name);
|
||||
info->qapi_type = g_strdup(prop->qapi_type->masked_name);
|
||||
@@ -243,8 +245,6 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
|
||||
|
||||
object_property_iter_init(&iter, obj);
|
||||
while ((prop = object_property_iter_next(&iter))) {
|
||||
ObjectPropertyInfo *info;
|
||||
|
||||
/* Skip Object and DeviceState properties */
|
||||
if (strcmp(prop->name, "type") == 0 ||
|
||||
strcmp(prop->name, "realized") == 0 ||
|
||||
@@ -254,11 +254,7 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
|
||||
continue;
|
||||
}
|
||||
|
||||
info = qom_property_info(prop);
|
||||
info->description = g_strdup(prop->description);
|
||||
info->default_value = qobject_ref(prop->defval);
|
||||
|
||||
QAPI_LIST_PREPEND(prop_list, info);
|
||||
QAPI_LIST_PREPEND(prop_list, qom_property_info(prop));
|
||||
}
|
||||
|
||||
object_unref(obj);
|
||||
@@ -295,12 +291,7 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
|
||||
object_property_iter_init(&iter, obj);
|
||||
}
|
||||
while ((prop = object_property_iter_next(&iter))) {
|
||||
ObjectPropertyInfo *info = qom_property_info(prop);
|
||||
|
||||
info->description = g_strdup(prop->description);
|
||||
info->default_value = qobject_ref(prop->defval);
|
||||
|
||||
QAPI_LIST_PREPEND(prop_list, info);
|
||||
QAPI_LIST_PREPEND(prop_list, qom_property_info(prop));
|
||||
}
|
||||
|
||||
object_unref(obj);
|
||||
|
||||
Reference in new issue
Block a user