aboutsummaryrefslogtreecommitdiff
path: root/include/qom
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2021-02-17 14:59:06 +0100
committerKevin Wolf <kwolf@redhat.com>2021-03-19 10:17:14 +0100
commitffd58ef88c73700113e0808e8222ef4d22224f33 (patch)
tree37d81679fc757d837f9eec23e31f09d7428edae4 /include/qom
parentfa40e43ca01b8ddd174daf6863282d987e57a235 (diff)
qom: Add user_creatable_add_from_str()
This is a version of user_creatable_process_cmdline() with an Error parameter that never calls exit() and is therefore usable in HMP. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include/qom')
-rw-r--r--include/qom/object_interfaces.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index 1e6c51b541..07511e6cff 100644
--- a/include/qom/object_interfaces.h
+++ b/include/qom/object_interfaces.h
@@ -145,6 +145,22 @@ int user_creatable_add_opts_foreach(void *opaque,
QemuOpts *opts, Error **errp);
/**
+ * user_creatable_add_from_str:
+ * @optarg: the object definition string as passed on the command line
+ * @errp: if an error occurs, a pointer to an area to store the error
+ *
+ * Create an instance of the user creatable object by parsing optarg
+ * with a keyval parser and implicit key 'qom-type', converting the
+ * result to ObjectOptions and calling into qmp_object_add().
+ *
+ * If a help option is given, print help instead.
+ *
+ * Returns: true when an object was successfully created, false when an error
+ * occurred (*errp is set then) or help was printed (*errp is not set).
+ */
+bool user_creatable_add_from_str(const char *optarg, Error **errp);
+
+/**
* user_creatable_process_cmdline:
* @optarg: the object definition string as passed on the command line
*