vmsvga: don't process more than 1024 fifo commands at once
[qemu.git] / qom / qom-qobject.c
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
12 #include "qemu/osdep.h"
13 #include "qapi/error.h"
14 #include "qemu-common.h"
15 #include "qom/object.h"
16 #include "qom/qom-qobject.h"
17 #include "qapi/visitor.h"
18 #include "qapi/qmp-input-visitor.h"
19 #include "qapi/qmp-output-visitor.h"
20
21 void object_property_set_qobject(Object *obj, QObject *value,
22 const char *name, Error **errp)
23 {
24 QmpInputVisitor *qiv;
25 /* TODO: Should we reject, rather than ignore, excess input? */
26 qiv = qmp_input_visitor_new(value, false);
27 object_property_set(obj, qmp_input_get_visitor(qiv), name, errp);
28
29 qmp_input_visitor_cleanup(qiv);
30 }
31
32 QObject *object_property_get_qobject(Object *obj, const char *name,
33 Error **errp)
34 {
35 QObject *ret = NULL;
36 Error *local_err = NULL;
37 QmpOutputVisitor *qov;
38
39 qov = qmp_output_visitor_new();
40 object_property_get(obj, qmp_output_get_visitor(qov), name, &local_err);
41 if (!local_err) {
42 ret = qmp_output_get_qobject(qov);
43 }
44 error_propagate(errp, local_err);
45 qmp_output_visitor_cleanup(qov);
46 return ret;
47 }