Fixes issues cased by recent change of cdb_len to unsigned. Reported by Krzysztof Błaszkowski <kb@sysmikro.com.pl>.

Also it adds INIT ELEMENT STATUS WRANGE to the list of known commands. 



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@864 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-05-19 18:19:06 +00:00
parent 7617a71367
commit 0f164fd9a8
5 changed files with 18 additions and 9 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 \

View File

@@ -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;