From: Bart V. A. <bva...@ac...> - 2010-12-30 09:06:35
|
Hello, If I do not receive further feedback, I will apply the patch below on the SCST repo on kernel.org: Move the code for setting the removable media bit (RMB) to the section for generating the standard INQUIRY response and replace the multiple statements for setting the PAGE CODE when generating an EVPD response by a single statement. This fixes the bug that for removable media in the Supported Pages VDP response the page code was set to 0x80 instead of 0x00. Signed-off-by: Bart Van Assche <bva...@ac...> Cc: Vladislav Bolkhovitin <vs...@vl...> --- drivers/scst/dev_handlers/scst_vdisk.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/scst/dev_handlers/scst_vdisk.c b/drivers/scst/dev_handlers/scst_vdisk.c index 955bb0c..ea9718e 100644 --- a/drivers/scst/dev_handlers/scst_vdisk.c +++ b/drivers/scst/dev_handlers/scst_vdisk.c @@ -1353,10 +1353,9 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) } buf[0] = cmd->dev->type; /* type dev */ - if (virt_dev->removable) - buf[1] = 0x80; /* removable */ /* Vital Product */ if (cmd->cdb[1] & EVPD) { + buf[1] = cmd->cdb[2]; /* page code */ if (0 == cmd->cdb[2]) { /* supported vital product data pages */ buf[3] = 3; @@ -1374,7 +1373,6 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) resp_len = buf[3] + 4; } else if (0x80 == cmd->cdb[2]) { /* unit serial number */ - buf[1] = 0x80; if (cmd->tgtt->get_serial) { buf[3] = cmd->tgtt->get_serial(cmd->tgt_dev, &buf[4], INQ_BUF_SZ - 4); @@ -1388,7 +1386,6 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) /* device identification */ int num = 4; - buf[1] = 0x83; /* T10 vendor identifier field format (faked) */ buf[num + 0] = 0x2; /* ASCII */ buf[num + 1] = 0x1; /* Vendor ID */ @@ -1455,7 +1452,7 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) (virt_dev->dev->type == TYPE_DISK)) { /* Block Limits */ int max_transfer; - buf[1] = 0xB0; + buf[3] = 0x3C; /* Optimal transfer granuality is PAGE_SIZE */ put_unaligned(cpu_to_be16(max_t(int, @@ -1494,7 +1491,6 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) (virt_dev->dev->type == TYPE_DISK) && virt_dev->thin_provisioned) { /* Thin Provisioning */ - buf[1] = 0xB2; buf[3] = 2; buf[5] = 0x80; resp_len = buf[3] + 4; @@ -1515,6 +1511,8 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd) goto out_put; } + if (virt_dev->removable) + buf[1] = 0x80; /* removable */ buf[2] = 5; /* Device complies to SPC-3 */ buf[3] = 0x12; /* HiSup + data in format specified in SPC */ if (cmd->tgtt->fake_aca) -- 1.7.1 |