virtio-scsi-ccw: switch to new API
Here the virtio-scsi-ccw is modified for the new API. The device virtio-scsi-ccw extends virtio-ccw-device as before. It creates and connects a virtio-scsi during the init. The properties are not modified. Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com> Message-id: 1363875320-7985-8-git-send-email-fred.konrad@greensocs.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
9ef13d8f19
commit
c908ea1052
@ -626,22 +626,24 @@ static int virtio_ccw_balloon_exit(VirtioCcwDevice *dev)
|
||||
return virtio_ccw_exit(dev);
|
||||
}
|
||||
|
||||
static int virtio_ccw_scsi_init(VirtioCcwDevice *dev)
|
||||
static int virtio_ccw_scsi_init(VirtioCcwDevice *ccw_dev)
|
||||
{
|
||||
VirtIODevice *vdev;
|
||||
VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(ccw_dev);
|
||||
DeviceState *vdev = DEVICE(&dev->vdev);
|
||||
|
||||
vdev = virtio_scsi_init((DeviceState *)dev, &dev->scsi);
|
||||
if (!vdev) {
|
||||
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
|
||||
if (qdev_init(vdev) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return virtio_ccw_device_init(dev, vdev);
|
||||
return virtio_ccw_device_init(ccw_dev, VIRTIO_DEVICE(vdev));
|
||||
}
|
||||
|
||||
static int virtio_ccw_scsi_exit(VirtioCcwDevice *dev)
|
||||
static void virtio_ccw_scsi_instance_init(Object *obj)
|
||||
{
|
||||
virtio_scsi_exit(dev->vdev);
|
||||
return virtio_ccw_exit(dev);
|
||||
VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(obj);
|
||||
object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_SCSI);
|
||||
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
|
||||
}
|
||||
|
||||
static int virtio_ccw_rng_init(VirtioCcwDevice *dev)
|
||||
@ -832,7 +834,7 @@ static const TypeInfo virtio_ccw_balloon = {
|
||||
|
||||
static Property virtio_ccw_scsi_properties[] = {
|
||||
DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id),
|
||||
DEFINE_VIRTIO_SCSI_PROPERTIES(VirtioCcwDevice, scsi),
|
||||
DEFINE_VIRTIO_SCSI_PROPERTIES(VirtIOSCSICcw, vdev.conf),
|
||||
DEFINE_VIRTIO_SCSI_FEATURES(VirtioCcwDevice, host_features[0]),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
@ -843,15 +845,16 @@ static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data)
|
||||
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = virtio_ccw_scsi_init;
|
||||
k->exit = virtio_ccw_scsi_exit;
|
||||
k->exit = virtio_ccw_exit;
|
||||
dc->reset = virtio_ccw_reset;
|
||||
dc->props = virtio_ccw_scsi_properties;
|
||||
}
|
||||
|
||||
static const TypeInfo virtio_ccw_scsi = {
|
||||
.name = "virtio-scsi-ccw",
|
||||
.name = TYPE_VIRTIO_SCSI_CCW,
|
||||
.parent = TYPE_VIRTIO_CCW_DEVICE,
|
||||
.instance_size = sizeof(VirtioCcwDevice),
|
||||
.instance_size = sizeof(VirtIOSCSICcw),
|
||||
.instance_init = virtio_ccw_scsi_instance_init,
|
||||
.class_init = virtio_ccw_scsi_class_init,
|
||||
};
|
||||
|
||||
|
@ -76,7 +76,6 @@ struct VirtioCcwDevice {
|
||||
uint32_t host_features[VIRTIO_CCW_FEATURE_SIZE];
|
||||
virtio_serial_conf serial;
|
||||
virtio_net_conf net;
|
||||
VirtIOSCSIConf scsi;
|
||||
VirtIORNGConf rng;
|
||||
VirtioBusState bus;
|
||||
/* Guest provided values: */
|
||||
@ -93,6 +92,17 @@ typedef struct VirtualCssBus {
|
||||
#define VIRTUAL_CSS_BUS(obj) \
|
||||
OBJECT_CHECK(VirtualCssBus, (obj), TYPE_VIRTUAL_CSS_BUS)
|
||||
|
||||
/* virtio-scsi-ccw */
|
||||
|
||||
#define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw"
|
||||
#define VIRTIO_SCSI_CCW(obj) \
|
||||
OBJECT_CHECK(VirtIOSCSICcw, (obj), TYPE_VIRTIO_SCSI_CCW)
|
||||
|
||||
typedef struct VirtIOSCSICcw {
|
||||
VirtioCcwDevice parent_obj;
|
||||
VirtIOSCSI vdev;
|
||||
} VirtIOSCSICcw;
|
||||
|
||||
/* virtio-blk-ccw */
|
||||
|
||||
#define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw"
|
||||
|
Loading…
Reference in New Issue
Block a user