From d0af97d3f1fd318f877633512b8c84e86e681e4d Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 18 May 2012 02:56:13 +0000 Subject: [PATCH] scst_vdisk, CD-ROM: Change error code returned if no medium present If my interpretation of section "6.37 TEST UNIT READY command" in SPC-4 is correct then TEST UNIT READY should report "MEDIUM NOT PRESENT" if no medium is present instead of "LOGICAL UNIT NOT READY, AUXILIARY MEMORY NOT ACCESSIBLE". Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4307 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst_const.h | 4 +++- scst/src/dev_handlers/scst_vdisk.c | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index f914496a1..c7b374c3a 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -241,7 +241,8 @@ enum scst_cdb_flags { /************************************************************* ** Sense data for the appropriate errors. Can be used with - ** scst_set_cmd_error() + ** scst_set_cmd_error(). Column order: key, ASC, ASCQ. See + ** also http://www.t10.org/lists/asc-num.htm. *************************************************************/ #define scst_sense_no_sense NO_SENSE, 0x00, 0 #define scst_sense_hardw_error HARDWARE_ERROR, 0x44, 0 @@ -264,6 +265,7 @@ enum scst_cdb_flags { #define scst_sense_read_error MEDIUM_ERROR, 0x11, 0 #define scst_sense_write_error MEDIUM_ERROR, 0x03, 0 #define scst_sense_not_ready NOT_READY, 0x04, 0x10 +#define scst_sense_no_medium NOT_READY, 0x3a, 0 #define scst_sense_invalid_message ILLEGAL_REQUEST, 0x49, 0 #define scst_sense_cleared_by_another_ini_UA UNIT_ATTENTION, 0x2F, 0 #define scst_sense_capacity_data_changed UNIT_ATTENTION, 0x2A, 0x9 diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 4aa9fc269..3dfca7ee2 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -1821,8 +1821,7 @@ static int vcdrom_exec(struct scst_cmd *cmd) if (virt_dev->cdrom_empty && (opcode != INQUIRY)) { TRACE_DBG("%s", "CDROM empty"); - scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_not_ready)); + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_no_medium)); goto out_done; }