summary refs log tree commit diff stats
path: root/hw/scsi
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-09-17 18:10:37 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2014-09-23 15:40:51 +0200
commit9df7bfddcc25a22b99be5fe9b14ce367fa43b106 (patch)
treecfa4402c20b4fcb44c875622cd644864115efa41 /hw/scsi
parent7ce0425575745a40e94e75426607e0bec17899fa (diff)
downloadfocaccia-qemu-9df7bfddcc25a22b99be5fe9b14ce367fa43b106.tar.gz
focaccia-qemu-9df7bfddcc25a22b99be5fe9b14ce367fa43b106.zip
virtio-scsi: clean up virtio_scsi_parse_cdb
The command direction according to the guest-passed buffers
is already stored in the VirtIOSCSIReq.  We can use it instead
of computing it again from req->elem.

Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/virtio-scsi.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index f0d21a3fda..6953cbe6dd 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -430,13 +430,7 @@ static int virtio_scsi_parse_cdb(SCSIDevice *dev, SCSICommand *cmd,
      * host device passthrough.
      */
     cmd->xfer = req->qsgl.size;
-    if (cmd->xfer == 0) {
-        cmd->mode = SCSI_XFER_NONE;
-    } else if (iov_size(req->elem.in_sg, req->elem.in_num) > req->resp_size) {
-        cmd->mode = SCSI_XFER_FROM_DEV;
-    } else {
-        cmd->mode = SCSI_XFER_TO_DEV;
-    }
+    cmd->mode = req->mode;
     return 0;
 }