[22/26] vl: print default value in object help
diff mbox series

Message ID 20191201111531.1136947-23-marcandre.lureau@redhat.com
State New
Headers show
Series
  • Make QDev use class properties
Related show

Commit Message

Marc-André Lureau Dec. 1, 2019, 11:15 a.m. UTC
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qom/object_interfaces.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch
diff mbox series

diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 46cd6eab5c..edb4cc4a3d 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -185,6 +185,7 @@  bool user_creatable_print_help(const char *type, QemuOpts *opts)
         object_class_property_iter_init(&iter, klass);
         while ((prop = object_property_iter_next(&iter))) {
             GString *str;
+            char *defval;
 
             if (!prop->set) {
                 continue;
@@ -192,6 +193,11 @@  bool user_creatable_print_help(const char *type, QemuOpts *opts)
 
             str = g_string_new(NULL);
             g_string_append_printf(str, "  %s=<%s>", prop->name, prop->type);
+            defval = object_property_get_default(prop);
+            if (defval) {
+                g_string_append_printf(str, " (default: %s)", defval);
+                g_free(defval);
+            }
             if (prop->description) {
                 if (str->len < 24) {
                     g_string_append_printf(str, "%*s", 24 - (int)str->len, "");