aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-10 19:30:35 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 20:59:16 +0100
commitf902cb29660f0db1ccba61ca5b4cd0292d4b524b (patch)
tree82efe185c33c76255c6bc7b93f464b09c485c652 /qom
parent77b06bba62034a87cc61a9c8de1309ae3e527d97 (diff)
downloadqemu-f902cb29660f0db1ccba61ca5b4cd0292d4b524b.zip
qemu-f902cb29660f0db1ccba61ca5b4cd0292d4b524b.tar.gz
qemu-f902cb29660f0db1ccba61ca5b4cd0292d4b524b.tar.bz2
vl: print default value in object help
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200110153039.1379601-23-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/object_interfaces.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 46cd6ea..edb4cc4 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, "");