aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qapi-schema.json4
-rw-r--r--qdev-monitor.c7
-rw-r--r--qmp.c13
3 files changed, 19 insertions, 5 deletions
diff --git a/qapi-schema.json b/qapi-schema.json
index 4f0d7e3250..24379ab3af 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1615,11 +1615,13 @@
#
# @name: the name of the property
# @type: the typename of the property
+# @description: #optional if specified, the description of the property.
+# (since 2.2)
#
# Since: 1.2
##
{ 'type': 'DevicePropertyInfo',
- 'data': { 'name': 'str', 'type': 'str' } }
+ 'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
##
# @device-list-properties:
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 754437b777..fac7d179fe 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -213,9 +213,14 @@ int qdev_device_help(QemuOpts *opts)
}
for (prop = prop_list; prop; prop = prop->next) {
- error_printf("%s.%s=%s\n", driver,
+ error_printf("%s.%s=%s", driver,
prop->value->name,
prop->value->type);
+ if (prop->value->has_description) {
+ error_printf(" (%s)\n", prop->value->description);
+ } else {
+ error_printf("\n");
+ }
}
qapi_free_DevicePropertyInfoList(prop_list);
diff --git a/qmp.c b/qmp.c
index c6767c4df3..0b4f131936 100644
--- a/qmp.c
+++ b/qmp.c
@@ -442,7 +442,8 @@ ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
*/
static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
const char *name,
- const char *default_type)
+ const char *default_type,
+ const char *description)
{
DevicePropertyInfo *info;
Property *prop;
@@ -465,7 +466,9 @@ static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
info = g_malloc0(sizeof(*info));
info->name = g_strdup(prop->name);
- info->type = g_strdup(prop->info->legacy_name ?: prop->info->name);
+ info->type = g_strdup(prop->info->name);
+ info->has_description = !!prop->info->description;
+ info->description = g_strdup(prop->info->description);
return info;
}
klass = object_class_get_parent(klass);
@@ -475,6 +478,9 @@ static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
info = g_malloc0(sizeof(*info));
info->name = g_strdup(name);
info->type = g_strdup(default_type);
+ info->has_description = !!description;
+ info->description = g_strdup(description);
+
return info;
}
@@ -521,7 +527,8 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
continue;
}
- info = make_device_property_info(klass, prop->name, prop->type);
+ info = make_device_property_info(klass, prop->name, prop->type,
+ prop->description);
if (!info) {
continue;
}