/* get_trans_len_x extract x bytes from cdb as length starting from off */
static int get_trans_len_1(struct scst_cmd *cmd, uint8_t off);
+static int get_trans_len_1_256(struct scst_cmd *cmd, uint8_t off);
static int get_trans_len_2(struct scst_cmd *cmd, uint8_t off);
static int get_trans_len_3(struct scst_cmd *cmd, uint8_t off);
static int get_trans_len_4(struct scst_cmd *cmd, uint8_t off);
{0x07, "OVV O OV ", "REASSIGN BLOCKS",
SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
{0x08, "O ", "READ(6)",
- SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 4, get_trans_len_1},
+ SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 4, get_trans_len_1_256},
{0x08, " MV OO OV ", "READ(6)",
SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3},
{0x08, " M ", "GET MESSAGE(6)",
{0x09, "VVVVVV V ", "",
SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
{0x0A, "O ", "WRITE(6)",
- SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 4, get_trans_len_1},
+ SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 4, get_trans_len_1_256},
{0x0A, " M O OV ", "WRITE(6)",
SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3},
{0x0A, " M ", "PRINT",
flags |= SCST_POOL_ALLOC_NO_CACHED;
if (unlikely(cmd->bufflen == 0)) {
+ /* ToDo: remove when 1.0.1 will be started */
TRACE(TRACE_MGMT_MINOR, "Warning: data direction %d or/and "
"zero buffer length. Opcode 0x%x, handler %s, target "
"%s", cmd->data_direction, cmd->cdb[0],
return 0;
}
+static int get_trans_len_1_256(struct scst_cmd *cmd, uint8_t off)
+{
+ cmd->bufflen = (u32)cmd->cdb[off];
+ if (cmd->bufflen == 0)
+ cmd->bufflen = 256;
+ return 0;
+}
+
static int get_trans_len_2(struct scst_cmd *cmd, uint8_t off)
{
const uint8_t *p = cmd->cdb + off;
cmd->data_direction = ptr->direction;
cmd->op_flags = ptr->flags;
res = (*ptr->get_trans_len)(cmd, ptr->off);
+#if 0 /* ToDo: enable when 1.0.1 will be started and fix all scst_get_buf_first() returns 0 cases */
+ if (unlikely(cmd->bufflen == 0)) {
+ /*
+ * According to SPC bufflen 0 for data transfer commands isn't
+ * an error, so we need to fix the transfer direction.
+ */
+ cmd->data_direction = SCST_DATA_NONE;
+ }
+#endif
out:
TRACE_EXIT();