summary refs log tree commit diff stats
path: root/include/qom/object_interfaces.h
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2020-10-07 18:49:02 +0200
committerKevin Wolf <kwolf@redhat.com>2020-10-15 16:06:27 +0200
commitc9ac1458430e4794adc8f0418d263befc3917886 (patch)
tree5c11a59fbf6f7435b78d568b255af9408bd00249 /include/qom/object_interfaces.h
parent0e301d44271b370ed0d46c2e85c2a5bda041c57c (diff)
downloadfocaccia-qemu-c9ac1458430e4794adc8f0418d263befc3917886.tar.gz
focaccia-qemu-c9ac1458430e4794adc8f0418d263befc3917886.zip
qom: Add user_creatable_print_help_from_qdict()
This adds a function that, given a QDict of non-help options, prints
help for user creatable objects.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201007164903.282198-4-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/qom/object_interfaces.h')
-rw-r--r--include/qom/object_interfaces.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index f118fb516b..07d5cc8832 100644
--- a/include/qom/object_interfaces.h
+++ b/include/qom/object_interfaces.h
@@ -154,14 +154,29 @@ int user_creatable_add_opts_foreach(void *opaque,
  * @type: the QOM type to be added
  * @opts: options to create
  *
- * Prints help if requested in @opts.
+ * Prints help if requested in @type or @opts. Note that if @type is neither
+ * "help"/"?" nor a valid user creatable type, no help will be printed
+ * regardless of @opts.
  *
- * Returns: true if @opts contained a help option and help was printed, false
- * if no help option was found.
+ * Returns: true if a help option was found and help was printed, false
+ * otherwise.
  */
 bool user_creatable_print_help(const char *type, QemuOpts *opts);
 
 /**
+ * user_creatable_print_help_from_qdict:
+ * @args: options to create
+ *
+ * Prints help considering the other options given in @args (if "qom-type" is
+ * given and valid, print properties for the type, otherwise print valid types)
+ *
+ * In contrast to user_creatable_print_help(), this function can't return that
+ * no help was requested. It should only be called if we know that help is
+ * requested and it will always print some help.
+ */
+void user_creatable_print_help_from_qdict(QDict *args);
+
+/**
  * user_creatable_del:
  * @id: the unique ID for the object
  * @errp: if an error occurs, a pointer to an area to store the error