Tomo, List Please find attached a patch for VERIFY10/12/16 opcode for SBC. Since we do not support protection information we must fail all VERIFY commands with a check condition except when 'vprotect' is 0. See SBC 5.22 VERIFY 10 COMMAND, tables 65 and 66 The patch also adds support for VERIFY12/16 in addition to the already existing VERIFY10. 10/12/16 are all identical as far as we are concerned. regards ronnie sahlberg
Attachment:
0001-SBC-VERIFY-Update-VERIFY-to-check-vprotect-argument.patch.gz
Description: GNU Zip compressed data
From dfb19f35441d137ef4b82cec924a8746cb1c040d Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> Date: Thu, 26 Jan 2012 10:35:22 +1100 Subject: [PATCH] SBC VERIFY: Update VERIFY to check vprotect argument TGTD does not support formatting protection information so make TGTD fail a VERIFY command requesting vprotect != 0 with a proper check condition. Add VERIFY12/VERIFY16. These are both identical to the already existing VERIFY10 as far as we are converned. See SBC 5.22 VERIFY 10 COMMAND, tables 65 and 66 If the media is not formatted with protection information (as in TGTD) any value of vprotect other than 000b is an error condition and the device h Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> --- usr/sbc.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/usr/sbc.c b/usr/sbc.c index 53e785b..23b1778 100644 --- a/usr/sbc.c +++ b/usr/sbc.c @@ -265,7 +265,26 @@ sense: static int sbc_verify(int host_no, struct scsi_cmd *cmd) { - return SAM_STAT_GOOD; + unsigned char key; + uint16_t asc; + int vprotect; + + vprotect = cmd->scb[1] & 0xe0; + if (vprotect != 0) { + /* we dont support formatting with protection information, + * so all verify with vprotect!=0 is an error condition + */ + key = ILLEGAL_REQUEST; + asc = ASC_INVALID_FIELD_IN_CDB; + goto sense; + } + + return SAM_STAT_GOOD; + +sense: + scsi_set_in_resid_by_actual(cmd, 0); + sense_data_build(cmd, key, asc); + return SAM_STAT_CHECK_CONDITION; } static int sbc_service_action(int host_no, struct scsi_cmd *cmd) @@ -506,7 +525,7 @@ static struct device_type_template sbc_template = { {spc_illegal_op,}, {spc_illegal_op,}, {spc_illegal_op,}, - {spc_illegal_op,}, + {sbc_verify, NULL, PR_EA_FA|PR_EA_FN}, /* 0x90 */ {sbc_rw, NULL, PR_EA_FA|PR_EA_FN}, /*PRE_FETCH_16 */ @@ -544,7 +563,7 @@ static struct device_type_template sbc_template = { {spc_illegal_op,}, {spc_illegal_op,}, {spc_illegal_op,}, - {spc_illegal_op,}, + {sbc_verify, NULL, PR_EA_FA|PR_EA_FN}, [0xb0 ... 0xff] = {spc_illegal_op}, } -- 1.7.3.1