aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/qemu/help_option.h11
-rw-r--r--include/qemu/option.h2
-rw-r--r--include/qom/object_interfaces.h21
3 files changed, 30 insertions, 4 deletions
diff --git a/include/qemu/help_option.h b/include/qemu/help_option.h
index 328d2a8..ca6389a 100644
--- a/include/qemu/help_option.h
+++ b/include/qemu/help_option.h
@@ -19,4 +19,15 @@ static inline bool is_help_option(const char *s)
return !strcmp(s, "?") || !strcmp(s, "help");
}
+static inline int starts_with_help_option(const char *s)
+{
+ if (*s == '?') {
+ return 1;
+ }
+ if (g_str_has_prefix(s, "help")) {
+ return 4;
+ }
+ return 0;
+}
+
#endif
diff --git a/include/qemu/option.h b/include/qemu/option.h
index 05e8a15..ac69352 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -149,6 +149,6 @@ void qemu_opts_free(QemuOptsList *list);
QemuOptsList *qemu_opts_append(QemuOptsList *dst, QemuOptsList *list);
QDict *keyval_parse(const char *params, const char *implied_key,
- Error **errp);
+ bool *help, Error **errp);
#endif
diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index f118fb5..07d5cc8 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