target-i386: Add API to get note's size
[qemu/ar7.git] / qom / qom-qobject.c
blob0689914e15d74b8e2423f214d6a83071e0a8a993
1 /*
2 * QEMU Object Model - QObject wrappers
4 * Copyright (C) 2012 Red Hat, Inc.
6 * Author: Paolo Bonzini <pbonzini@redhat.com>
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.
12 #include "qemu-common.h"
13 #include "qemu/object.h"
14 #include "qemu/qom-qobject.h"
15 #include "qapi/qapi-visit-core.h"
16 #include "qapi/qmp-input-visitor.h"
17 #include "qapi/qmp-output-visitor.h"
19 void object_property_set_qobject(Object *obj, QObject *value,
20 const char *name, Error **errp)
22 QmpInputVisitor *mi;
23 mi = qmp_input_visitor_new(value);
24 object_property_set(obj, qmp_input_get_visitor(mi), name, errp);
26 qmp_input_visitor_cleanup(mi);
29 QObject *object_property_get_qobject(Object *obj, const char *name,
30 Error **errp)
32 QObject *ret = NULL;
33 Error *local_err = NULL;
34 QmpOutputVisitor *mo;
36 mo = qmp_output_visitor_new();
37 object_property_get(obj, qmp_output_get_visitor(mo), name, &local_err);
38 if (!local_err) {
39 ret = qmp_output_get_qobject(mo);
41 error_propagate(errp, local_err);
42 qmp_output_visitor_cleanup(mo);
43 return ret;