mirror of https://github.com/xqemu/xqemu.git
scsi-disk: restruct emulation: RESERVE+RELEASE
Move RESERVE+RELEASE 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>
This commit is contained in:
parent
0b06c05979
commit
3d53ba18f5
|
@ -473,6 +473,22 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
|
||||||
if (buflen < 0)
|
if (buflen < 0)
|
||||||
goto illegal_request;
|
goto illegal_request;
|
||||||
break;
|
break;
|
||||||
|
case RESERVE:
|
||||||
|
if (req->cmd.buf[1] & 1)
|
||||||
|
goto illegal_request;
|
||||||
|
break;
|
||||||
|
case RESERVE_10:
|
||||||
|
if (req->cmd.buf[1] & 3)
|
||||||
|
goto illegal_request;
|
||||||
|
break;
|
||||||
|
case RELEASE:
|
||||||
|
if (req->cmd.buf[1] & 1)
|
||||||
|
goto illegal_request;
|
||||||
|
break;
|
||||||
|
case RELEASE_10:
|
||||||
|
if (req->cmd.buf[1] & 3)
|
||||||
|
goto illegal_request;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
goto illegal_request;
|
goto illegal_request;
|
||||||
}
|
}
|
||||||
|
@ -578,6 +594,10 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
|
||||||
case TEST_UNIT_READY:
|
case TEST_UNIT_READY:
|
||||||
case REQUEST_SENSE:
|
case REQUEST_SENSE:
|
||||||
case INQUIRY:
|
case INQUIRY:
|
||||||
|
case RESERVE:
|
||||||
|
case RESERVE_10:
|
||||||
|
case RELEASE:
|
||||||
|
case RELEASE_10:
|
||||||
rc = scsi_disk_emulate_command(&r->req, outbuf);
|
rc = scsi_disk_emulate_command(&r->req, outbuf);
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
r->iov.iov_len = rc;
|
r->iov.iov_len = rc;
|
||||||
|
@ -587,16 +607,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RESERVE:
|
|
||||||
DPRINTF("Reserve(6)\n");
|
|
||||||
if (buf[1] & 1)
|
|
||||||
goto fail;
|
|
||||||
break;
|
|
||||||
case RELEASE:
|
|
||||||
DPRINTF("Release(6)\n");
|
|
||||||
if (buf[1] & 1)
|
|
||||||
goto fail;
|
|
||||||
break;
|
|
||||||
case MODE_SENSE:
|
case MODE_SENSE:
|
||||||
case MODE_SENSE_10:
|
case MODE_SENSE_10:
|
||||||
{
|
{
|
||||||
|
@ -857,16 +867,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
|
||||||
outbuf[7] = 8; // CD-ROM
|
outbuf[7] = 8; // CD-ROM
|
||||||
r->iov.iov_len = 8;
|
r->iov.iov_len = 8;
|
||||||
break;
|
break;
|
||||||
case RESERVE_10:
|
|
||||||
DPRINTF("Reserve(10)\n");
|
|
||||||
if (buf[1] & 3)
|
|
||||||
goto fail;
|
|
||||||
break;
|
|
||||||
case RELEASE_10:
|
|
||||||
DPRINTF("Release(10)\n");
|
|
||||||
if (buf[1] & 3)
|
|
||||||
goto fail;
|
|
||||||
break;
|
|
||||||
case 0x9e:
|
case 0x9e:
|
||||||
/* Service Action In subcommands. */
|
/* Service Action In subcommands. */
|
||||||
if ((buf[1] & 31) == 0x10) {
|
if ((buf[1] & 31) == 0x10) {
|
||||||
|
|
Loading…
Reference in New Issue