diff options
author | KONRAD Frederic <fred.konrad@greensocs.com> | 2013-03-18 17:37:24 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-03-18 13:08:40 -0500 |
commit | 55d11e01cca9b83b8cdccbd29d4f078cbe4a185c (patch) | |
tree | f8ab4e71d1ce35761b008911a8ec1fb808d6cd5c /hw/s390x/s390-virtio-bus.c | |
parent | 653ced071b061bbd9cc7d03374be93dcefb37910 (diff) | |
download | qemu-55d11e01cca9b83b8cdccbd29d4f078cbe4a185c.zip |
virtio-blk-s390: switch to the new API.
Here the virtio-blk-s390 is modified for the new API. The device
virtio-blk-s390 extends virtio-s390-device as before. It creates and
connects a virtio-blk during the init. The properties are not modified.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363624648-16906-8-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/s390x/s390-virtio-bus.c')
-rw-r--r-- | hw/s390x/s390-virtio-bus.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 8d4fd72c80..76bc99a45a 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -162,16 +162,23 @@ static int s390_virtio_net_init(VirtIOS390Device *dev) return s390_virtio_device_init(dev, vdev); } -static int s390_virtio_blk_init(VirtIOS390Device *dev) +static int s390_virtio_blk_init(VirtIOS390Device *s390_dev) { - VirtIODevice *vdev; - - vdev = virtio_blk_init((DeviceState *)dev, &dev->blk); - if (!vdev) { + VirtIOBlkS390 *dev = VIRTIO_BLK_S390(s390_dev); + DeviceState *vdev = DEVICE(&dev->vdev); + virtio_blk_set_conf(vdev, &(dev->blk)); + qdev_set_parent_bus(vdev, BUS(&s390_dev->bus)); + if (qdev_init(vdev) < 0) { return -1; } + return s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev)); +} - return s390_virtio_device_init(dev, vdev); +static void s390_virtio_blk_instance_init(Object *obj) +{ + VirtIOBlkS390 *dev = VIRTIO_BLK_S390(obj); + object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_BLK); + object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); } static int s390_virtio_serial_init(VirtIOS390Device *dev) @@ -428,11 +435,11 @@ static const TypeInfo s390_virtio_net = { }; static Property s390_virtio_blk_properties[] = { - DEFINE_BLOCK_PROPERTIES(VirtIOS390Device, blk.conf), - DEFINE_BLOCK_CHS_PROPERTIES(VirtIOS390Device, blk.conf), - DEFINE_PROP_STRING("serial", VirtIOS390Device, blk.serial), + DEFINE_BLOCK_PROPERTIES(VirtIOBlkS390, blk.conf), + DEFINE_BLOCK_CHS_PROPERTIES(VirtIOBlkS390, blk.conf), + DEFINE_PROP_STRING("serial", VirtIOBlkS390, blk.serial), #ifdef __linux__ - DEFINE_PROP_BIT("scsi", VirtIOS390Device, blk.scsi, 0, true), + DEFINE_PROP_BIT("scsi", VirtIOBlkS390, blk.scsi, 0, true), #endif DEFINE_PROP_END_OF_LIST(), }; @@ -449,7 +456,8 @@ static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) static const TypeInfo s390_virtio_blk = { .name = "virtio-blk-s390", .parent = TYPE_VIRTIO_S390_DEVICE, - .instance_size = sizeof(VirtIOS390Device), + .instance_size = sizeof(VirtIOBlkS390), + .instance_init = s390_virtio_blk_instance_init, .class_init = s390_virtio_blk_class_init, }; |