aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-11-26 15:34:08 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:39 -0600
commitc68b9f34c136ce4ff77fc165227596b267e15fa1 (patch)
tree825966676109001a29a8f017ce17e4fa6762ee17
parent8d3628fff4131775dd4b7ad1748e0deb0b53aae8 (diff)
scsi-disk: restruct emulation: ALLOW_MEDIUM_REMOVAL
Move ALLOW_MEDIUM_REMOVAL 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>
-rw-r--r--hw/scsi-disk.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 11e85f28ff..7d59998995 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -676,6 +676,9 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
bdrv_eject(bdrv, !(req->cmd.buf[4] & 1));
}
break;
+ case ALLOW_MEDIUM_REMOVAL:
+ bdrv_set_locked(bdrv, req->cmd.buf[4] & 1);
+ break;
default:
goto illegal_request;
}
@@ -788,6 +791,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
case RELEASE:
case RELEASE_10:
case START_STOP:
+ case ALLOW_MEDIUM_REMOVAL:
rc = scsi_disk_emulate_command(&r->req, outbuf);
if (rc > 0) {
r->iov.iov_len = rc;
@@ -797,10 +801,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
return 0;
}
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);
- break;
case READ_CAPACITY:
DPRINTF("Read Capacity\n");
/* The normal LEN field for this command is zero. */