diff options
author | Paul Brook <paul@codesourcery.com> | 2009-06-05 15:52:04 +0100 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2009-06-05 15:52:04 +0100 |
commit | 1431b6a17e6546569e09bcf8fb7773c925658d8f (patch) | |
tree | 83669665d82278a27b12d34d2fc1847944e784de /hw/qdev.h | |
parent | fd93a79999c728dd1f30bb2e726ce12bdf704e6d (diff) |
Record device property types
Record device property types, and provide a list of properties at device
registration time.
Add a "device" property type that holds a reference to annother device.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/qdev.h')
-rw-r--r-- | hw/qdev.h | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -49,6 +49,7 @@ void qdev_free(DeviceState *dev); /* Set properties between creation and init. */ void qdev_set_prop_int(DeviceState *dev, const char *name, uint64_t value); +void qdev_set_prop_dev(DeviceState *dev, const char *name, DeviceState *value); void qdev_set_prop_ptr(DeviceState *dev, const char *name, void *value); void qdev_set_netdev(DeviceState *dev, NICInfo *nd); @@ -59,6 +60,17 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name); /*** Device API. ***/ +typedef enum { + PROP_TYPE_INT, + PROP_TYPE_PTR, + PROP_TYPE_DEV +} DevicePropType; + +typedef struct { + const char *name; + DevicePropType type; +} DevicePropList; + typedef struct DeviceInfo DeviceInfo; typedef void (*qdev_initfn)(DeviceState *dev, DeviceInfo *info); @@ -68,6 +80,7 @@ typedef void (*SCSIAttachFn)(DeviceState *host, BlockDriverState *bdrv, struct DeviceInfo { qdev_initfn init; BusType bus_type; + DevicePropList *props; }; void qdev_register(const char *name, int size, DeviceInfo *info); @@ -83,6 +96,8 @@ CharDriverState *qdev_init_chardev(DeviceState *dev); BusState *qdev_get_parent_bus(DeviceState *dev); uint64_t qdev_get_prop_int(DeviceState *dev, const char *name, uint64_t def); +DeviceState *qdev_get_prop_dev(DeviceState *dev, const char *name); +/* FIXME: Remove opaque pointer properties. */ void *qdev_get_prop_ptr(DeviceState *dev, const char *name); /* Convery from a base type to a parent type, with compile time checking. */ |