On Wed, 2013-01-09 at 08:05 +0100, Hannes Reinecke wrote: > On 01/09/2013 02:04 AM, Nicholas A. Bellinger wrote: > > On Mon, 2012-12-17 at 09:53 +0100, Hannes Reinecke wrote: > >> Introduce TCM_NO_SENSE, mapping to sense code > >> 'Not ready, no additional sense information'. > >> > >> Signed-off-by: Hannes Reinecke <hare@xxxxxxx> > >> Cc: Nicholas Bellinger <nab@xxxxxxxxxxxxxxxxxxxxx> > >> --- > >> drivers/target/target_core_transport.c | 10 ++++++++++ > >> include/target/target_core_base.h | 1 + > >> 2 files changed, 11 insertions(+), 0 deletions(-) > >> > >> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c > >> index 978762d..104bf3b 100644 > >> --- a/drivers/target/target_core_transport.c > >> +++ b/drivers/target/target_core_transport.c > >> @@ -2597,6 +2597,16 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, > >> * SENSE KEY values from include/scsi/scsi.h > >> */ > >> switch (reason) { > >> + case TCM_NO_SENSE: > >> + /* CURRENT ERROR */ > >> + buffer[0] = 0x70; > >> + buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10; > >> + /* Not Ready */ > >> + buffer[SPC_SENSE_KEY_OFFSET] = NOT_READY; > >> + /* NO ADDITIONAL SENSE INFORMATION */ > >> + buffer[SPC_ASC_KEY_OFFSET] = 0; > >> + buffer[SPC_ASCQ_KEY_OFFSET] = 0; > >> + break; > >> case TCM_NON_EXISTENT_LUN: > >> /* CURRENT ERROR */ > >> buffer[0] = 0x70; > >> diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h > >> index 7cae236..663e34a 100644 > >> --- a/include/target/target_core_base.h > >> +++ b/include/target/target_core_base.h > >> @@ -174,6 +174,7 @@ typedef unsigned __bitwise__ sense_reason_t; > >> > >> enum tcm_sense_reason_table { > >> #define R(x) (__force sense_reason_t )(x) > >> + TCM_NO_SENSE = R(0x00), > >> TCM_NON_EXISTENT_LUN = R(0x01), > >> TCM_UNSUPPORTED_SCSI_OPCODE = R(0x02), > >> TCM_INCORRECT_AMOUNT_OF_DATA = R(0x03), > > > > AFAICT, there is no way that TCM_NO_SENSE will ever get triggered with > > 0x00 in the __target_execute_cmd() -> cmd->execute_cmd() failure case, > > as transport_send_check_condition_and_sense() is only called with a non > > zero return.. > > > True. TCM_NO_SENSE is more for completeness. It definitely _is_ a > valid setting (the sense code will be initialized with 0), and > compilers might be issuing a warning then. > Fair enough. ;) Applied both TCM_NO_SENSE to target-pending/master. Thanks Hannes! --nab -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html