aboutsummaryrefslogtreecommitdiff
path: root/include/qom
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2021-02-19 18:14:01 +0100
committerKevin Wolf <kwolf@redhat.com>2021-03-19 10:17:14 +0100
commitddf6dae7e34271332fbc04921d0c91ab6a009b5a (patch)
tree589d41617710da49074d54040d8555717f72e9c2 /include/qom
parentda0a932bbf06a71210300893eeb4d51217238b11 (diff)
qom: Add user_creatable_parse_str()
The system emulator has a more complicated way of handling command line options in that it reorders options before it processes them. This means that parsing object options and creating the object happen at two different points. Split the parsing part into a separate function that can be reused by the system emulator command line. 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.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index 07511e6cff..fb32330901 100644
--- a/include/qom/object_interfaces.h
+++ b/include/qom/object_interfaces.h
@@ -145,6 +145,21 @@ int user_creatable_add_opts_foreach(void *opaque,
QemuOpts *opts, Error **errp);
/**
+ * user_creatable_parse_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
+ *
+ * Parses the option for the user creatable object with a keyval parser and
+ * implicit key 'qom-type', converting the result to ObjectOptions.
+ *
+ * If a help option is given, print help instead.
+ *
+ * Returns: ObjectOptions on success, NULL when an error occurred (*errp is set
+ * then) or help was printed (*errp is not set).
+ */
+ObjectOptions *user_creatable_parse_str(const char *optarg, 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