aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev.h
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-16 14:34:46 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-27 10:28:30 -0600
commit32fea4025bfb80f2dbc5c3ce415703af28d85f63 (patch)
tree3785efc163bd9bc3d9a0bf96a6d5ecf99be68163 /hw/qdev.h
parent2f28d2ff9dce3c404b36e90e64541a4d48daf0ca (diff)
qdev: integrate with QEMU Object Model (v2)
This is a very shallow integration. We register a TYPE_DEVICE but only use QOM as basically a memory allocator. This will make all devices show up as QOM objects but they will all carry the TYPE_DEVICE. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- v1 -> v2 - update for new location of object.h
Diffstat (limited to 'hw/qdev.h')
-rw-r--r--hw/qdev.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/qdev.h b/hw/qdev.h
index 6b58dd8aeb..1e01a042ce 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -6,6 +6,7 @@
#include "qemu-char.h"
#include "qemu-option.h"
#include "qapi/qapi-visit-core.h"
+#include "qemu/object.h"
typedef struct Property Property;
@@ -66,9 +67,18 @@ typedef struct DeviceProperty
QTAILQ_ENTRY(DeviceProperty) node;
} DeviceProperty;
+#define TYPE_DEVICE "device"
+#define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE)
+
+typedef struct DeviceClass {
+ ObjectClass parent_class;
+} DeviceClass;
+
/* This structure should not be accessed directly. We declare it here
so that it can be embedded in individual device state structures. */
struct DeviceState {
+ Object parent_obj;
+
const char *id;
enum DevState state;
QemuOpts *opts;