diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-07 21:34:16 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-02-03 10:41:06 -0600 |
commit | 39bffca2030950ef6efe57c2fac8327a45ae1015 (patch) | |
tree | 325262f44978e6116c9e43f688c900e08ee83738 /hw/s390-virtio-bus.h | |
parent | 212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff) |
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and then
rebased it into a single step which avoids repeatedly touching every file in
the tree.
The first step was a sed-based addition of the parent type to the subclass
registration functions.
The second step was another sed-based removal of subclass registration functions
while also adding virtual functions from the base class into a class_init
function as appropriate.
Finally, a python script was used to convert the DeviceInfo structures and
qdev_register_subclass functions to TypeInfo structures, class_init functions,
and type_register_static calls.
We are almost fully converted to QOM after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/s390-virtio-bus.h')
-rw-r--r-- | hw/s390-virtio-bus.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/hw/s390-virtio-bus.h b/hw/s390-virtio-bus.h index d02a90709d..b5e59b7d4b 100644 --- a/hw/s390-virtio-bus.h +++ b/hw/s390-virtio-bus.h @@ -40,7 +40,22 @@ #define VIRTIO_PARAM_CONFIG_CHANGED 0x1 #define VIRTIO_PARAM_DEV_ADD 0x2 -typedef struct VirtIOS390Device { +#define TYPE_VIRTIO_S390_DEVICE "virtio-s390-device" +#define VIRTIO_S390_DEVICE(obj) \ + OBJECT_CHECK(VirtIOS390Device, (obj), TYPE_VIRTIO_S390_DEVICE) +#define VIRTIO_S390_DEVICE_CLASS(klass) \ + OBJECT_CLASS_CHECK(VirtIOS390DeviceClass, (klass), TYPE_VIRTIO_S390_DEVICE) +#define VIRTIO_S390_DEVICE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(VirtIOS390DeviceClass, (obj), TYPE_VIRTIO_S390_DEVICE) + +typedef struct VirtIOS390Device VirtIOS390Device; + +typedef struct VirtIOS390DeviceClass { + DeviceClass qdev; + int (*init)(VirtIOS390Device *dev); +} VirtIOS390DeviceClass; + +struct VirtIOS390Device { DeviceState qdev; ram_addr_t dev_offs; ram_addr_t feat_offs; @@ -52,7 +67,7 @@ typedef struct VirtIOS390Device { uint32_t host_features; virtio_serial_conf serial; virtio_net_conf net; -} VirtIOS390Device; +}; typedef struct VirtIOS390Bus { BusState bus; |