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>
This commit is contained in:
Gerd Hoffmann 2009-11-26 15:34:00 +01:00 committed by Anthony Liguori
parent 251882b7e4
commit ed3a34a3c8
4 changed files with 27 additions and 15 deletions

View file

@ -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);
}