diff --git a/doc/scst_user_spec.txt b/doc/scst_user_spec.txt index 985ca2cd7..beb789482 100644 --- a/doc/scst_user_spec.txt +++ b/doc/scst_user_spec.txt @@ -343,7 +343,7 @@ struct scst_user_scsi_cmd_parse uint64_t sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; - uint16_t cdb_len; + int16_t cdb_len; uint16_t ext_cdb_len; uint32_t timeout; @@ -426,7 +426,7 @@ struct scst_user_scsi_cmd_alloc_mem uint64_t sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; - uint16_t cdb_len; + int16_t cdb_len; uint16_t ext_cdb_len; int32_t alloc_len; @@ -535,7 +535,7 @@ struct scst_user_scsi_cmd_exec uint64_t sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; - uint16_t cdb_len; + int16_t cdb_len; uint16_t ext_cdb_len; int32_t data_len; diff --git a/scst/include/scst.h b/scst/include/scst.h index 405e816b4..59a7109bc 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -1240,7 +1240,7 @@ struct scst_cmd { /* CDB and its len */ uint8_t cdb[SCST_MAX_CDB_SIZE]; - unsigned short cdb_len; + short cdb_len; /* it might be -1 */ unsigned short ext_cdb_len; uint8_t *ext_cdb; diff --git a/scst/include/scst_user.h b/scst/include/scst_user.h index e3348bd3c..e53047d35 100644 --- a/scst/include/scst_user.h +++ b/scst/include/scst_user.h @@ -110,7 +110,7 @@ struct scst_user_scsi_cmd_parse { aligned_u64 sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; - uint16_t cdb_len; + int16_t cdb_len; uint16_t ext_cdb_len; int32_t timeout; @@ -131,7 +131,7 @@ struct scst_user_scsi_cmd_alloc_mem { aligned_u64 sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; - uint16_t cdb_len; + int16_t cdb_len; uint16_t ext_cdb_len; int32_t alloc_len; @@ -146,7 +146,7 @@ struct scst_user_scsi_cmd_exec { aligned_u64 sess_h; uint8_t cdb[SCST_MAX_CDB_SIZE]; - uint16_t cdb_len; + int16_t cdb_len; uint16_t ext_cdb_len; int32_t data_len; diff --git a/scst/src/scst_cdbprobe.h b/scst/src/scst_cdbprobe.h index bdc74e60f..39034c13c 100644 --- a/scst/src/scst_cdbprobe.h +++ b/scst/src/scst_cdbprobe.h @@ -35,6 +35,7 @@ static int get_trans_len_serv_act_in(struct scst_cmd *cmd, uint8_t off); static int get_trans_len_single(struct scst_cmd *cmd, uint8_t off); static int get_trans_len_none(struct scst_cmd *cmd, uint8_t off); static int get_trans_len_read_pos(struct scst_cmd *cmd, uint8_t off); +static int get_trans_cdb_len_10(struct scst_cmd *cmd, uint8_t off); /* +=====================================-============-======- @@ -284,6 +285,8 @@ static const struct scst_sdbops scst_scsi_op_table[] = { SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x37, "O O ", "READ DEFECT DATA(10)", SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_1}, + {0x37, " O ", "INIT ELEMENT STATUS WRANGE", + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x38, " O O ", "MEDIUM SCAN", SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_1}, {0x39, "OOOOOOOO ", "COMPARE", @@ -525,7 +528,7 @@ static const struct scst_sdbops scst_scsi_op_table[] = { {0xBF, " O ", "VOLUME SET(OUT)", SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4}, {0xE7, " V ", "INIT ELEMENT STATUS WRANGE", - SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none} + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_cdb_len_10} }; #define SCST_CDB_TBL_SIZE \ diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index e517c071b..9f60168bd 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2477,7 +2477,13 @@ int scst_get_cdb_len(const uint8_t *cdb) /* get_trans_len_x extract x bytes from cdb as length starting from off */ -/* for special commands */ +static int get_trans_cdb_len_10(struct scst_cmd *cmd, uint8_t off) +{ + cmd->cdb_len = 10; + cmd->bufflen = 0; + return 0; +} + static int get_trans_len_block_limit(struct scst_cmd *cmd, uint8_t off) { cmd->bufflen = 6;