mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 02:58:29 +00:00
qom: Factor out user_creatable_process_cmdline()
The implementation for --object can be shared between qemu-storage-daemon and other binaries, so move it into a function in qom/object_interfaces.c that is accessible from everywhere. This also requires moving the implementation of qmp_object_add() into a new user_creatable_add_qapi(), because qom/qom-qmp-cmds.c is not linked for tools. user_creatable_print_help_from_qdict() can become static now. 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>
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
#include "qapi/qapi-visit-block-export.h"
|
||||
#include "qapi/qapi-visit-control.h"
|
||||
#include "qapi/qapi-visit-qom.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qobject-input-visitor.h"
|
||||
@@ -271,27 +270,8 @@ static void process_options(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
case OPTION_OBJECT:
|
||||
{
|
||||
QDict *args;
|
||||
bool help;
|
||||
Visitor *v;
|
||||
ObjectOptions *options;
|
||||
|
||||
args = keyval_parse(optarg, "qom-type", &help, &error_fatal);
|
||||
if (help) {
|
||||
user_creatable_print_help_from_qdict(args);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
v = qobject_input_visitor_new_keyval(QOBJECT(args));
|
||||
visit_type_ObjectOptions(v, NULL, &options, &error_fatal);
|
||||
visit_free(v);
|
||||
qobject_unref(args);
|
||||
|
||||
qmp_object_add(options, &error_fatal);
|
||||
qapi_free_ObjectOptions(options);
|
||||
break;
|
||||
}
|
||||
user_creatable_process_cmdline(optarg);
|
||||
break;
|
||||
case OPTION_PIDFILE:
|
||||
pid_file = optarg;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user