mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06: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:
parent
c923112390
commit
f375026606
4 changed files with 81 additions and 55 deletions
|
@ -228,25 +228,7 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
|
|||
|
||||
void qmp_object_add(ObjectOptions *options, Error **errp)
|
||||
{
|
||||
Visitor *v;
|
||||
QObject *qobj;
|
||||
QDict *props;
|
||||
Object *obj;
|
||||
|
||||
v = qobject_output_visitor_new(&qobj);
|
||||
visit_type_ObjectOptions(v, NULL, &options, &error_abort);
|
||||
visit_complete(v, &qobj);
|
||||
visit_free(v);
|
||||
|
||||
props = qobject_to(QDict, qobj);
|
||||
qdict_del(props, "qom-type");
|
||||
qdict_del(props, "id");
|
||||
|
||||
v = qobject_input_visitor_new(QOBJECT(props));
|
||||
obj = user_creatable_add_type(ObjectType_str(options->qom_type),
|
||||
options->id, props, v, errp);
|
||||
object_unref(obj);
|
||||
visit_free(v);
|
||||
user_creatable_add_qapi(options, errp);
|
||||
}
|
||||
|
||||
void qmp_object_del(const char *id, Error **errp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue