aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-bus.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-11-26 15:34:00 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:37 -0600
commited3a34a3c8dcae6f46556ae7e2a667e6c16c8daa (patch)
tree8cd220129db344fef2e540adff3b87d158880e1e /hw/scsi-bus.c
parent251882b7e4532cb42fca89412bb6670dcec4158f (diff)
scsi: move status to SCSIRequest.
Also add and use the scsi_req_complete() helper function for calling the completion callback. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-bus.c')
-rw-r--r--hw/scsi-bus.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 666ca3c41c..2e4fd3874c 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -132,6 +132,7 @@ SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t l
req->dev = d;
req->tag = tag;
req->lun = lun;
+ req->status = -1;
QTAILQ_INSERT_TAIL(&d->requests, req, next);
return req;
}
@@ -362,3 +363,11 @@ int scsi_req_parse(SCSIRequest *req, uint8_t *buf)
req->cmd.lba = scsi_req_lba(req);
return 0;
}
+
+void scsi_req_complete(SCSIRequest *req)
+{
+ assert(req->status != -1);
+ req->bus->complete(req->bus, SCSI_REASON_DONE,
+ req->tag,
+ req->status);
+}