aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-disk.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-11-26 15:34:07 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:39 -0600
commit8d3628fff4131775dd4b7ad1748e0deb0b53aae8 (patch)
tree25d0d2290c593121613bc4d2f787f29472752f4b /hw/scsi-disk.c
parentebddfcbe14c0184ef3821b987b0a9746b4802c27 (diff)
scsi-disk: restruct emulation: START_STOP
Move START_STOP emulation from scsi_send_command() to scsi_disk_emulate_command(). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r--hw/scsi-disk.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 06289c3c18..11e85f28ff 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -670,6 +670,12 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
if (req->cmd.buf[1] & 3)
goto illegal_request;
break;
+ case START_STOP:
+ if (bdrv_get_type_hint(bdrv) == BDRV_TYPE_CDROM && (req->cmd.buf[4] & 2)) {
+ /* load/eject medium */
+ bdrv_eject(bdrv, !(req->cmd.buf[4] & 1));
+ }
+ break;
default:
goto illegal_request;
}
@@ -781,6 +787,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
case RESERVE_10:
case RELEASE:
case RELEASE_10:
+ case START_STOP:
rc = scsi_disk_emulate_command(&r->req, outbuf);
if (rc > 0) {
r->iov.iov_len = rc;
@@ -790,13 +797,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
return 0;
}
break;
- case START_STOP:
- DPRINTF("Start Stop Unit\n");
- if (bdrv_get_type_hint(s->qdev.dinfo->bdrv) == BDRV_TYPE_CDROM &&
- (buf[4] & 2))
- /* load/eject medium */
- bdrv_eject(s->qdev.dinfo->bdrv, !(buf[4] & 1));
- break;
case ALLOW_MEDIUM_REMOVAL:
DPRINTF("Prevent Allow Medium Removal (prevent = %d)\n", buf[4] & 3);
bdrv_set_locked(s->qdev.dinfo->bdrv, buf[4] & 1);