]> git.proxmox.com Git - mirror_qemu.git/blame - qom/qom-qobject.c
block: freeze the backing chain earlier in stream_start()
[mirror_qemu.git] / qom / qom-qobject.c
CommitLineData
9f5f1350
PB
1/*
2 * QEMU Object Model - QObject wrappers
3 *
4 * Copyright (C) 2012 Red Hat, Inc.
5 *
6 * Author: Paolo Bonzini <pbonzini@redhat.com>
7 *
8 * This work is licensed under the terms of the GNU GPL, version 2 or later.
9 * See the COPYING file in the top-level directory.
10 */
11
9bbc853b 12#include "qemu/osdep.h"
da34e65c 13#include "qapi/error.h"
9f5f1350 14#include "qemu-common.h"
14cccb61
PB
15#include "qom/object.h"
16#include "qom/qom-qobject.h"
7b1b5d19 17#include "qapi/visitor.h"
b3db211f
DB
18#include "qapi/qobject-input-visitor.h"
19#include "qapi/qobject-output-visitor.h"
9f5f1350
PB
20
21void object_property_set_qobject(Object *obj, QObject *value,
22 const char *name, Error **errp)
23{
b70ce101 24 Visitor *v;
05601ed2 25
048abb7b 26 v = qobject_input_visitor_new(value);
b70ce101
EB
27 object_property_set(obj, v, name, errp);
28 visit_free(v);
9f5f1350
PB
29}
30
31QObject *object_property_get_qobject(Object *obj, const char *name,
32 Error **errp)
33{
34 QObject *ret = NULL;
35 Error *local_err = NULL;
3b098d56 36 Visitor *v;
9f5f1350 37
7d5e199a 38 v = qobject_output_visitor_new(&ret);
3b098d56 39 object_property_get(obj, v, name, &local_err);
9f5f1350 40 if (!local_err) {
3b098d56 41 visit_complete(v, &ret);
9f5f1350
PB
42 }
43 error_propagate(errp, local_err);
3b098d56 44 visit_free(v);
9f5f1350
PB
45 return ret;
46}