aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-generic.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-08-03 10:49:08 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-12 08:27:36 -0500
commit8dbd4574882cade8261c2b6225df68a65345c75c (patch)
tree59101dbc9f0c5d838294da898122fe6e0c59881f /hw/scsi-generic.c
parentb45ef674f4c403398e75c6be02e27a0bfa813a11 (diff)
downloadqemu-8dbd4574882cade8261c2b6225df68a65345c75c.zip
qemu-8dbd4574882cade8261c2b6225df68a65345c75c.tar.gz
qemu-8dbd4574882cade8261c2b6225df68a65345c75c.tar.bz2
scsi: introduce SCSIReqOps
This will let allow requests to be dispatched through different callbacks, either common or per-device. This patch adjusts the API, the next one will move members to SCSIReqOps. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r--hw/scsi-generic.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 37c5982..80d1601 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -63,15 +63,6 @@ struct SCSIGenericState
int lun;
};
-static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
- void *hba_private)
-{
- SCSIRequest *req;
-
- req = scsi_req_alloc(sizeof(SCSIGenericReq), d, tag, lun, hba_private);
- return req;
-}
-
static void scsi_free_request(SCSIRequest *req)
{
SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req);
@@ -498,6 +489,19 @@ static int scsi_generic_initfn(SCSIDevice *dev)
return 0;
}
+static SCSIReqOps scsi_generic_req_ops = {
+ .size = sizeof(SCSIGenericReq),
+};
+
+static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
+ void *hba_private)
+{
+ SCSIRequest *req;
+
+ req = scsi_req_alloc(&scsi_generic_req_ops, d, tag, lun, hba_private);
+ return req;
+}
+
static SCSIDeviceInfo scsi_generic_info = {
.qdev.name = "scsi-generic",
.qdev.desc = "pass through generic scsi device (/dev/sg*)",