diff --git a/doc/scst_user_spec.txt b/doc/scst_user_spec.txt index 205de39fe..6eae9432c 100644 --- a/doc/scst_user_spec.txt +++ b/doc/scst_user_spec.txt @@ -336,7 +336,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; @@ -415,7 +415,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; @@ -524,7 +524,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 555ea9c39..5978d10e5 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -1235,7 +1235,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 76391bc50..e0ff97c30 100644 --- a/scst/include/scst_user.h +++ b/scst/include/scst_user.h @@ -108,7 +108,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; @@ -128,7 +128,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; @@ -143,7 +143,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 dc9ca6006..990943407 100644 --- a/scst/src/scst_cdbprobe.h +++ b/scst/src/scst_cdbprobe.h @@ -34,6 +34,7 @@ static int get_trans_len_read_capacity(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); /* +=====================================-============-======- @@ -271,6 +272,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", @@ -502,7 +505,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} }; /* Notes: diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index fdea446e4..2014eb3b4 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2432,7 +2432,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;