aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2020-10-20 13:27:22 +0200
committerKevin Wolf <kwolf@redhat.com>2021-03-19 10:17:14 +0100
commit9151e59a8b6e854eb733553c6772351049ca6ab6 (patch)
tree7732e240fff253f03be6ad9bb9239d37a04b456f /hw
parent17422da082ffcecb38bd1f2e2de6d56a61e8cd9c (diff)
qapi/qom: QAPIfy object-add
This converts object-add from 'gen': false to the ObjectOptions QAPI type. As an immediate benefit, clients can now use QAPI schema introspection for user creatable QOM objects. It is also the first step towards making the QAPI schema the only external interface for the creation of user creatable objects. Once all other places (HMP and command lines of the system emulator and all tools) go through QAPI, too, some object implementations can be simplified because some checks (e.g. that mandatory options are set) are already performed by QAPI, and in another step, QOM boilerplate code could be generated from the schema. 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 'hw')
-rw-r--r--hw/block/xen-block.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index a3b69e2709..ac82d54063 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -836,17 +836,17 @@ static XenBlockIOThread *xen_block_iothread_create(const char *id,
{
ERRP_GUARD();
XenBlockIOThread *iothread = g_new(XenBlockIOThread, 1);
- QDict *opts;
- QObject *ret_data = NULL;
+ ObjectOptions *opts;
iothread->id = g_strdup(id);
- opts = qdict_new();
- qdict_put_str(opts, "qom-type", TYPE_IOTHREAD);
- qdict_put_str(opts, "id", id);
- qmp_object_add(opts, &ret_data, errp);
- qobject_unref(opts);
- qobject_unref(ret_data);
+ opts = g_new(ObjectOptions, 1);
+ *opts = (ObjectOptions) {
+ .qom_type = OBJECT_TYPE_IOTHREAD,
+ .id = g_strdup(id),
+ };
+ qmp_object_add(opts, errp);
+ qapi_free_ObjectOptions(opts);
if (*errp) {
g_free(iothread->id);