summaryrefslogtreecommitdiff
path: root/hw/scsi-bus.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-04-18 17:14:51 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2011-05-26 12:14:15 +0200
commit19d110ab8af3308ce58d0936f085f0124930e7e7 (patch)
tree66655ab907e2b6f1ea43dce26b394789fbd1e280 /hw/scsi-bus.c
parentc557e889156c5f5da23b4b047aea804aefce4982 (diff)
downloadqemu-19d110ab8af3308ce58d0936f085f0124930e7e7.zip
scsi: introduce scsi_req_abort
This covers the case of canceling a request's I/O and still completing it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
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 c1e94fac9e..d6a055fa54 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -549,6 +549,15 @@ void scsi_req_complete(SCSIRequest *req)
scsi_req_unref(req);
}
+void scsi_req_abort(SCSIRequest *req, int status)
+{
+ req->status = status;
+ if (req->dev && req->dev->info->cancel_io) {
+ req->dev->info->cancel_io(req);
+ }
+ scsi_req_complete(req);
+}
+
void scsi_device_purge_requests(SCSIDevice *sdev)
{
SCSIRequest *req;