Message ID | 20220908103650.9518-2-davydov-max@yandex-team.ru |
---|---|
State | New |
Headers | show |
Series | compare machine type compat_props | expand |
On 9/8/22 13:36, Maksim Davydov wrote: > qmp_qom_list_properties can print default values if they are available > as qmp_device_list_properties does, because both of them use the > ObjectPropertyInfo structure with default_value field. This can be useful > when working with "not device" types. > > Signed-off-by: Maksim Davydov<davydov-max@yandex-team.ru> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 2e63a4c184..1d7867dc19 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -217,6 +217,8 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename, info->type = g_strdup(prop->type); info->has_description = !!prop->description; info->description = g_strdup(prop->description); + info->default_value = qobject_ref(prop->defval); + info->has_default_value = !!info->default_value; QAPI_LIST_PREPEND(prop_list, info); }
qmp_qom_list_properties can print default values if they are available as qmp_device_list_properties does, because both of them use the ObjectPropertyInfo structure with default_value field. This can be useful when working with "not device" types. Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru> --- qom/qom-qmp-cmds.c | 2 ++ 1 file changed, 2 insertions(+)