[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 56/59] qdev: use object_property_help()
From: |
Paolo Bonzini |
Subject: |
[PULL 56/59] qdev: use object_property_help() |
Date: |
Thu, 23 Jan 2020 14:50:46 +0100 |
From: Marc-André Lureau <address@hidden>
Use the common function introduced earlier, and report default value.
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
[Sort the properties, following what is done for -object ...,help. - Paolo]
Signed-off-by: Paolo Bonzini <address@hidden>
---
qdev-monitor.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/qdev-monitor.c b/qdev-monitor.c
index c929262..8ce71a2 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -37,6 +37,7 @@
#include "sysemu/sysemu.h"
#include "migration/misc.h"
#include "migration/migration.h"
+#include "qemu/cutils.h"
/*
* Aliases were a bad idea from the start. Let's keep them
@@ -256,6 +257,8 @@ int qdev_device_help(QemuOpts *opts)
const char *driver;
ObjectPropertyInfoList *prop_list;
ObjectPropertyInfoList *prop;
+ GPtrArray *array;
+ int i;
driver = qemu_opt_get(opts, "driver");
if (driver && is_help_option(driver)) {
@@ -285,19 +288,20 @@ int qdev_device_help(QemuOpts *opts)
} else {
qemu_printf("There are no options for %s.\n", driver);
}
+ array = g_ptr_array_new();
for (prop = prop_list; prop; prop = prop->next) {
- int len;
- qemu_printf(" %s=<%s>%n", prop->value->name, prop->value->type, &len);
- if (prop->value->has_description) {
- if (len < 24) {
- qemu_printf("%*s", 24 - len, "");
- }
- qemu_printf(" - %s\n", prop->value->description);
- } else {
- qemu_printf("\n");
- }
- }
-
+ g_ptr_array_add(array,
+ object_property_help(prop->value->name,
+ prop->value->type,
+ prop->value->default_value,
+ prop->value->description));
+ }
+ g_ptr_array_sort(array, (GCompareFunc)qemu_pstrcmp0);
+ for (i = 0; i < array->len; i++) {
+ printf("%s\n", (char *)array->pdata[i]);
+ }
+ g_ptr_array_set_free_func(array, g_free);
+ g_ptr_array_free(array, true);
qapi_free_ObjectPropertyInfoList(prop_list);
return 1;
--
1.8.3.1
- [PULL 45/59] object: add object_class_property_add_link(), (continued)
- [PULL 45/59] object: add object_class_property_add_link(), Paolo Bonzini, 2020/01/23
- [PULL 46/59] object: release all props, Paolo Bonzini, 2020/01/23
- [PULL 47/59] object: return self in object_ref(), Paolo Bonzini, 2020/01/23
- [PULL 49/59] qdev: rename DeviceClass.props, Paolo Bonzini, 2020/01/23
- [PULL 50/59] qdev: move instance properties to class properties, Paolo Bonzini, 2020/01/23
- [PULL 52/59] vl: print default value in object help, Paolo Bonzini, 2020/01/23
- [PULL 51/59] qdev: register properties as class properties, Paolo Bonzini, 2020/01/23
- [PULL 53/59] qom: simplify qmp_device_list_properties(), Paolo Bonzini, 2020/01/23
- [PULL 54/59] qom: introduce object_property_help(), Paolo Bonzini, 2020/01/23
- [PULL 55/59] qapi/qmp: add ObjectPropertyInfo.default-value, Paolo Bonzini, 2020/01/23
- [PULL 56/59] qdev: use object_property_help(),
Paolo Bonzini <=
- [PULL 57/59] target/i386: Add the 'model-id' for Skylake -v3 CPU models, Paolo Bonzini, 2020/01/23
- [PULL 59/59] tests: fix test-qga on macosx, Paolo Bonzini, 2020/01/23
- [PULL 58/59] build-sys: clean up flags included in the linker command line, Paolo Bonzini, 2020/01/23
- [PULL 48/59] qdev: set properties with device_class_set_props(), Paolo Bonzini, 2020/01/23
- Re: [PULL v2 00/59] Misc (x86 and QOM) patches for 2020-01-23, Peter Maydell, 2020/01/23
- [PULL v2 00/59] Misc (x86 and QOM) patches for 2020-01-23, Paolo Bonzini, 2020/01/24