vfio/pci: Split out VGA setup
[qemu/ar7.git] / qom / qom-qobject.c
blob9cbc4c69a6f23e7bcdfdf8d93c0ea639a0aca157
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/osdep.h"
13 #include "qemu-common.h"
14 #include "qom/object.h"
15 #include "qom/qom-qobject.h"
16 #include "qapi/visitor.h"
17 #include "qapi/qmp-input-visitor.h"
18 #include "qapi/qmp-output-visitor.h"
20 void object_property_set_qobject(Object *obj, QObject *value,
21 const char *name, Error **errp)
23 QmpInputVisitor *qiv;
24 qiv = qmp_input_visitor_new(value);
25 object_property_set(obj, qmp_input_get_visitor(qiv), name, errp);
27 qmp_input_visitor_cleanup(qiv);
30 QObject *object_property_get_qobject(Object *obj, const char *name,
31 Error **errp)
33 QObject *ret = NULL;
34 Error *local_err = NULL;
35 QmpOutputVisitor *qov;
37 qov = qmp_output_visitor_new();
38 object_property_get(obj, qmp_output_get_visitor(qov), name, &local_err);
39 if (!local_err) {
40 ret = qmp_output_get_qobject(qov);
42 error_propagate(errp, local_err);
43 qmp_output_visitor_cleanup(qov);
44 return ret;