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
This commit is contained in:
Anthony Liguori 2011-12-16 14:34:46 -06:00
parent 2f28d2ff9d
commit 32fea4025b
2 changed files with 35 additions and 2 deletions

View file

@ -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;