From 8dbd4574882cade8261c2b6225df68a65345c75c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 3 Aug 2011 10:49:08 +0200 Subject: 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 Signed-off-by: Anthony Liguori --- hw/scsi-generic.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'hw/scsi-generic.c') diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index 37c598271a..80d1601039 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*)", -- cgit 1.4.1