From ddf6dae7e34271332fbc04921d0c91ab6a009b5a Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 19 Feb 2021 18:14:01 +0100 Subject: 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 Acked-by: Paolo Bonzini Acked-by: Peter Krempa Reviewed-by: Eric Blake --- include/qom/object_interfaces.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/qom') diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h index 07511e6..fb32330 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 -- cgit v1.1