aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-generic.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-15 14:50:08 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-27 10:50:49 -0600
commitb9eea3e6a435a79fe308212157e0875442b760e4 (patch)
tree72820942672405937d8cb864f6cc9fa22dcfeed2 /hw/scsi-generic.c
parentd148211c6d64b6e59181a5b9c89117c541419cab (diff)
scsi: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r--hw/scsi-generic.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 0aebcddf6e..5cf40051eb 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -357,7 +357,7 @@ static int get_stream_blocksize(BlockDriverState *bdrv)
static void scsi_generic_reset(DeviceState *dev)
{
- SCSIDevice *s = DO_UPCAST(SCSIDevice, qdev, dev);
+ SCSIDevice *s = SCSI_DEVICE(dev);
scsi_device_purge_requests(s, SENSE_CODE(RESET));
}
@@ -457,16 +457,23 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
return req;
}
-static SCSIDeviceInfo scsi_generic_info = {
- .qdev.name = "scsi-generic",
- .qdev.fw_name = "disk",
- .qdev.desc = "pass through generic scsi device (/dev/sg*)",
- .qdev.size = sizeof(SCSIDevice),
- .qdev.reset = scsi_generic_reset,
- .init = scsi_generic_initfn,
- .destroy = scsi_destroy,
- .alloc_req = scsi_new_request,
- .qdev.props = (Property[]) {
+static void scsi_generic_class_initfn(ObjectClass *klass, void *data)
+{
+ SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
+
+ sc->init = scsi_generic_initfn;
+ sc->destroy = scsi_destroy;
+ sc->alloc_req = scsi_new_request;
+}
+
+static DeviceInfo scsi_generic_info = {
+ .name = "scsi-generic",
+ .fw_name = "disk",
+ .desc = "pass through generic scsi device (/dev/sg*)",
+ .size = sizeof(SCSIDevice),
+ .reset = scsi_generic_reset,
+ .class_init = scsi_generic_class_initfn,
+ .props = (Property[]) {
DEFINE_BLOCK_PROPERTIES(SCSIDevice, conf),
DEFINE_PROP_END_OF_LIST(),
},