mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-07 16:52:06 +00:00
scsi-disk: restruct emulation: REPORT_LUNS
Move REPORT_LUNS emulation from scsi_send_command() to scsi_disk_emulate_command(). Also add REPORT_LUNS to scsi-defs.h and scsi_command_name(). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
5dd90e2ad7
commit
39ec9a504d
@ -442,6 +442,7 @@ static const char *scsi_command_name(uint8_t cmd)
|
|||||||
[ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT",
|
[ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT",
|
||||||
[ GET_CONFIGURATION ] = "GET_CONFIGURATION",
|
[ GET_CONFIGURATION ] = "GET_CONFIGURATION",
|
||||||
[ SERVICE_ACTION_IN ] = "SERVICE_ACTION_IN",
|
[ SERVICE_ACTION_IN ] = "SERVICE_ACTION_IN",
|
||||||
|
[ REPORT_LUNS ] = "REPORT_LUNS",
|
||||||
[ LOAD_UNLOAD ] = "LOAD_UNLOAD",
|
[ LOAD_UNLOAD ] = "LOAD_UNLOAD",
|
||||||
[ SET_CD_SPEED ] = "SET_CD_SPEED",
|
[ SET_CD_SPEED ] = "SET_CD_SPEED",
|
||||||
[ BLANK ] = "BLANK",
|
[ BLANK ] = "BLANK",
|
||||||
|
@ -101,6 +101,7 @@
|
|||||||
#define REPORT_DENSITY_SUPPORT 0x44
|
#define REPORT_DENSITY_SUPPORT 0x44
|
||||||
#define GET_CONFIGURATION 0x46
|
#define GET_CONFIGURATION 0x46
|
||||||
#define SERVICE_ACTION_IN 0x9e
|
#define SERVICE_ACTION_IN 0x9e
|
||||||
|
#define REPORT_LUNS 0xa0
|
||||||
#define LOAD_UNLOAD 0xa6
|
#define LOAD_UNLOAD 0xa6
|
||||||
#define SET_CD_SPEED 0xbb
|
#define SET_CD_SPEED 0xbb
|
||||||
#define BLANK 0xa1
|
#define BLANK 0xa1
|
||||||
|
@ -787,6 +787,13 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
|
|||||||
}
|
}
|
||||||
DPRINTF("Unsupported Service Action In\n");
|
DPRINTF("Unsupported Service Action In\n");
|
||||||
goto illegal_request;
|
goto illegal_request;
|
||||||
|
case REPORT_LUNS:
|
||||||
|
if (req->cmd.xfer < 16)
|
||||||
|
goto illegal_request;
|
||||||
|
memset(outbuf, 0, 16);
|
||||||
|
outbuf[3] = 8;
|
||||||
|
buflen = 16;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
goto illegal_request;
|
goto illegal_request;
|
||||||
}
|
}
|
||||||
@ -904,6 +911,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
|
|||||||
case READ_TOC:
|
case READ_TOC:
|
||||||
case GET_CONFIGURATION:
|
case GET_CONFIGURATION:
|
||||||
case SERVICE_ACTION_IN:
|
case SERVICE_ACTION_IN:
|
||||||
|
case REPORT_LUNS:
|
||||||
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;
|
||||||
@ -932,14 +940,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
|
|||||||
r->sector_count = len * s->cluster_size;
|
r->sector_count = len * s->cluster_size;
|
||||||
is_write = 1;
|
is_write = 1;
|
||||||
break;
|
break;
|
||||||
case 0xa0:
|
|
||||||
DPRINTF("Report LUNs (len %d)\n", len);
|
|
||||||
if (len < 16)
|
|
||||||
goto fail;
|
|
||||||
memset(outbuf, 0, 16);
|
|
||||||
outbuf[3] = 8;
|
|
||||||
r->iov.iov_len = 16;
|
|
||||||
break;
|
|
||||||
case VERIFY:
|
case VERIFY:
|
||||||
DPRINTF("Verify (sector %" PRId64 ", count %d)\n", lba, len);
|
DPRINTF("Verify (sector %" PRId64 ", count %d)\n", lba, len);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user