From: <vl...@us...> - 2006-10-12 14:25:16
|
Revision: 4 http://svn.sourceforge.net/scst/?rev=4&view=rev Author: vlnb Date: 2006-10-12 07:25:08 -0700 (Thu, 12 Oct 2006) Log Message: ----------- - Fixed dev->on_dev_count underleak - Minor fixes and cosmetics Modified Paths: -------------- trunk/scst/src/scst_priv.h trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2006-10-12 14:18:50 UTC (rev 3) +++ trunk/scst/src/scst_priv.h 2006-10-12 14:25:08 UTC (rev 4) @@ -346,7 +346,8 @@ __scst_block_dev(dev); spin_unlock_bh(&dev->dev_lock); - TRACE_MGMT_DBG("%s", "Waiting during blocking"); + TRACE_MGMT_DBG("Waiting during blocking outstanding %d (on_dev_count " + "%d)", outstanding, atomic_read(&dev->on_dev_count)); wait_event(dev->on_dev_waitQ, atomic_read(&dev->on_dev_count) <= outstanding); TRACE_MGMT_DBG("%s", "wait_event() returned"); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2006-10-12 14:18:50 UTC (rev 3) +++ trunk/scst/src/scst_targ.c 2006-10-12 14:25:08 UTC (rev 4) @@ -1580,7 +1580,7 @@ } count = 0; - do { + while(1) { rc = scst_do_send_to_midlev(cmd); if (rc == SCST_EXEC_NEED_THREAD) { TRACE_DBG("%s", "scst_do_send_to_midlev() requested " @@ -1597,8 +1597,11 @@ count++; expected_sn = __scst_inc_expected_sn(tgt_dev); cmd = scst_check_deferred_commands(tgt_dev, expected_sn); + if (cmd == NULL) + break; + if (unlikely(scst_inc_on_dev_cmd(cmd) != 0)) + break; } - while(cmd != NULL); out_unplug: if (dev->scsi_dev != NULL) @@ -1742,9 +1745,6 @@ TRACE_ENTRY(); - if (unlikely(cmd->sg == NULL)) - goto out; - if (cmd->cdb[0] == REQUEST_SENSE) { if (cmd->internal) cmd = scst_complete_request_sense(cmd); @@ -1775,15 +1775,12 @@ uint8_t *address; length = scst_get_buf_first(cmd, &address); - if (unlikely(length <= 0)) { + if (length <= 0) goto out; - } - if (length > 2 && cmd->cdb[0] == MODE_SENSE) { + if (length > 2 && cmd->cdb[0] == MODE_SENSE) address[2] |= 0x80; /* Write Protect*/ - } - else if (length > 3 && cmd->cdb[0] == MODE_SENSE_10) { + else if (length > 3 && cmd->cdb[0] == MODE_SENSE_10) address[3] |= 0x80; /* Write Protect*/ - } scst_put_buf(cmd, address); } @@ -1800,7 +1797,7 @@ /* ToDo: all pages ?? */ buflen = scst_get_buf_first(cmd, &buffer); - if (likely(buflen > 0)) { + if (buflen > 0) { if (buflen > SCST_INQ_BYTE3) { #ifdef EXTRACHECKS if (buffer[SCST_INQ_BYTE3] & SCST_INQ_NORMACA_BIT) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-11-02 18:40:15
|
Revision: 26 http://svn.sourceforge.net/scst/?rev=26&view=rev Author: vlnb Date: 2006-11-02 04:10:53 -0800 (Thu, 02 Nov 2006) Log Message: ----------- Serving commands, whose expected data len is less, than maximum, fixed. Particularly, it affected READ CAPACITY(16) from Linux initiators Modified Paths: -------------- trunk/scst/src/scst_cdbprobe.h trunk/scst/src/scst_lib.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_cdbprobe.h =================================================================== --- trunk/scst/src/scst_cdbprobe.h 2006-11-02 12:08:28 UTC (rev 25) +++ trunk/scst/src/scst_cdbprobe.h 2006-11-02 12:10:53 UTC (rev 26) @@ -385,8 +385,8 @@ SCST_DATA_WRITE, 4, SCST_UNKNOWN_LENGTH, 1, 0}, /*N2! */ {0x93, " M ", "ERASE(16)", SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, - {0x9E, "M ", "SERVICE ACTION IN", - SCST_DATA_READ, 4, 0, 0, 0}, + {0x9E, "O ", "SERVICE ACTION IN", + SCST_DATA_READ, 0, 0, 0, 0}, /* 12-bytes length CDB */ {0xA0, "VVVVVVVVVV M ", "REPORT LUN", Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2006-11-02 12:08:28 UTC (rev 25) +++ trunk/scst/src/scst_lib.c 2006-11-02 12:10:53 UTC (rev 26) @@ -1485,9 +1485,8 @@ } } if (!info_p->transfer_len) { - TRACE(TRACE_SCSI, - "Warning! transfer_len 0, direction %d change on " "%d", - info_p->direction, SCST_DATA_NONE); + TRACE_DBG("Warning! transfer_len 0, direction %d change on %d", + info_p->direction, SCST_DATA_NONE); info_p->direction = SCST_DATA_NONE; } Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2006-11-02 12:08:28 UTC (rev 25) +++ trunk/scst/src/scst_targ.c 2006-11-02 12:10:53 UTC (rev 26) @@ -374,15 +374,25 @@ TRACE_DBG("Dev handler %s parse() returned %d", dev->handler->name, state); - if (cmd->data_len == -1) - cmd->data_len = cmd->bufflen; - if (state == SCST_CMD_STATE_DEFAULT) state = SCST_CMD_STATE_PREPARE_SPACE; } else state = SCST_CMD_STATE_PREPARE_SPACE; + if (scst_cmd_is_expected_set(cmd)) { + if (cmd->expected_transfer_len < cmd->bufflen) { + TRACE(TRACE_SCSI, "cmd->expected_transfer_len(%d) < " + "cmd->bufflen(%d), using expected_transfer_len " + "instead", cmd->expected_transfer_len, + cmd->bufflen); + cmd->bufflen = cmd->expected_transfer_len; + } + } + + if (cmd->data_len == -1) + cmd->data_len = cmd->bufflen; + #ifdef EXTRACHECKS if (state != SCST_CMD_STATE_NEED_THREAD_CTX) { if (((cmd->data_direction == SCST_DATA_UNKNOWN) && This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-12-04 11:02:52
|
Revision: 41 http://svn.sourceforge.net/scst/?rev=41&view=rev Author: vlnb Date: 2006-12-04 03:02:50 -0800 (Mon, 04 Dec 2006) Log Message: ----------- >From Erik Habbinga <eri...@in...> This patch initializes the res variable in the scst_proc_update_size and fileio_proc_update_size to get rid of "variable might be used unintialized" compiler warnings. Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_fileio.c trunk/scst/src/scst_proc.c Modified: trunk/scst/src/dev_handlers/scst_fileio.c =================================================================== --- trunk/scst/src/dev_handlers/scst_fileio.c 2006-12-04 10:59:26 UTC (rev 40) +++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-12-04 11:02:50 UTC (rev 41) @@ -2270,7 +2270,7 @@ static int fileio_proc_update_size(int size, off_t offset, int length, struct fileio_proc_update_struct *p, int is_start) { - int res; + int res = 0; if (size > 0) { p->len += size; p->pos = p->begin + p->len; Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2006-12-04 10:59:26 UTC (rev 40) +++ trunk/scst/src/scst_proc.c 2006-12-04 11:02:50 UTC (rev 41) @@ -737,7 +737,7 @@ static int scst_proc_update_size(int size, off_t offset, int length, struct scst_proc_update_struct *p) { - int res; + int res = 0; if (size > 0) { p->len += size; p->pos = p->begin + p->len; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-12-14 15:52:22
|
Revision: 55 http://svn.sourceforge.net/scst/?rev=55&view=rev Author: vlnb Date: 2006-12-14 07:52:16 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Reorganized getting CDB info (scst_get_cdb_info()) to make it more peformance effective. Mostly done by Ming Zhang. Modified Paths: -------------- trunk/scst/src/scst_cdbprobe.h trunk/scst/src/scst_lib.c Modified: trunk/scst/src/scst_cdbprobe.h =================================================================== --- trunk/scst/src/scst_cdbprobe.h 2006-12-14 15:42:11 UTC (rev 54) +++ trunk/scst/src/scst_cdbprobe.h 2006-12-14 15:52:16 UTC (rev 55) @@ -20,8 +20,18 @@ #ifndef __SCST_CDBPROBE_H #define __SCST_CDBPROBE_H -#define SCST_BLOCK_LIMIT_LEN 6 +/* get_trans_len_x extract x bytes from cdb as length starting from off */ +static uint32_t get_trans_len_1(const uint8_t *cdb, uint8_t off); +static uint32_t get_trans_len_2(const uint8_t *cdb, uint8_t off); +static uint32_t get_trans_len_3(const uint8_t *cdb, uint8_t off); +static uint32_t get_trans_len_4(const uint8_t *cdb, uint8_t off); +/* for special commands */ +static uint32_t get_trans_len_block_limit(const uint8_t *cdb, uint8_t off); +static uint32_t get_trans_len_read_capacity(const uint8_t *cdb, uint8_t off); +static uint32_t get_trans_len_single(const uint8_t *cdb, uint8_t off); +static uint32_t get_trans_len_none(const uint8_t *cdb, uint8_t off); + /* +=====================================-============-======- | Command name | Operation | Type | @@ -68,14 +78,15 @@ uint8_t direction; /* init --> target: SCST_DATA_WRITE * target --> init: SCST_DATA_READ */ - uint8_t size_field_len; /* how many bytes using for data */ - uint8_t fixed; /* opcode -- have fixed variable bit ??? */ - uint8_t flag1; /* Note 1 */ - uint8_t flag2; -}; + uint8_t flags; /* opcode -- various flags */ + uint8_t off; /* length offset in cdb */ + uint32_t (*get_trans_len)(const uint8_t *cdb, uint8_t off) __attribute__ ((aligned)); +} __attribute__((packed)); static int scst_scsi_op_list[256]; +#define FLAG_NONE 0 + static const struct scst_sdbops scst_scsi_op_table[] = { /* * +-------------------> TYPE_IS_DISK (0) @@ -94,413 +105,406 @@ * || | | || | * || | | || | * 0123456789ABCDEF ---> TYPE_IS_???? */ + + /* 6-bytes length CDB */ {0x00, "MMMMMMMMMMMMMMMM", "TEST UNIT READY", - SCST_DATA_NONE, 0, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_SMALL_TIMEOUT, 0, get_trans_len_none}, {0x01, " M ", "REWIND", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x01, "O V OO OO ", "REZERO UNIT", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x02, "VVVVVV V ", "REQUEST BLOCK ADDR", - SCST_DATA_NONE, 0, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_SMALL_TIMEOUT, 0, get_trans_len_none}, {0x03, "MMMMMMMMMMMMMMMM", "REQUEST SENSE", - SCST_DATA_READ, 1, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 4, get_trans_len_1}, {0x04, "M O O ", "FORMAT UNIT", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, /*-*/ + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x04, " O ", "FORMAT", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x05, "VMVVVV V ", "READ BLOCK LIMITS", - SCST_DATA_READ, 1, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 0, get_trans_len_block_limit}, {0x06, "VVVVVV V ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x07, " O ", "INITIALIZE ELEMENT STATUS", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x07, "OVV O OV ", "REASSIGN BLOCKS", - SCST_DATA_NONE, 0, 0, 0, 0}, /*-*/ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x08, "O ", "READ(6)", - SCST_DATA_READ, 1, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 4, get_trans_len_1}, {0x08, " MV OO OV ", "READ(6)", - SCST_DATA_READ, 3, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3}, {0x08, " M ", "GET MESSAGE(6)", - SCST_DATA_READ, 3, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 2, get_trans_len_3}, {0x08, " O ", "RECEIVE", - SCST_DATA_READ, 3, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 2, get_trans_len_3}, {0x09, "VVVVVV V ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x0A, "O ", "WRITE(6)", - SCST_DATA_WRITE, 1, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 4, get_trans_len_1}, {0x0A, " M O OV ", "WRITE(6)", - SCST_DATA_WRITE, 3, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3}, {0x0A, " M ", "PRINT", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x0A, " M ", "SEND MESSAGE(6)", - SCST_DATA_WRITE, 3, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 2, get_trans_len_3}, {0x0A, " M ", "SEND(6)", - SCST_DATA_WRITE, 3, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 2, get_trans_len_3}, {0x0B, "O OO OV ", "SEEK(6)", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x0B, " ", "TRACK SELECT", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x0B, " O ", "SLEW AND PRINT", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x0C, "VVVVVV V ", "SEEK BLOCK", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x0D, "VVVVVV V ", "PARTITION", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x0E, "VVVVVV V ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x0F, "VOVVVV V ", "READ REVERSE", - SCST_DATA_READ, 3, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3}, {0x10, "VM V V ", "WRITE FILEMARKS", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x10, " O O ", "SYNCHRONIZE BUFFER", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x11, "VMVVVV ", "SPACE", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x12, "MMMMMMMMMMMMMMMM", "INQUIRY", - SCST_DATA_READ, 1, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 4, get_trans_len_1}, {0x13, "VOVVVV ", "VERIFY(6)", - SCST_DATA_WRITE, 3, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3}, {0x14, "VOOVVV ", "RECOVER BUFFERED DATA", - SCST_DATA_READ, 3, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3}, {0x15, "OMOOOOOOOOOOOOOO", "MODE SELECT(6)", - SCST_DATA_WRITE, 1, 0, 0, 0}, /*N6! */ + SCST_DATA_WRITE, FLAG_NONE, 4, get_trans_len_1}, {0x16, "MMMMMMMMMMMMMMMM", "RESERVE", - SCST_DATA_NONE, 0, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_SMALL_TIMEOUT, 0, get_trans_len_none}, {0x17, "MMMMMMMMMMMMMMMM", "RELEASE", - SCST_DATA_NONE, 0, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_SMALL_TIMEOUT, 0, get_trans_len_none}, {0x18, "OOOOOOOO ", "COPY", - SCST_DATA_WRITE, 1, SCST_LONG_TIMEOUT, 0, 0}, /*N5! */ + SCST_DATA_WRITE, SCST_LONG_TIMEOUT, 2, get_trans_len_3}, {0x19, "VMVVVV ", "ERASE", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x1A, "OMOOOOOOOOOOOOOO", "MODE SENSE(6)", - SCST_DATA_READ, 1, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 4, get_trans_len_1}, {0x1B, " O ", "SCAN", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x1B, " O ", "LOAD UNLOAD", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x1B, " O ", "STOP PRINT", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x1B, "O OO O O ", "STOP START UNIT", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x1C, "OOOOOOOOOOOOOOOO", "RECEIVE DIAGNOSTIC RESULTS", - SCST_DATA_READ, 1, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 4, get_trans_len_1}, {0x1D, "MMMMMMMMMMMMMMMM", "SEND DIAGNOSTIC", - SCST_DATA_WRITE, 1, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 4, get_trans_len_1}, {0x1E, "OOOOOOOOOOOOOOOO", "PREVENT ALLOW MEDIUM REMOVAL", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x1F, " O ", "PORT STATUS", - SCST_DATA_NONE, 0, 0, 0, 0}, - /* 10-bytes length CDB */ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, + + /* 10-bytes length CDB */ {0x20, "V VV V ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x21, "V VV V ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x22, "V VV V ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x23, "V VV V ", "READ FORMAT CAPACITY", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x24, "V VVM ", "SET WINDOW", - SCST_DATA_WRITE, 3, 0, 0, 0}, /*-*/ + SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_3}, {0x25, "M MM M ", "READ CAPACITY", - SCST_DATA_READ, 0, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 0, get_trans_len_read_capacity}, {0x25, " O ", "GET WINDOW", - SCST_DATA_READ, 3, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_3}, {0x26, "V VV ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x27, "V VV ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x28, "M MMMM ", "READ(10)", - SCST_DATA_READ, 2, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 7, get_trans_len_2}, {0x28, " O ", "GET MESSAGE(10)", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x29, "V VV O ", "READ GENERATION", - SCST_DATA_READ, 1, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_1}, {0x2A, "O MO M ", "WRITE(10)", - SCST_DATA_WRITE, 2, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 7, get_trans_len_2}, {0x2A, " O ", "SEND MESSAGE(10)", - SCST_DATA_WRITE, 2, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 7, get_trans_len_2}, {0x2A, " O ", "SEND(10)", - SCST_DATA_WRITE, 2, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 7, get_trans_len_2}, {0x2B, " O ", "LOCATE", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x2B, " O ", "POSITION TO ELEMENT", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x2B, "O OO O ", "SEEK(10)", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x2C, "V O O ", "ERASE(10)", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x2D, "V O O ", "READ UPDATED BLOCK", - SCST_DATA_READ, 1, 0, 0, 0}, /*N2! */ + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 0, get_trans_len_single}, {0x2E, "O OO O ", "WRITE AND VERIFY(10)", - SCST_DATA_WRITE, 2, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 7, get_trans_len_2}, {0x2F, "O OO O ", "VERIFY(10)", - SCST_DATA_WRITE, 2, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, - /*-*/ + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 7, get_trans_len_2}, +/* {0x30, "O OO O ", "SEARCH DATA HIGH(10)", - SCST_DATA_NONE, 0, SCST_UNKNOWN_LENGTH, 1, 0}, /*-*/ + SCST_DATA_NONE, SCST_UNKNOWN_LENGTH, 0, get_trans_len_none}, {0x31, " O ", "OBJECT POSITION", - SCST_DATA_NONE, 0, SCST_UNKNOWN_LENGTH, 1, 0}, /*N1! */ + SCST_DATA_NONE, SCST_UNKNOWN_LENGTH, 0, get_trans_len_none}, {0x31, "O OO O ", "SEARCH DATA EQUAL(10)", - SCST_DATA_NONE, 0, SCST_UNKNOWN_LENGTH, 1, 0}, /*-*/ + SCST_DATA_NONE, SCST_UNKNOWN_LENGTH, 0, get_trans_len_none}, {0x32, "O OO O ", "SEARCH DATA LOW(10)", - SCST_DATA_NONE, 0, SCST_UNKNOWN_LENGTH, 1, 0}, /*-*/ + SCST_DATA_NONE, SCST_UNKNOWN_LENGTH, 0, get_trans_len_none}, +*/ {0x33, "O OO O ", "SET LIMITS(10)", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x34, " O ", "READ POSITION", - SCST_DATA_READ, 1, SCST_SMALL_TIMEOUT, 0, 0}, /*N4! */ + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 7, get_trans_len_2}, {0x34, " O ", "GET DATA BUFFER STATUS", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x34, "O OO O ", "PRE-FETCH", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x35, "O OO O ", "SYNCHRONIZE CACHE", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x36, "O OO O ", "LOCK UNLOCK CACHE", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x37, "O O ", "READ DEFECT DATA(10)", - SCST_DATA_READ, 1, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_1}, {0x38, " O O ", "MEDIUM SCAN", - SCST_DATA_READ, 1, 0, 0, 0}, /*-*/ + SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_1}, {0x39, "OOOOOOOO ", "COMPARE", - SCST_DATA_WRITE, 1, 0, 0, 0}, /*N3! */ + SCST_DATA_WRITE, FLAG_NONE, 3, get_trans_len_3}, {0x3A, "OOOOOOOO ", "COPY AND VERIFY", - SCST_DATA_WRITE, 1, 0, 0, 0}, /*N3!? */ + SCST_DATA_WRITE, FLAG_NONE, 3, get_trans_len_3}, {0x3B, "OOOOOOOOOOOOOOOO", "WRITE BUFFER", - SCST_DATA_WRITE, 3, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_WRITE, SCST_SMALL_TIMEOUT, 6, get_trans_len_3}, {0x3C, "OOOOOOOOOOOOOOOO", "READ BUFFER", - SCST_DATA_READ, 3, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 6, get_trans_len_3}, {0x3D, " O O ", "UPDATE BLOCK", - SCST_DATA_WRITE, 1, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, /*N2! */ + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 0, get_trans_len_single}, {0x3E, "O OO O ", "READ LONG", - SCST_DATA_READ, 1, 0, 0, 0}, /*N6! */ + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x3F, "O O O ", "WRITE LONG", - SCST_DATA_WRITE, 1, 0, 0, 0}, /*N6! */ + SCST_DATA_WRITE, FLAG_NONE, 7, get_trans_len_2}, {0x40, "OOOOOOOOOO ", "CHANGE DEFINITION", - SCST_DATA_WRITE, 1, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_WRITE, SCST_SMALL_TIMEOUT, 8, get_trans_len_1}, {0x41, "O O ", "WRITE SAME", - SCST_DATA_WRITE, 0, SCST_UNKNOWN_LENGTH, 1, 0}, /*N2! */ + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 0, get_trans_len_single}, {0x42, " O ", "READ SUB-CHANNEL", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x43, " O ", "READ TOC/PMA/ATIP", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x44, " O ", "READ HEADER", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x45, " O ", "PLAY AUDIO(10)", - SCST_DATA_READ, 2, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, /*N8! */ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x46, " O ", "GET CONFIGURATION", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x47, " O ", "PLAY AUDIO MSF", - SCST_DATA_READ, 0, SCST_UNKNOWN_LENGTH, 1, 0}, /*? */ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x48, " O ", "PLAY AUDIO TRACK INDEX", - SCST_DATA_READ, 0, SCST_UNKNOWN_LENGTH, 1, 0}, /*? */ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x49, " O ", "PLAY TRACK RELATIVE(10)", - SCST_DATA_READ, 2, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, /*N8! */ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x4A, " O ", "GET EVENT STATUS NOTIFICATION", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x4B, " O ", "PAUSE/RESUME", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x4C, "OOOOOOOOOOOOOOOO", "LOG SELECT", - SCST_DATA_WRITE, 2, SCST_SMALL_TIMEOUT, 0, 0}, /*N6! */ + SCST_DATA_WRITE, SCST_SMALL_TIMEOUT, 7, get_trans_len_2}, {0x4D, "OOOOOOOOOOOOOOOO", "LOG SENSE", - SCST_DATA_READ, 2, SCST_SMALL_TIMEOUT, 0, 0}, /*N6! */ + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 7, get_trans_len_2}, {0x4E, " O ", "STOP PLAY/SCAN", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x4F, " ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x50, " ", "XDWRITE", - SCST_DATA_NONE, 0, 0, 0, 0}, /*-*/ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x51, " O ", "READ DISC INFORMATION", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x51, " ", "XPWRITE", - SCST_DATA_NONE, 0, 0, 0, 0}, /*-*/ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x52, " O ", "READ TRACK INFORMATION", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x53, " O ", "RESERVE TRACK", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x54, " O ", "SEND OPC INFORMATION", - SCST_DATA_WRITE, 2, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 7, get_trans_len_2}, {0x55, "OOOOOOOOOOOOOOOO", "MODE SELECT(10)", - SCST_DATA_WRITE, 2, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 7, get_trans_len_2}, {0x56, "OOOOOOOOOOOOOOOO", "RESERVE(10)", - SCST_DATA_NONE, 0, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_SMALL_TIMEOUT, 0, get_trans_len_none}, {0x57, "OOOOOOOOOOOOOOOO", "RELEASE(10)", - SCST_DATA_NONE, 0, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_SMALL_TIMEOUT, 0, get_trans_len_none}, {0x58, " O ", "REPAIR TRACK", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x59, " ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x5A, "OOOOOOOOOOOOOOOO", "MODE SENSE(10)", - SCST_DATA_READ, 2, SCST_SMALL_TIMEOUT, 0, 0}, + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 7, get_trans_len_2}, {0x5B, " O ", "CLOSE TRACK/SESSION", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x5C, " O ", "READ BUFFER CAPACITY", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x5D, " O ", "SEND CUE SHEET", - SCST_DATA_WRITE, 3, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_3}, {0x5E, " ", "PERSISTENT_RESERV_IN", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x5F, " ", "PERSISTENT_RESERV_OUT", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, /* 16-bytes length CDB */ {0x80, "O OO O ", "XDWRITE EXTENDED", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x80, " M ", "WRITE FILEMARKS", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x81, "O OO O ", "REBUILD", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 10, get_trans_len_4}, {0x82, "O OO O ", "REGENERATE", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 10, get_trans_len_4}, {0x83, "OOOOOOOOOOOOOOOO", "EXTENDED COPY", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 10, get_trans_len_4}, {0x84, "OOOOOOOOOOOOOOOO", "RECEIVE COPY RESULT", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 10, get_trans_len_4}, {0x86, "OOOOOOOOOO ", "ACCESS CONTROL IN", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x87, "OOOOOOOOOO ", "ACCESS CONTROL OUT", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x88, "M MMMM ", "READ(16)", - SCST_DATA_READ, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 10, get_trans_len_4}, {0x8A, "O OO O ", "WRITE(16)", - SCST_DATA_WRITE, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 10, get_trans_len_4}, {0x8C, "OOOOOOOOOO ", "READ ATTRIBUTE", - SCST_DATA_READ, 4, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 10, get_trans_len_4}, {0x8D, "OOOOOOOOOO ", "WRITE ATTRIBUTE", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 10, get_trans_len_4}, {0x8E, "O OO O ", "WRITE AND VERIFY(16)", - SCST_DATA_WRITE, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, - /*-*/ + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 10, get_trans_len_4}, {0x8F, "O OO O ", "VERIFY(16)", - SCST_DATA_WRITE, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, /*? */ + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 10, get_trans_len_4}, {0x90, "O OO O ", "PRE-FETCH(16)", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x91, "O OO O ", "SYNCHRONIZE CACHE(16)", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x91, " M ", "SPACE(16)", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x92, "O OO O ", "LOCK UNLOCK CACHE(16)", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0x92, " O ", "LOCATE(16)", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x93, "O O ", "WRITE SAME(16)", - SCST_DATA_WRITE, 4, SCST_UNKNOWN_LENGTH, 1, 0}, /*N2! */ + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 10, get_trans_len_4}, {0x93, " M ", "ERASE(16)", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0x9E, "O ", "SERVICE ACTION IN", - SCST_DATA_READ, 0, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 0, get_trans_len_none}, /* 12-bytes length CDB */ {0xA0, "VVVVVVVVVV M ", "REPORT LUN", - SCST_DATA_READ, 4, SCST_SMALL_TIMEOUT, 0, 0}, /*N7! */ + SCST_DATA_READ, SCST_SMALL_TIMEOUT, 6, get_trans_len_4}, {0xA1, " O ", "BLANK", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0xA2, " ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xA3, " O ", "SEND KEY", - SCST_DATA_WRITE, 2, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 8, get_trans_len_2}, {0xA3, "OOOOO OOOO ", "REPORT DEVICE IDENTIDIER", - SCST_DATA_READ, 4, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4}, {0xA3, " M ", "MAINTENANCE(IN)", - SCST_DATA_READ, 4, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4}, {0xA4, " O ", "REPORT KEY", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_2}, {0xA4, " O ", "MAINTENANCE(OUT)", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4}, {0xA5, " M ", "MOVE MEDIUM", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0xA5, " O ", "PLAY AUDIO(12)", - SCST_DATA_READ, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, /*N8! */ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xA6, " O O ", "EXCHANGE/LOAD/UNLOAD MEDIUM", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0xA7, " O ", "SET READ AHEAD", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xA8, " O ", "GET MESSAGE(12)", - SCST_DATA_READ, 4, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4}, {0xA8, "O OO O ", "READ(12)", - SCST_DATA_READ, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 6, get_trans_len_4}, {0xA9, " O ", "PLAY TRACK RELATIVE(12)", - SCST_DATA_READ, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, /*N8*! */ + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xAA, "O OO O ", "WRITE(12)", - SCST_DATA_WRITE, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 6, get_trans_len_4}, {0xAA, " O ", "SEND MESSAGE(12)", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4}, {0xAB, " ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xAC, " O ", "ERASE(12)", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xAC, " O ", "GET PERFORMANCE", - SCST_DATA_READ, 0, SCST_UNKNOWN_LENGTH, 1, 0}, + SCST_DATA_READ, SCST_UNKNOWN_LENGTH, 0, get_trans_len_none}, {0xAD, " O ", "READ DVD STRUCTURE", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_2}, {0xAE, "O OO O ", "WRITE AND VERIFY(12)", - SCST_DATA_WRITE, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, - /*-*/ + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 6, get_trans_len_4}, {0xAF, "O OO O ", "VERIFY(12)", - SCST_DATA_WRITE, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, /*? */ + SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED, 6, get_trans_len_4}, +/* No need to support at all. {0xB0, " OO O ", "SEARCH DATA HIGH(12)", - SCST_DATA_WRITE, 1, 0, 0, 0}, /*N9! */ + SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_1}, {0xB1, " OO O ", "SEARCH DATA EQUAL(12)", - SCST_DATA_WRITE, 1, 0, 0, 0}, /*N9! */ + SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_1}, {0xB2, " OO O ", "SEARCH DATA LOW(12)", - SCST_DATA_WRITE, 1, 0, 0, 0}, /*N9! */ + SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_1}, +*/ {0xB3, " OO O ", "SET LIMITS(12)", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xB4, " ", "", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xB5, " O ", "REQUEST VOLUME ELEMENT ADDRESS", - SCST_DATA_READ, 1, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 9, get_trans_len_1}, {0xB6, " O ", "SEND VOLUME TAG", - SCST_DATA_WRITE, 1, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_1}, {0xB6, " O ", "SET STREAMING", - SCST_DATA_WRITE, 0, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 0, get_trans_len_none}, {0xB7, " O ", "READ DEFECT DATA(12)", - SCST_DATA_READ, 1, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 9, get_trans_len_1}, {0xB8, " O ", "READ ELEMENT STATUS", - SCST_DATA_READ, 3, 0, 0, 0}, /*N10 */ + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_3}, {0xB9, " O ", "READ CD MSF", - SCST_DATA_READ, 0, SCST_UNKNOWN_LENGTH, 1, 0}, + SCST_DATA_READ, SCST_UNKNOWN_LENGTH, 0, get_trans_len_none}, {0xBA, " O ", "SCAN", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0}, + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}, {0xBA, " O ", "REDUNDANCY GROUP(IN)", - SCST_DATA_READ, 4, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4}, {0xBB, " O ", "SET SPEED", - SCST_DATA_NONE, 0, 0, 0, 0}, + SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none}, {0xBB, " O ", "REDUNDANCY GROUP(OUT)", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4}, {0xBC, " O ", "SPARE(IN)", - SCST_DATA_READ, 4, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4}, {0xBD, " O ", "MECHANISM STATUS", - SCST_DATA_READ, 2, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_2}, {0xBD, " O ", "SPARE(OUT)", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4}, {0xBE, " O ", "READ CD", - SCST_DATA_READ, 4, SCST_TRANSFER_LEN_TYPE_FIXED, 0, 0}, + SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 6, get_trans_len_3}, {0xBE, " O ", "VOLUME SET(IN)", - SCST_DATA_READ, 4, 0, 0, 0}, + SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4}, {0xBF, " O ", "SEND DVD STRUCTUE", - SCST_DATA_WRITE, 2, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 8, get_trans_len_2}, {0xBF, " O ", "VOLUME SET(OUT)", - SCST_DATA_WRITE, 4, 0, 0, 0}, + SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4}, {0xE7, " V ", "INIT ELEMENT STATUS WRANGE", - SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0} + SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none} }; /* Notes: - N1. - Unknown data len - N2. - Read/Write 1 block data - N3. - SCSI-2 1 byte len, SCSI-3 may be upto 3 bytes AND other location - N4. - Answer 20-bytes block. - N5. - CDB get param list len - N6. - len is bytes only - N7. - SCSI-3 Report Lun? - N8. - fixed length audio mode blocks for CD/DVD use MODE SENSE - N9. - 14-BYTES header + (n * patterns) full length variable - N10. - SCSI-2 use 1byte, mt.c (SCSI-3)? use 3 bytes - -Unknown op's: -#define SCSIOP_XDWRITE_EXTENDED 0x80 -#define SCSIOP_REBUILD 0x81 -#define SCSIOP_EA 0xea -#define WRITE_LONG_2 0xea + Unknown op's: + #define SCSIOP_XDWRITE_EXTENDED 0x80 + #define SCSIOP_REBUILD 0x81 + #define SCSIOP_EA 0xea + #define WRITE_LONG_2 0xea */ #define SCST_CDB_TBL_SIZE ((sizeof(scst_scsi_op_table)/sizeof(struct scst_sdbops))) Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2006-12-14 15:42:11 UTC (rev 54) +++ trunk/scst/src/scst_lib.c 2006-12-14 15:52:16 UTC (rev 55) @@ -1472,6 +1472,51 @@ return SCST_GET_CDB_LEN(cdb[0]); } +/* get_trans_len_x extract x bytes from cdb as length starting from off */ + +static uint32_t get_trans_len_1(const uint8_t *cdb, uint8_t off) +{ + return (*(cdb + off)); +} + +static uint32_t get_trans_len_2(const uint8_t *cdb, uint8_t off) +{ + return be16_to_cpu(*((uint16_t *)(cdb + off))); +} + +static uint32_t get_trans_len_3(const uint8_t *cdb, uint8_t off) +{ + const uint8_t *p = cdb + off; + + return ((*p) << 16) + (*(p + 1) << 8) + *(p + 2); +} + +static uint32_t get_trans_len_4(const uint8_t *cdb, uint8_t off) +{ + return be32_to_cpu(*((uint32_t *)(cdb + off))); +} + +/* for special commands */ +static uint32_t get_trans_len_block_limit(const uint8_t *cdb, uint8_t off) +{ + return 6; +} + +static uint32_t get_trans_len_read_capacity(const uint8_t *cdb, uint8_t off) +{ + return 8; +} + +static uint32_t get_trans_len_single(const uint8_t *cdb, uint8_t off) +{ + return 1; +} + +static uint32_t get_trans_len_none(const uint8_t *cdb, uint8_t off) +{ + return 0; +} + int scst_get_cdb_info(const uint8_t *cdb_p, int dev_type, struct scst_info_cdb *info_p) { @@ -1481,12 +1526,9 @@ TRACE_ENTRY(); - memset(info_p, 0, sizeof(*info_p)); - info_p->direction = SCST_DATA_NONE; - info_p->op_name = "NOOP"; op = *cdb_p; /* get clear opcode */ - TRACE(TRACE_SCSI, "opcode=%02x, cdblen=%d bytes, tblsize=%zd, " + TRACE_DBG("opcode=%02x, cdblen=%d bytes, tblsize=%zd, " "dev_type=%d", op, SCST_GET_CDB_LEN(op), SCST_CDB_TBL_SIZE, dev_type); @@ -1494,8 +1536,7 @@ while (i < SCST_CDB_TBL_SIZE && scst_scsi_op_table[i].ops == op) { if (scst_scsi_op_table[i].devkey[dev_type] != SCST_CDB_NOTSUPP) { ptr = &scst_scsi_op_table[i]; -#if 0 - TRACE(TRACE_SCSI, "op = 0x%02x+'%c%c%c%c%c%c%c%c%c%c'+<%s>", + TRACE_DBG("op = 0x%02x+'%c%c%c%c%c%c%c%c%c%c'+<%s>", ptr->ops, ptr->devkey[0], /* disk */ ptr->devkey[1], /* tape */ ptr->devkey[2], /* printer */ @@ -1507,13 +1548,10 @@ ptr->devkey[8], /* changer */ ptr->devkey[9], /* commdev */ ptr->op_name); - - TRACE(TRACE_SCSI, - "direction=%d size_field_len=%d fixed=%d flag1=%d flag2=%d", + TRACE_DBG("direction=%d flags=%d off=%d", ptr->direction, - ptr->size_field_len, - ptr->fixed, ptr->flag1, ptr->flag2); -#endif + ptr->flags, + ptr->off); break; } i++; @@ -1529,135 +1567,24 @@ info_p->cdb_len = SCST_GET_CDB_LEN(op); info_p->op_name = ptr->op_name; - /* 1. direction */ info_p->direction = ptr->direction; - if (info_p->direction == SCST_DATA_NONE) - goto out; + info_p->flags = ptr->flags; + info_p->transfer_len = (*ptr->get_trans_len)(cdb_p, ptr->off); - /* 2. flags */ - info_p->flags = ptr->fixed; - - /* - * CDB length needed, because we must know offsets: - * 1) for 6-bytes CDB len = 1 byte or 3 bytes(if real transfer exist) - * 2) for 10-bytes CDB len = 1 byte or 2 bytes(0x24,0x25 = 3) - * 3) for 12-bytes CDB len = 1 byte or 4 bytes - */ - - /* 3. transfer_len */ - if (SCST_GET_CDB_LEN(op) == 6) { - if (ptr->size_field_len == 3) { - /* length = 3 bytes */ - info_p->transfer_len = (((*(cdb_p + 2)) & 0xff) << 16) + - (((*(cdb_p + 3)) & 0xff) << 8) + - ((*(cdb_p + 4)) & 0xff); - info_p->transfer_len &= 0xffffff; - } else if (ptr->size_field_len == 1) { - /* - * Warning!!! CDB 'READ BLOCK LIMITS' - * always returns 6-byte block with limits - * info_p->transfer_len = (int)(*(cdb_p + 4)); - */ - info_p->transfer_len = ((op == READ_BLOCK_LIMITS) ? - SCST_BLOCK_LIMIT_LEN : - *(cdb_p + 4)) & 0xff; - } - } else if (SCST_GET_CDB_LEN(op) == 10) { - if (ptr->size_field_len == 3) - /* - * SET window usees 3 bytes length SET/GET WINDOW - * if ((uint8_t)ptr->ops == 0x24 || 0x25) - */ - { - info_p->transfer_len = (((*(cdb_p + 6)) & 0xff) << 16) + - (((*(cdb_p + 7)) & 0xff) << 8) + - ((*(cdb_p + 8)) & 0xff); - info_p->transfer_len &= 0xffffff; - } else if (ptr->size_field_len == 2) { - info_p->transfer_len = (((*(cdb_p + 7)) & 0xff) << 8) + - ((*(cdb_p + 8)) & 0xff); - info_p->transfer_len &= 0xffff; - } else if (ptr->size_field_len == 1) { - info_p->transfer_len = (*(cdb_p + 8)); - - /* opcode = READ-WRITE UPDATED BLOCK */ - if ((ptr->ops == UPDATE_BLOCK) || - (ptr->ops == WRITE_SAME)) { - /* the opcode always returns 1 block */ - info_p->flags |= SCST_TRANSFER_LEN_TYPE_FIXED; - info_p->transfer_len = 1; - } - - if ((ptr->ops == COMPARE) || (ptr->ops == COPY_VERIFY)) { - /* ese other place in CDB [3,4],5 */ - info_p->transfer_len = (*(cdb_p + 5)); - } - - info_p->transfer_len &= 0xff; - } - } else if (SCST_GET_CDB_LEN(op) == 12) { - if (ptr->size_field_len == 4) { - info_p->transfer_len = (((*(cdb_p + 6)) & 0xff) << 24) + - (((*(cdb_p + 7)) & 0xff) << 16) + - (((*(cdb_p + 8)) & 0xff) << 8) + - ((*(cdb_p + 9)) & 0xff); - info_p->transfer_len &= 0xffffffff; - } else if (ptr->size_field_len == 3) { - info_p->transfer_len = (((*(cdb_p + 7)) & 0xff) << 16) + - (((*(cdb_p + 8)) & 0xff) << 8) + - ((*(cdb_p + 9)) & 0xff); - info_p->transfer_len &= 0xffffff; - } else if (ptr->size_field_len == 2) { - info_p->transfer_len = (((*(cdb_p + 8)) & 0xff) << 8) + - ((*(cdb_p + 9)) & 0xff); - info_p->transfer_len &= 0xffff; - } else { - if (ptr->size_field_len == 1) { - info_p->transfer_len = (*(cdb_p + 9)); - info_p->transfer_len &= 0xff; - } - } - } else if (SCST_GET_CDB_LEN(op) == 16) { - if (ptr->size_field_len == 4) { - info_p->transfer_len = - (((*(cdb_p + 10)) & 0xff) << 24) + - (((*(cdb_p + 11)) & 0xff) << 16) + - (((*(cdb_p + 12)) & 0xff) << 8) + - ((*(cdb_p + 13)) & 0xff); - } - } - if (!info_p->transfer_len) { +#ifdef EXTRACHECKS + if (unlikely((info_p->transfer_len == 0) && + (info_p->direction != SCST_DATA_NONE))) { TRACE_DBG("Warning! transfer_len 0, direction %d change on %d", info_p->direction, SCST_DATA_NONE); info_p->direction = SCST_DATA_NONE; } +#endif out: TRACE_EXIT(); return res; } -void scst_scsi_op_list_init(void) -{ - int i; - uint8_t op = 0xff; - - TRACE_ENTRY(); - - for (i = 0; i < 256; i++) - scst_scsi_op_list[i] = SCST_CDB_TBL_SIZE; - - for (i = 0; i < SCST_CDB_TBL_SIZE; i++) { - if (scst_scsi_op_table[i].ops != op) { - op = scst_scsi_op_table[i].ops; - scst_scsi_op_list[op] = i; - } - } - - TRACE_EXIT(); - return; -} - /* * Routine to extract a lun number from an 8-byte LUN structure * in network byte order (BE). @@ -2234,6 +2161,28 @@ return; } +void __init scst_scsi_op_list_init(void) +{ + int i; + uint8_t op = 0xff; + + TRACE_ENTRY(); + + for (i = 0; i < 256; i++) + scst_scsi_op_list[i] = SCST_CDB_TBL_SIZE; + + for (i = 0; i < SCST_CDB_TBL_SIZE; i++) { + if (scst_scsi_op_table[i].ops != op) { + op = scst_scsi_op_table[i].ops; + scst_scsi_op_list[op] = i; + } + } + + TRACE_EXIT(); + return; +} + + #ifdef DEBUG /* Original taken from the XFS code */ unsigned long scst_random(void) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-12-15 16:30:40
|
Revision: 64 http://svn.sourceforge.net/scst/?rev=64&view=rev Author: vlnb Date: 2006-12-15 08:30:30 -0800 (Fri, 15 Dec 2006) Log Message: ----------- - Patch from Ming Zhang <bla...@gm...>: Small patch to enhance the 2TB support. MS Windows only like a 12 byte response. It seems to still follow the sbc2r10 spec instead of the r16 spec we use. detailed info can be found at http://sourceforge.net/mailarchive/forum.php?thread_id=31236894&forum_id=40837 - Small cleanup Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_fileio.c trunk/scst/src/scst_mem.c Modified: trunk/scst/src/dev_handlers/scst_fileio.c =================================================================== --- trunk/scst/src/dev_handlers/scst_fileio.c 2006-12-15 16:14:04 UTC (rev 63) +++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-12-15 16:30:30 UTC (rev 64) @@ -47,7 +47,7 @@ #define SCST_FIO_REV " 096" #define READ_CAP_LEN 8 -#define READ_CAP16_LEN 32 +#define READ_CAP16_LEN 12 #define MAX_USN_LEN 20 Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2006-12-15 16:14:04 UTC (rev 63) +++ trunk/scst/src/scst_mem.c 2006-12-15 16:30:30 UTC (rev 64) @@ -31,7 +31,6 @@ #include "scsi_tgt.h" #include "scst_priv.h" -#include "scst_debug.h" #include "scst_mem.h" /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-12-18 15:07:16
|
Revision: 66 http://svn.sourceforge.net/scst/?rev=66&view=rev Author: vlnb Date: 2006-12-18 07:07:12 -0800 (Mon, 18 Dec 2006) Log Message: ----------- Not debug compilation fixed Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_dev_handler.h trunk/scst/src/scst_proc.c Modified: trunk/scst/src/dev_handlers/scst_dev_handler.h =================================================================== --- trunk/scst/src/dev_handlers/scst_dev_handler.h 2006-12-15 16:49:15 UTC (rev 65) +++ trunk/scst/src/dev_handlers/scst_dev_handler.h 2006-12-18 15:07:12 UTC (rev 66) @@ -1,7 +1,11 @@ #ifndef __SCST_DEV_HANDLER_H #define __SCST_DEV_HANDLER_H +#include <linux/module.h> +#include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <scsi/scsi_eh.h> +#include "scst_debug.h" #define SCST_DEV_UA_RETRIES 5 @@ -9,12 +13,6 @@ #define DEV_HANDLER_LOG_ENTRY_NAME "trace_level" -#include <linux/module.h> -#include <linux/proc_fs.h> -#include <linux/seq_file.h> - -#include "scst_debug.h" - #ifdef DEBUG #define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_PID | \ TRACE_FUNCTION | TRACE_MGMT | TRACE_MINOR | TRACE_MGMT_DEBUG | \ Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2006-12-15 16:49:15 UTC (rev 65) +++ trunk/scst/src/scst_proc.c 2006-12-18 15:07:12 UTC (rev 66) @@ -47,7 +47,6 @@ static struct scst_proc_data scst_groups_devices_proc_data; static struct scst_proc_data scst_sessions_proc_data; static struct scst_proc_data scst_dev_handler_type_proc_data; -static struct scst_proc_data scst_log_proc_data; static struct scst_proc_data scst_tgt_proc_data; static struct scst_proc_data scst_threads_proc_data; static struct scst_proc_data scst_scsi_tgt_proc_data; @@ -85,6 +84,8 @@ static struct proc_dir_entry *scst_proc_groups_root; #if defined(DEBUG) || defined(TRACING) +static struct scst_proc_data scst_log_proc_data; + static struct scst_proc_log scst_proc_trace_tbl[] = { { TRACE_OUT_OF_MEM, "out_of_mem" }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-12-19 18:07:59
|
Revision: 67 http://svn.sourceforge.net/scst/?rev=67&view=rev Author: vlnb Date: 2006-12-19 10:07:56 -0800 (Tue, 19 Dec 2006) Log Message: ----------- This patch removes usage of bexx_to_cpu() on lba and len conversion, because possible unalined access, + some cosmetics. From Ming Zhang. Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_fileio.c trunk/scst/src/scst_lib.c Modified: trunk/scst/src/dev_handlers/scst_fileio.c =================================================================== --- trunk/scst/src/dev_handlers/scst_fileio.c 2006-12-18 15:07:12 UTC (rev 66) +++ trunk/scst/src/dev_handlers/scst_fileio.c 2006-12-19 18:07:56 UTC (rev 67) @@ -405,9 +405,10 @@ static void fileio_do_job(struct scst_cmd *cmd) { - uint64_t lba_start; - loff_t data_len; - int opcode = cmd->cdb[0]; + uint64_t lba_start = 0; + loff_t data_len = 0; + uint8_t *cdb = cmd->cdb; + int opcode = cdb[0]; loff_t loff; struct scst_device *dev = cmd->dev; struct scst_fileio_dev *virt_dev = @@ -427,9 +428,9 @@ case READ_6: case WRITE_6: case VERIFY_6: - lba_start = (((cmd->cdb[1] & 0x1f) << (BYTE * 2)) + - (cmd->cdb[2] << (BYTE * 1)) + - (cmd->cdb[3] << (BYTE * 0))); + lba_start = (((cdb[1] & 0x1f) << (BYTE * 2)) + + (cdb[2] << (BYTE * 1)) + + (cdb[3] << (BYTE * 0))); data_len = cmd->bufflen; break; case READ_10: @@ -440,13 +441,19 @@ case WRITE_VERIFY: case WRITE_VERIFY_12: case VERIFY_12: - lba_start = be32_to_cpu(*(u32 *)&cmd->cdb[2]); + lba_start |= ((u64)cdb[2]) << 24; + lba_start |= ((u64)cdb[3]) << 16; + lba_start |= ((u64)cdb[4]) << 8; + lba_start |= ((u64)cdb[5]); data_len = cmd->bufflen; break; case SYNCHRONIZE_CACHE: - lba_start = be32_to_cpu(*(u32 *)&cmd->cdb[2]); - data_len = ((cmd->cdb[7] << (BYTE * 1)) + - (cmd->cdb[8] << (BYTE * 0))) << virt_dev->block_shift; + lba_start |= ((u64)cdb[2]) << 24; + lba_start |= ((u64)cdb[3]) << 16; + lba_start |= ((u64)cdb[4]) << 8; + lba_start |= ((u64)cdb[5]); + data_len = ((cdb[7] << (BYTE * 1)) + (cdb[8] << (BYTE * 0))) + << virt_dev->block_shift; if (data_len == 0) data_len = virt_dev->file_size - ((loff_t)lba_start << virt_dev->block_shift); @@ -455,12 +462,15 @@ case WRITE_16: case WRITE_VERIFY_16: case VERIFY_16: - lba_start = be64_to_cpu(*(u64*)&cmd->cdb[2]); + lba_start |= ((u64)cdb[2]) << 56; + lba_start |= ((u64)cdb[3]) << 48; + lba_start |= ((u64)cdb[4]) << 40; + lba_start |= ((u64)cdb[5]) << 32; + lba_start |= ((u64)cdb[6]) << 16; + lba_start |= ((u64)cdb[7]) << 8; + lba_start |= ((u64)cdb[8]); data_len = cmd->bufflen; break; - default: - lba_start = 0; - data_len = 0; } loff = (loff_t)lba_start << virt_dev->block_shift; @@ -480,8 +490,8 @@ case WRITE_10: case WRITE_12: case WRITE_16: - fua = (cmd->cdb[1] & 0x8) && !virt_dev->wt_flag; - if (cmd->cdb[1] & 0x8) { + fua = (cdb[1] & 0x8) && !virt_dev->wt_flag; + if (cdb[1] & 0x8) { TRACE(TRACE_SCSI, "FUA(%d): loff=%Ld, " "data_len=%Ld", fua, (uint64_t)loff, (uint64_t)data_len); @@ -563,7 +573,7 @@ break; case SYNCHRONIZE_CACHE: { - int immed = cmd->cdb[1] & 0x2; + int immed = cdb[1] & 0x2; struct scst_fileio_tgt_dev *ftgt_dev = (struct scst_fileio_tgt_dev*) cmd->tgt_dev->dh_priv; @@ -1247,8 +1257,10 @@ buf[num + 10] = (dev_id_num >> 8) & 0xff; buf[num + 11] = dev_id_num & 0xff; - *((u16*)&buf[2]) = cpu_to_be16(num + 12 - 4); - resp_len = be16_to_cpu(*((u16*)&buf[2])) + 4; + resp_len = num + 12 - 4; + buf[2] = (resp_len >> 8) & 0xFF; + buf[3] = resp_len & 0xFF; + resp_len += 4; } else { TRACE_DBG("INQUIRY: Unsupported EVPD page %x", cmd->cdb[2]); @@ -1727,17 +1739,23 @@ uint32_t blocksize; uint64_t nblocks; uint8_t buffer[READ_CAP16_LEN]; - uint64_t *data64; TRACE_ENTRY(); virt_dev = (struct scst_fileio_dev *)cmd->dev->dh_priv; blocksize = virt_dev->block_size; - nblocks = virt_dev->nblocks; + nblocks = virt_dev->nblocks - 1; memset(buffer, 0, sizeof(buffer)); - data64 = (uint64_t*)buffer; - data64[0] = cpu_to_be64(nblocks - 1); + buffer[0] = nblocks >> 56; + buffer[1] = (nblocks >> 48) & 0xFF; + buffer[2] = (nblocks >> 40) & 0xFF; + buffer[3] = (nblocks >> 32) & 0xFF; + buffer[4] = (nblocks >> 24) & 0xFF; + buffer[5] = (nblocks >> 16) & 0xFF; + buffer[6] = (nblocks >> 8) & 0xFF; + buffer[7] = nblocks& 0xFF; + buffer[8] = (blocksize >> (BYTE * 3)) & 0xFF; buffer[9] = (blocksize >> (BYTE * 2)) & 0xFF; buffer[10] = (blocksize >> (BYTE * 1)) & 0xFF; Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2006-12-18 15:07:12 UTC (rev 66) +++ trunk/scst/src/scst_lib.c 2006-12-19 18:07:56 UTC (rev 67) @@ -1492,24 +1492,43 @@ static uint32_t get_trans_len_1(const uint8_t *cdb, uint8_t off) { - return (*(cdb + off)); + u32 len; + + len = (u32)cdb[off]; + return len; } static uint32_t get_trans_len_2(const uint8_t *cdb, uint8_t off) { - return be16_to_cpu(*((uint16_t *)(cdb + off))); + const uint8_t *p = cdb + off; + u32 len = 0; + + len |= ((u32)p[0]) << 8; + len |= ((u32)p[1]); + return len; } static uint32_t get_trans_len_3(const uint8_t *cdb, uint8_t off) { const uint8_t *p = cdb + off; + u32 len = 0; - return ((*p) << 16) + (*(p + 1) << 8) + *(p + 2); + len |= ((u32)p[0]) << 16; + len |= ((u32)p[1]) << 8; + len |= ((u32)p[2]); + return len; } static uint32_t get_trans_len_4(const uint8_t *cdb, uint8_t off) { - return be32_to_cpu(*((uint32_t *)(cdb + off))); + const uint8_t *p = cdb + off; + u32 len = 0; + + len |= ((u32)p[0]) << 24; + len |= ((u32)p[1]) << 16; + len |= ((u32)p[2]) << 8; + len |= ((u32)p[3]); + return len; } /* for special commands */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-12-29 11:38:58
|
Revision: 71 http://svn.sourceforge.net/scst/?rev=71&view=rev Author: vlnb Date: 2006-12-29 03:38:43 -0800 (Fri, 29 Dec 2006) Log Message: ----------- A bunch of cleanups and minor fixes by Ming: - Dead code removed from scst_prepare_space() - LUN and CDB check moved out of EXTRACHECKS section - Fixed error processing in scst_register_dev_driver(), scst_sgv_pools_init() and scst_register() - Since scst_unregister_dev_driver() returnes void it should use down() instead of down_interruptible() - Clean out scst_num_cpus - Fixed race in scst_register_target_template() Modified Paths: -------------- trunk/scst/src/scst.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_priv.h trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst.c =================================================================== --- trunk/scst/src/scst.c 2006-12-28 11:10:22 UTC (rev 70) +++ trunk/scst/src/scst.c 2006-12-29 11:38:43 UTC (rev 71) @@ -42,7 +42,6 @@ */ DECLARE_MUTEX(scst_mutex); -int scst_num_cpus; DECLARE_WAIT_QUEUE_HEAD(scst_dev_cmd_waitQ); LIST_HEAD(scst_dev_wait_sess_list); @@ -116,6 +115,7 @@ { int res = 0; struct scst_tgt_template *t; + static DECLARE_MUTEX(m); TRACE_ENTRY(); @@ -149,8 +149,11 @@ } } - if (down_interruptible(&scst_mutex) != 0) + if (down_interruptible(&m) != 0) goto out; + + if (down_interruptible(&scst_mutex) != 0) + goto out_m_up; list_for_each_entry(t, &scst_template_list, scst_template_list_entry) { if (strcmp(t->name, vtt->name) == 0) { PRINT_ERROR_PR("Target driver %s already registered", @@ -159,7 +162,6 @@ goto out_cleanup; } } - /* That's OK to drop it. The race doesn't matter */ up(&scst_mutex); TRACE_DBG("%s", "Calling target driver's detect()"); @@ -177,6 +179,9 @@ res = 0; +out_m_up: + up(&m); + out: TRACE_EXIT_RES(res); return res; @@ -238,21 +243,16 @@ down(&scst_mutex); if (scst_build_proc_target_entries(tgt) < 0) { + kfree(tgt); tgt = NULL; - goto out_free; - } + } else + list_add_tail(&tgt->tgt_list_entry, &vtt->tgt_list); - list_add_tail(&tgt->tgt_list_entry, &vtt->tgt_list); - up(&scst_mutex); out: TRACE_EXIT(); return tgt; - -out_free: - kfree(tgt); - goto out; } static inline int test_sess_list(struct scst_tgt *tgt) @@ -632,16 +632,16 @@ break; } } - + + if (exist) + goto out_up; + res = scst_build_proc_dev_handler_dir_entries(dev_type); if (res < 0) { goto out_up; } list_add_tail(&dev_type->dev_type_list_entry, &scst_dev_type_list); - - if (exist) - goto out_up; __scst_suspend_activity(); list_for_each_entry(dev, &scst_dev_list, dev_list_entry) { @@ -671,8 +671,7 @@ TRACE_ENTRY(); - if (down_interruptible(&scst_mutex) != 0) - goto out; + down(&scst_mutex); __scst_suspend_activity(); list_for_each_entry(dev, &scst_dev_list, dev_list_entry) { @@ -692,7 +691,6 @@ PRINT_INFO_PR("Device handler %s for type %d unloaded", dev_type->name, dev_type->type); -out: TRACE_EXIT(); return; } @@ -1053,19 +1051,11 @@ .remove = scst_remove, }; -static inline int get_cpus_count(void) -{ -#ifdef CONFIG_SMP - return cpus_weight(cpu_online_map); -#else - return 1; -#endif -} - static int __init init_scst(void) { int res = 0, i; struct scst_cmd *cmd; + int scst_num_cpus; TRACE_ENTRY(); @@ -1083,8 +1073,8 @@ } #endif - scst_num_cpus = get_cpus_count(); - + scst_num_cpus = num_online_cpus(); + /* ToDo: register_cpu_notifier() */ if (scst_threads == 0) Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2006-12-28 11:10:22 UTC (rev 70) +++ trunk/scst/src/scst_mem.c 2006-12-29 11:38:43 UTC (rev 71) @@ -514,11 +514,11 @@ res = sgv_pool_init(&pools->norm, "sgv", 0); if (res != 0) - goto out_free_clust; + goto out; res = sgv_pool_init(&pools->norm_clust, "sgv-clust", 1); if (res != 0) - goto out; + goto out_free_clust; res = sgv_pool_init(&pools->dma, "sgv-dma", 0); if (res != 0) Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2006-12-28 11:10:22 UTC (rev 70) +++ trunk/scst/src/scst_priv.h 2006-12-29 11:38:43 UTC (rev 71) @@ -131,7 +131,6 @@ extern struct scst_sgv_pools scst_sgv; -extern int scst_num_cpus; extern unsigned long scst_flags; extern struct semaphore scst_mutex; extern atomic_t scst_cmd_count; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2006-12-28 11:10:22 UTC (rev 70) +++ trunk/scst/src/scst_targ.c 2006-12-29 11:38:43 UTC (rev 71) @@ -188,7 +188,6 @@ } } -#ifdef EXTRACHECKS if (unlikely(cmd->lun == (lun_t)-1)) { PRINT_ERROR_PR("Wrong LUN %d, finishing cmd", -1); scst_set_cmd_error(cmd, @@ -204,7 +203,6 @@ scst_setup_to_active(cmd); goto active; } -#endif TRACE_DBG("Adding cmd %p to init cmd list", cmd); list_add_tail(&cmd->cmd_list_entry, &scst_init_cmd_list); @@ -608,8 +606,7 @@ r = scst_alloc_space(cmd); else if (r == 0) { cmd->data_buf_alloced = 1; - if (cmd->data_buf_alloced && - unlikely(orig_bufflen < cmd->bufflen)) { + if (unlikely(orig_bufflen < cmd->bufflen)) { PRINT_ERROR_PR("Target driver allocated data " "buffer (size %d), is less, than " "required (size %d)", orig_bufflen, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-01-08 17:56:41
|
Revision: 73 http://svn.sourceforge.net/scst/?rev=73&view=rev Author: vlnb Date: 2007-01-08 09:56:35 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Minor fixes and cleanups from Ming Zhang: - Fixed scst_cur_cmd_mem leak for real devices - Since scst_unregister_target_template() returnes void it should use down() instead of down_interruptible() - Cleanups Modified Paths: -------------- trunk/scst/src/scst.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_priv.h trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst.c =================================================================== --- trunk/scst/src/scst.c 2007-01-08 14:05:24 UTC (rev 72) +++ trunk/scst/src/scst.c 2007-01-08 17:56:35 UTC (rev 73) @@ -197,14 +197,11 @@ TRACE_ENTRY(); - if (down_interruptible(&scst_mutex) != 0) - goto out; - restart: + down(&scst_mutex); list_for_each_entry(tgt, &vtt->tgt_list, tgt_list_entry) { up(&scst_mutex); scst_unregister(tgt); - down(&scst_mutex); goto restart; } list_del(&vtt->scst_template_list_entry); @@ -212,7 +209,6 @@ scst_cleanup_proc_target_dir_entries(vtt); -out: TRACE_EXIT(); return; } Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2007-01-08 14:05:24 UTC (rev 72) +++ trunk/scst/src/scst_lib.c 2007-01-08 17:56:35 UTC (rev 73) @@ -1363,14 +1363,12 @@ if (cmd->no_sgv) { cmd->sg = scst_alloc(cmd->bufflen, gfp_mask, use_clustering, &cmd->sg_cnt); - if (cmd->sg == NULL) - goto out; } else { cmd->sg = sgv_pool_alloc(pool, cmd->bufflen, gfp_mask, &cmd->sg_cnt, &cmd->sgv); - if (cmd->sg == NULL) - goto out; } + if (cmd->sg == NULL) + goto out; if (unlikely(cmd->sg_cnt > ini_sg)) { static int ll; Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2007-01-08 14:05:24 UTC (rev 72) +++ trunk/scst/src/scst_priv.h 2007-01-08 17:56:35 UTC (rev 73) @@ -211,10 +211,9 @@ typeof(tgt_dev->expected_sn) e; - e = tgt_dev->expected_sn; tgt_dev->expected_sn++; + e = tgt_dev->expected_sn; smp_mb(); /* write must be before def_cmd_count read */ - e++; TRACE(TRACE_DEBUG/*TRACE_SCSI_SERIALIZING*/, "Next expected_sn: %d", e); return e; } Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2007-01-08 14:05:24 UTC (rev 72) +++ trunk/scst/src/scst_proc.c 2007-01-08 17:56:35 UTC (rev 73) @@ -474,6 +474,7 @@ return; } +/* scst_mutex supposed to be held */ static int scst_proc_group_add(const char *p) { int res = 0, len = strlen(p) + 1; @@ -514,6 +515,7 @@ goto out; } +/* scst_mutex supposed to be held */ static int scst_proc_del_free_acg(struct scst_acg *acg, int remove_proc) { const char *name; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-01-08 14:05:24 UTC (rev 72) +++ trunk/scst/src/scst_targ.c 2007-01-08 17:56:35 UTC (rev 73) @@ -1250,8 +1250,6 @@ req->sr_underflow = 0; req->sr_request->rq_disk = NULL; /* disown request blk */ - cmd->bufflen = req->sr_bufflen; //?? - scst_release_request(cmd); cmd->state = next_state; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-01-12 15:42:50
|
Revision: 77 http://svn.sourceforge.net/scst/?rev=77&view=rev Author: vlnb Date: 2007-01-12 07:42:31 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Some cleanup Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_fileio.c trunk/scst/src/scst.c trunk/scst/src/scst_proc.c Modified: trunk/scst/src/dev_handlers/scst_fileio.c =================================================================== --- trunk/scst/src/dev_handlers/scst_fileio.c 2007-01-11 12:46:22 UTC (rev 76) +++ trunk/scst/src/dev_handlers/scst_fileio.c 2007-01-12 15:42:31 UTC (rev 77) @@ -178,7 +178,7 @@ write_proc: cdrom_fileio_write_proc,\ } -DECLARE_MUTEX(scst_fileio_mutex); +static DECLARE_MUTEX(scst_fileio_mutex); static LIST_HEAD(disk_fileio_dev_list); static LIST_HEAD(cdrom_fileio_dev_list); Modified: trunk/scst/src/scst.c =================================================================== --- trunk/scst/src/scst.c 2007-01-11 12:46:22 UTC (rev 76) +++ trunk/scst/src/scst.c 2007-01-12 15:42:31 UTC (rev 77) @@ -125,32 +125,31 @@ PRINT_ERROR_PR("Target driver %s doesn't have a " "detect() method.", vtt->name); res = -EINVAL; - goto out; + goto out_err; } if (!vtt->release) { PRINT_ERROR_PR("Target driver %s doesn't have a " "release() method.", vtt->name); res = -EINVAL; - goto out; + goto out_err; } if (!vtt->xmit_response) { PRINT_ERROR_PR("Target driver %s doesn't have a " "xmit_response() method.", vtt->name); res = -EINVAL; - goto out; + goto out_err; } if (!vtt->no_proc_entry) { res = scst_build_proc_target_dir_entries(vtt); - if (res < 0) { - goto out; - } + if (res < 0) + goto out_err; } if (down_interruptible(&m) != 0) - goto out; + goto out_err; if (down_interruptible(&scst_mutex) != 0) goto out_m_up; @@ -179,32 +178,58 @@ res = 0; -out_m_up: + PRINT_INFO_PR("Target template %s registered successfully", vtt->name); + up(&m); out: TRACE_EXIT_RES(res); return res; +out_m_up: + up(&m); + out_cleanup: scst_cleanup_proc_target_dir_entries(vtt); + +out_err: + PRINT_ERROR_PR("Failed to register target template %s", vtt->name); goto out; } void scst_unregister_target_template(struct scst_tgt_template *vtt) { struct scst_tgt *tgt; + struct scst_tgt_template *t; + int found = 0; TRACE_ENTRY(); + down(&scst_mutex); + + list_for_each_entry(t, &scst_template_list, scst_template_list_entry) { + if (strcmp(t->name, vtt->name) == 0) { + found = 1; + break; + } + } + if (!found) { + PRINT_ERROR_PR("Target driver %s isn't registered", vtt->name); + goto out_up; + } + restart: - down(&scst_mutex); list_for_each_entry(tgt, &vtt->tgt_list, tgt_list_entry) { up(&scst_mutex); scst_unregister(tgt); + down(&scst_mutex); goto restart; } list_del(&vtt->scst_template_list_entry); + + PRINT_INFO_PR("Target template %s unregistered successfully", vtt->name); + +out_up: up(&scst_mutex); scst_cleanup_proc_target_dir_entries(vtt); @@ -222,7 +247,7 @@ tgt = kzalloc(sizeof(*tgt), GFP_KERNEL); if (tgt == NULL) { TRACE(TRACE_OUT_OF_MEM, "%s", "kzalloc() failed"); - goto out; + goto out_err; } INIT_LIST_HEAD(&tgt->sess_list); @@ -241,14 +266,25 @@ if (scst_build_proc_target_entries(tgt) < 0) { kfree(tgt); tgt = NULL; + goto out_up; } else list_add_tail(&tgt->tgt_list_entry, &vtt->tgt_list); up(&scst_mutex); + PRINT_INFO_PR("Target for template %s registered successfully", + vtt->name); + out: TRACE_EXIT(); return tgt; + +out_up: + up(&scst_mutex); + +out_err: + PRINT_ERROR_PR("Failed to register target for template %s", vtt->name); + goto out; } static inline int test_sess_list(struct scst_tgt *tgt) @@ -263,6 +299,7 @@ void scst_unregister(struct scst_tgt *tgt) { struct scst_session *sess; + struct scst_tgt_template *vtt = tgt->tgtt; TRACE_ENTRY(); @@ -290,6 +327,9 @@ kfree(tgt); + PRINT_INFO_PR("Target for template %s unregistered successfully", + vtt->name); + TRACE_EXIT(); return; } @@ -377,8 +417,7 @@ dev->rq_disk = alloc_disk(1); if (dev->rq_disk == NULL) { res = -ENOMEM; - scst_free_device(dev); - goto out; + goto out_free_dev; } dev->rq_disk->major = SCST_MAJOR; @@ -413,10 +452,11 @@ return res; out_free: + list_del(&dev->dev_list_entry); put_disk(dev->rq_disk); - list_del(&dev->dev_list_entry); - scst_assign_dev_handler(dev, NULL); +out_free_dev: + scst_free_device(dev); goto out; } @@ -437,7 +477,6 @@ break; } } - if (dev == NULL) { PRINT_ERROR_PR("%s", "Target device not found"); goto out_unblock; @@ -456,13 +495,13 @@ put_disk(dev->rq_disk); scst_free_device(dev); + PRINT_INFO_PR("Detached SCSI target mid-level from scsi%d, channel %d, " + "id %d, lun %d, type %d", scsidp->host->host_no, + scsidp->channel, scsidp->id, scsidp->lun, scsidp->type); + out_unblock: __scst_resume_activity(); - PRINT_INFO_PR("Detached SCSI target mid-level from scsi%d, channel %d, " - "id %d, lun %d, type %d", scsidp->host->host_no, scsidp->channel, - scsidp->id, scsidp->lun, scsidp->type); - TRACE_EXIT(); return; } @@ -545,8 +584,7 @@ TRACE_ENTRY(); - if (down_interruptible(&scst_mutex) != 0) - goto out; + down(&scst_mutex); __scst_suspend_activity(); @@ -557,7 +595,6 @@ break; } } - if (dev == NULL) { PRINT_ERROR_PR("%s", "Target device not found"); goto out_unblock; @@ -583,7 +620,6 @@ up(&scst_mutex); -out: TRACE_EXIT(); return; } @@ -601,7 +637,7 @@ PRINT_ERROR_PR("scst dev_type driver %s doesn't have a " "parse() method.", dev_type->name); res = -EINVAL; - goto out; + goto out_err; } #ifdef FILEIO_ONLY @@ -610,25 +646,24 @@ "supported. Recompile SCST with undefined FILEIO_ONLY", dev_type->name); res = -EINVAL; - goto out; + goto out_err; } #endif if (down_interruptible(&scst_mutex) != 0) { res = -EINTR; - goto out; + goto out_err; } exist = 0; list_for_each_entry(dt, &scst_dev_type_list, dev_type_list_entry) { - if (dt->type == dev_type->type) { - TRACE_DBG("Device type handler for type %d " - "already exist", dt->type); + if (strcmp(dt->name, dev_type->name) == 0) { + PRINT_ERROR_PR("Device type handler %s already exist", + dt->name); exist = 1; break; } } - if (exist) goto out_up; @@ -636,39 +671,60 @@ if (res < 0) { goto out_up; } - + list_add_tail(&dev_type->dev_type_list_entry, &scst_dev_type_list); __scst_suspend_activity(); list_for_each_entry(dev, &scst_dev_list, dev_list_entry) { - if (dev->scsi_dev == NULL) + if ((dev->scsi_dev == NULL) || (dev->handler != NULL)) continue; if (dev->scsi_dev->type == dev_type->type) scst_assign_dev_handler(dev, dev_type); } __scst_resume_activity(); -out_up: up(&scst_mutex); if (res == 0) { - PRINT_INFO_PR("Device handler %s for type %d loaded " + PRINT_INFO_PR("Device handler %s for type %d registered " "successfully", dev_type->name, dev_type->type); } out: TRACE_EXIT_RES(res); return res; + +out_up: + up(&scst_mutex); + +out_err: + PRINT_ERROR_PR("Failed to register device handler %s for type %d", + dev_type->name, dev_type->type); + goto out; } void scst_unregister_dev_driver(struct scst_dev_type *dev_type) { struct scst_device *dev; + struct scst_dev_type *dt; + int found = 0; TRACE_ENTRY(); down(&scst_mutex); + list_for_each_entry(dt, &scst_dev_type_list, dev_type_list_entry) { + if (strcmp(dt->name, dev_type->name) == 0) { + found = 1; + break; + } + } + if (!found) { + PRINT_ERROR_PR("Dev handler %s isn't registered", + dev_type->name); + goto out_up; + } + __scst_suspend_activity(); list_for_each_entry(dev, &scst_dev_list, dev_list_entry) { if (dev->handler == dev_type) { @@ -687,8 +743,13 @@ PRINT_INFO_PR("Device handler %s for type %d unloaded", dev_type->name, dev_type->type); +out: TRACE_EXIT(); return; + +out_up: + up(&scst_mutex); + goto out; } int scst_register_virtual_dev_driver(struct scst_dev_type *dev_type) @@ -701,20 +762,24 @@ PRINT_ERROR_PR("scst dev_type driver %s doesn't have a " "parse() method.", dev_type->name); res = -EINVAL; - goto out; + goto out_err; } res = scst_build_proc_dev_handler_dir_entries(dev_type); - if (res < 0) { - goto out; - } + if (res < 0) + goto out_err; - PRINT_INFO_PR("Device handler %s for type %d loaded " + PRINT_INFO_PR("Virtuel device handler %s for type %d registered " "successfully", dev_type->name, dev_type->type); out: TRACE_EXIT_RES(res); return res; + +out_err: + PRINT_ERROR_PR("Failed to register virtual device handler %s for " + "type %d", dev_type->name, dev_type->type); + goto out; } void scst_unregister_virtual_dev_driver(struct scst_dev_type *dev_type) Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2007-01-11 12:46:22 UTC (rev 76) +++ trunk/scst/src/scst_proc.c 2007-01-12 15:42:31 UTC (rev 77) @@ -834,6 +834,7 @@ return; } +/* Called under scst_mutex */ int scst_build_proc_target_entries(struct scst_tgt *vtt) { int res = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-01-17 14:47:32
|
Revision: 80 http://svn.sourceforge.net/scst/?rev=80&view=rev Author: vlnb Date: 2007-01-17 06:47:21 -0800 (Wed, 17 Jan 2007) Log Message: ----------- Minor TM-related fixes Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2007-01-16 17:51:48 UTC (rev 79) +++ trunk/scst/src/scst_lib.c 2007-01-17 14:47:21 UTC (rev 80) @@ -2270,7 +2270,7 @@ static int tm_dbg_on_state_passes; static DEFINE_TIMER(tm_dbg_timer, tm_dbg_timer_fn, 0, 0); -static const int tm_dbg_on_state_num_passes[] = { 10, 1, 0x7ffffff }; +static const int tm_dbg_on_state_num_passes[] = { 5, 1, 0x7ffffff }; void tm_dbg_init_tgt_dev(struct scst_tgt_dev *tgt_dev, struct scst_acg_dev *acg_dev) @@ -2308,16 +2308,20 @@ if (tm_dbg_delayed_cmds_count == 0) { unsigned long d = 58*HZ + (scst_random() % (4*HZ)); TRACE_MGMT_DBG("%s: delaying timed cmd %p (tag %d) " - "for %ld.%ld seconds (%ld HZ)", __func__, cmd, cmd->tag, - d/HZ, (d%HZ)*100/HZ, d); + "for %ld.%ld seconds (%ld HZ), " + "tm_dbg_on_state_passes=%d", __func__, cmd, + cmd->tag, d/HZ, (d%HZ)*100/HZ, d, + tm_dbg_on_state_passes); mod_timer(&tm_dbg_timer, jiffies + d); #if 0 tm_dbg_blocked = 1; #endif } else { TRACE_MGMT_DBG("%s: delaying another timed cmd %p " - "(tag %d), delayed_cmds_count=%d", __func__, cmd, - cmd->tag, tm_dbg_delayed_cmds_count); + "(tag %d), delayed_cmds_count=%d, " + "tm_dbg_on_state_passes=%d", __func__, cmd, + cmd->tag, tm_dbg_delayed_cmds_count, + tm_dbg_on_state_passes); if (tm_dbg_delayed_cmds_count == 2) tm_dbg_blocked = 0; } @@ -2326,8 +2330,10 @@ case TM_DBG_STATE_RESET: case TM_DBG_STATE_OFFLINE: TRACE_MGMT_DBG("%s: delaying cmd %p " - "(tag %d), delayed_cmds_count=%d", __func__, cmd, - cmd->tag, tm_dbg_delayed_cmds_count); + "(tag %d), delayed_cmds_count=%d, " + "tm_dbg_on_state_passes=%d", __func__, cmd, + cmd->tag, tm_dbg_delayed_cmds_count, + tm_dbg_on_state_passes); tm_dbg_blocked = 1; break; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-01-16 17:51:48 UTC (rev 79) +++ trunk/scst/src/scst_targ.c 2007-01-17 14:47:21 UTC (rev 80) @@ -722,6 +722,8 @@ scst_cmd_set_sn(cmd); spin_unlock_irqrestore(&scst_list_lock, flags); } + if (tm_dbg_check_cmd(cmd) != 0) + goto out; break; case SCST_PREPROCESS_STATUS_ERROR_SENSE_SET: @@ -3403,7 +3405,7 @@ mcmd->state = SCST_MGMT_CMD_STATE_FINISHED; if (scst_is_strict_mgmt_fn(mcmd->fn) && (mcmd->completed_cmd_count > 0)) - mcmd->status = SCST_MGMT_STATUS_FAILED; + mcmd->status = SCST_MGMT_STATUS_TASK_NOT_EXIST; if (mcmd->sess->tgt->tgtt->task_mgmt_fn_done) { TRACE_DBG("Calling target %s task_mgmt_fn_done()", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-02-22 10:34:45
|
Revision: 96 http://svn.sourceforge.net/scst/?rev=96&view=rev Author: vlnb Date: 2007-02-22 02:34:18 -0800 (Thu, 22 Feb 2007) Log Message: ----------- Minor fixes from/inspired by Vu Pham Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2007-02-21 18:15:19 UTC (rev 95) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2007-02-22 10:34:18 UTC (rev 96) @@ -2160,6 +2160,7 @@ if (bio_add_page(bio, page, bytes, off) < bytes) { need_new_bio = 1; lba_start += thislen >> virt_dev->block_shift; + thislen = 0; continue; } Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2007-02-21 18:15:19 UTC (rev 95) +++ trunk/scst/src/scst_lib.c 2007-02-22 10:34:18 UTC (rev 96) @@ -2340,13 +2340,13 @@ { #ifdef STRICT_SERIALIZING struct scst_cmd *cmd, *t; + unsigned long flags; TRACE_ENTRY(); local_irq_save(flags); list_for_each_entry_safe(cmd, t, &dev->blocked_cmd_list, blocked_cmd_list_entry) { - unsigned long flags; int brk = 0; /* * Since only one cmd per time is being executed, expected_sn @@ -2374,7 +2374,7 @@ if (brk) break; } - local_irq_restore(, flags); + local_irq_restore(flags); #else /* STRICT_SERIALIZING */ struct scst_cmd *cmd, *tcmd; unsigned long flags; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-02-21 18:15:19 UTC (rev 95) +++ trunk/scst/src/scst_targ.c 2007-02-22 10:34:18 UTC (rev 96) @@ -2464,14 +2464,10 @@ } break; - default: - PRINT_ERROR_PR("Unsupported queue type %d, treating it as " - "ORDERED", cmd->queue_type); - cmd->queue_type = SCST_CMD_QUEUE_ORDERED; - /* go through */ case SCST_CMD_QUEUE_ORDERED: TRACE(TRACE_SCSI|TRACE_SCSI_SERIALIZING, "ORDERED cmd %p " "(op %x)", cmd, cmd->cdb[0]); +ordered: if (!tgt_dev->prev_cmd_ordered) { spin_lock_irqsave(&tgt_dev->sn_lock, flags); tgt_dev->num_free_sn_slots--; @@ -2491,7 +2487,6 @@ tgt_dev->num_free_sn_slots++; spin_unlock_irqrestore(&tgt_dev->sn_lock, flags); } -ordered: tgt_dev->prev_cmd_ordered = 1; tgt_dev->curr_sn++; cmd->sn = tgt_dev->curr_sn; @@ -2506,6 +2501,12 @@ list_add(&cmd->sn_cmd_list_entry, &tgt_dev->hq_cmd_list); spin_unlock_irqrestore(&tgt_dev->sn_lock, flags); break; + + default: + PRINT_ERROR_PR("Unsupported queue type %d, treating it as " + "ORDERED", cmd->queue_type); + cmd->queue_type = SCST_CMD_QUEUE_ORDERED; + goto ordered; } TRACE_SN("cmd(%p)->sn: %d (tgt_dev %p, *cur_sn_slot %d, " This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-03-02 15:07:18
|
Revision: 100 http://svn.sourceforge.net/scst/?rev=100&view=rev Author: vlnb Date: 2007-03-02 07:06:55 -0800 (Fri, 02 Mar 2007) Log Message: ----------- Fixed case, when resid == cmd->resp_data_len for real devices Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2007-02-28 12:55:35 UTC (rev 99) +++ trunk/scst/src/scst_lib.c 2007-03-02 15:06:55 UTC (rev 100) @@ -132,7 +132,7 @@ cmd->orig_sg_cnt = cmd->sg_cnt; cmd->orig_sg_entry = i; cmd->orig_entry_len = cmd->sg[i].length; - cmd->sg_cnt = i+1; + cmd->sg_cnt = (left > 0) ? i+1 : i; cmd->sg[i].length = left; cmd->sg_buff_modified = 1; break; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-02-28 12:55:35 UTC (rev 99) +++ trunk/scst/src/scst_targ.c 2007-03-02 15:06:55 UTC (rev 100) @@ -1140,7 +1140,7 @@ cmd->driver_status = driver_byte(result); if (unlikely(resid != 0)) { #ifdef EXTRACHECKS - if ((resid < 0) || (resid >= cmd->resp_data_len)) { + if ((resid < 0) || (resid > cmd->resp_data_len)) { PRINT_ERROR_PR("Wrong resid %d (cmd->resp_data_len=%d)", resid, cmd->resp_data_len); } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-03-07 17:10:57
|
Revision: 102 http://svn.sourceforge.net/scst/?rev=102&view=rev Author: vlnb Date: 2007-03-07 09:10:45 -0800 (Wed, 07 Mar 2007) Log Message: ----------- - D_SENSE value corrected - REPORT DENSITY SUPPORT command added Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_cdbprobe.h Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2007-03-02 16:29:36 UTC (rev 101) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2007-03-07 17:10:45 UTC (rev 102) @@ -1257,7 +1257,7 @@ static int vdisk_ctrl_m_pg(unsigned char *p, int pcontrol, struct scst_vdisk_dev *virt_dev) { /* Control mode page for mode_sense */ - const unsigned char ctrl_m_pg[] = {0xa, 0xa, 0x22, 0, 0, 0x40, 0, 0, + const unsigned char ctrl_m_pg[] = {0xa, 0xa, 0x20, 0, 0, 0x40, 0, 0, 0, 0, 0x2, 0x4b}; memcpy(p, ctrl_m_pg, sizeof(ctrl_m_pg)); Modified: trunk/scst/src/scst_cdbprobe.h =================================================================== --- trunk/scst/src/scst_cdbprobe.h 2007-03-02 16:29:36 UTC (rev 101) +++ trunk/scst/src/scst_cdbprobe.h 2007-03-07 17:10:45 UTC (rev 102) @@ -297,6 +297,8 @@ SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x43, " O ", "READ TOC/PMA/ATIP", SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, + {0x44, " M ", "REPORT DENSITY SUPPORT", + SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x44, " O ", "READ HEADER", SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2}, {0x45, " O ", "PLAY AUDIO(10)", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-05-08 09:26:49
|
Revision: 114 http://svn.sourceforge.net/scst/?rev=114&view=rev Author: vlnb Date: 2007-05-08 02:26:48 -0700 (Tue, 08 May 2007) Log Message: ----------- Internal REQUEST SENSE fixes Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2007-05-08 09:22:48 UTC (rev 113) +++ trunk/scst/src/scst_lib.c 2007-05-08 09:26:48 UTC (rev 114) @@ -845,13 +845,12 @@ TRACE_ENTRY(); res = scst_alloc_cmd(gfp_mask); - if (unlikely(res == NULL)) { + if (res == NULL) goto out; - } res->cmd_lists = orig_cmd->cmd_lists; res->sess = orig_cmd->sess; - res->state = SCST_CMD_STATE_SEND_TO_MIDLEV; + res->state = SCST_CMD_STATE_DEV_PARSE; res->atomic = scst_cmd_atomic(orig_cmd); res->internal = 1; res->tgtt = orig_cmd->tgtt; @@ -864,21 +863,10 @@ res->orig_cmd = orig_cmd; res->bufflen = bufsize; - if (bufsize > 0) { - if (scst_alloc_space(res) != 0) - PRINT_ERROR_PR("Unable to create buffer (size %d) for " - "internal cmd", bufsize); - goto out_free_res; - } out: TRACE_EXIT_HRES((unsigned long)res); return res; - -out_free_res: - scst_destroy_cmd(res); - res = NULL; - goto out; } void scst_free_internal_cmd(struct scst_cmd *cmd) @@ -895,14 +883,14 @@ { int res = SCST_CMD_STATE_RES_CONT_NEXT; #define sbuf_size 252 - static const unsigned char request_sense[6] = + static const uint8_t request_sense[6] = { REQUEST_SENSE, 0, 0, 0, sbuf_size, 0 }; struct scst_cmd *rs_cmd; TRACE_ENTRY(); rs_cmd = scst_create_prepare_internal_cmd(orig_cmd, sbuf_size); - if (rs_cmd != 0) + if (rs_cmd == NULL) goto out_error; memcpy(rs_cmd->cdb, request_sense, sizeof(request_sense)); @@ -933,11 +921,20 @@ TRACE_ENTRY(); + if (cmd->dev->handler->dev_done != NULL) { + int rc; + TRACE_DBG("Calling dev handler %s dev_done(%p)", + cmd->dev->handler->name, cmd); + rc = cmd->dev->handler->dev_done(cmd); + TRACE_DBG("Dev handler %s dev_done() returned %d", + cmd->dev->handler->name, rc); + } + sBUG_ON(orig_cmd); len = scst_get_buf_first(cmd, &buf); - if ((cmd->status == 0) && SCST_SENSE_VALID(buf) && + if ((cmd->status == 0) && (len > 0) && SCST_SENSE_VALID(buf) && (!SCST_NO_SENSE(buf))) { TRACE_BUFF_FLAG(TRACE_SCSI, "REQUEST SENSE returned", @@ -951,7 +948,8 @@ scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); } - scst_put_buf(cmd, buf); + if (len > 0) + scst_put_buf(cmd, buf); scst_free_internal_cmd(cmd); @@ -2760,7 +2758,7 @@ * blocked_cmd_list, but we could be called before * scst_inc_expected_sn(). */ - if (likely(!cmd->internal) && likely(!cmd->retry)) { + if (likely(!cmd->internal && !cmd->retry)) { typeof(cmd->tgt_dev->expected_sn) expected_sn; if (cmd->tgt_dev == NULL) sBUG(); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-05-08 09:22:48 UTC (rev 113) +++ trunk/scst/src/scst_targ.c 2007-05-08 09:26:48 UTC (rev 114) @@ -287,7 +287,7 @@ cmd->inc_expected_sn_on_done = dev->handler->inc_expected_sn_on_done; - if (cmd->skip_parse) + if (cmd->skip_parse || cmd->internal) goto call_parse; /* @@ -1820,7 +1820,7 @@ __scst_get(0); /* protect dev & tgt_dev */ - if (unlikely(cmd->internal) || unlikely(cmd->retry)) { + if (unlikely(cmd->internal || cmd->retry)) { rc = scst_do_send_to_midlev(cmd); /* !! At this point cmd, sess & tgt_dev can be already freed !! */ if (rc == SCST_EXEC_NEED_THREAD) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-09-25 09:36:28
|
Revision: 196 http://scst.svn.sourceforge.net/scst/?rev=196&view=rev Author: vlnb Date: 2007-09-25 02:36:27 -0700 (Tue, 25 Sep 2007) Log Message: ----------- - Fixes wrong IRQ-safe/IRQ-unsafe locking dependancy spotted by lockdep: scst_check_local_events() must not be called with IRQs disabled - Cosmetics Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2007-09-25 09:34:37 UTC (rev 195) +++ trunk/scst/src/dev_handlers/scst_user.c 2007-09-25 09:36:27 UTC (rev 196) @@ -1446,6 +1446,7 @@ return res; } +/* Called under cmd_lists.cmd_list_lock and IRQ off */ struct dev_user_cmd *__dev_user_get_next_cmd(struct list_head *cmd_list) { struct dev_user_cmd *u; @@ -1459,11 +1460,11 @@ EXTRACHECKS_BUG_ON(u->state & UCMD_STATE_JAMMED_MASK); if (u->cmd != NULL) { if (u->state == UCMD_STATE_EXECING) { - int rc = scst_check_local_events(u->cmd); + struct scst_user_dev *dev = u->dev; + int rc; + spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); + rc = scst_check_local_events(u->cmd); if (unlikely(rc != 0)) { - struct scst_user_dev *dev = u->dev; - spin_unlock_irq( - &dev->cmd_lists.cmd_list_lock); u->cmd->scst_cmd_done(u->cmd, SCST_CMD_STATE_DEFAULT); /* @@ -1474,6 +1475,11 @@ &dev->cmd_lists.cmd_list_lock); goto again; } + /* + * There is no real need to lock again here, but + * let's do it for simplicity. + */ + spin_lock_irq(&dev->cmd_lists.cmd_list_lock); } else if (unlikely(test_bit(SCST_CMD_ABORTED, &u->cmd->cmd_flags))) { switch(u->state) { Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2007-09-25 09:34:37 UTC (rev 195) +++ trunk/scst/src/scst_mem.c 2007-09-25 09:36:27 UTC (rev 196) @@ -471,19 +471,14 @@ pages = sgv_pool_oom_free_objs(pages); if (pages > 0) { - static int q; - if (q < 100) { - q++; - TRACE(TRACE_OUT_OF_MEM, "Requested amount of " - "memory for being executed commands " - "exceeds allowed maximum %dMB, " - "should you increase scst_max_cmd_mem " - "(requested %d pages)? (This warning " - "will be shown only %d more times)", - sgv_pools_mgr.mgr.thr.hi_wmk >> - (20-PAGE_SHIFT), pages_to_alloc, - 100-q); - } + TRACE(TRACE_OUT_OF_MEM, "Requested amount of " + "memory (%d pages) for being executed " + "commands together with the already " + "allocated memory exceeds the allowed " + "maximum %dMB. Should you increase " + "scst_max_cmd_mem?", pages_to_alloc, + sgv_pools_mgr.mgr.thr.hi_wmk >> + (20-PAGE_SHIFT)); sgv_pools_mgr.mgr.thr.releases_failed++; res = -ENOMEM; goto out_unlock; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-09-25 09:34:37 UTC (rev 195) +++ trunk/scst/src/scst_targ.c 2007-09-25 09:36:27 UTC (rev 196) @@ -1449,6 +1449,7 @@ goto out; } +/* No locks, no IRQ or IRQ-safe context allowed */ int scst_check_local_events(struct scst_cmd *cmd) { int res, rc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-11-02 19:21:03
|
Revision: 217 http://scst.svn.sourceforge.net/scst/?rev=217&view=rev Author: vlnb Date: 2007-11-02 12:20:59 -0700 (Fri, 02 Nov 2007) Log Message: ----------- Minor pass-through related fixes and logging improvelemnts Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2007-11-02 11:02:50 UTC (rev 216) +++ trunk/scst/src/scst_lib.c 2007-11-02 19:20:59 UTC (rev 217) @@ -1696,10 +1696,10 @@ #ifdef EXTRACHECKS if (unlikely((info_p->transfer_len == 0) && - (info_p->direction != SCST_DATA_NONE)) && - !(info_p->flags & SCST_UNKNOWN_LENGTH)) { - PRINT_ERROR("transfer_len 0, direction %d change on %d", - info_p->direction, SCST_DATA_NONE); + (info_p->direction != SCST_DATA_NONE) && + ((info_p->flags & SCST_UNKNOWN_LENGTH) == 0))) { + PRINT_ERROR("transfer_len 0, direction %d, flags %x, changing " + "direction on NONE", info_p->direction, info_p->flags); info_p->direction = SCST_DATA_NONE; } #endif Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2007-11-02 11:02:50 UTC (rev 216) +++ trunk/scst/src/scst_main.c 2007-11-02 19:20:59 UTC (rev 217) @@ -1369,6 +1369,77 @@ .remove = scst_remove, }; +static void __init scst_print_config(void) +{ + char buf[128]; + int i, j; + + i = snprintf(buf, sizeof(buf), "Enabled features: "); + j = i; + +#ifdef STRICT_SERIALIZING + i += snprintf(&buf[i], sizeof(buf) - i, "Strict serializing"); +#endif + +#ifdef EXTRACHECKS + i += snprintf(&buf[i], sizeof(buf) - i, "%sEXTRACHECKS", + (j == i) ? "" : ", "); +#endif + +#ifdef TRACING + i += snprintf(&buf[i], sizeof(buf) - i, "%sTRACING", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG_TM + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_TM", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG_RETRY + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_RETRY", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG_OOM + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_OOM", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG_SN + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_SN", + (j == i) ? "" : ", "); +#endif + +#ifdef USE_EXPECTED_VALUES + i += snprintf(&buf[i], sizeof(buf) - i, "%sUSE_EXPECTED_VALUES", + (j == i) ? "" : ", "); +#endif + +#ifdef ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ + i += snprintf(&buf[i], sizeof(buf) - i, "%sALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ", + (j == i) ? "" : ", "); +#endif + +#ifdef SCST_STRICT_SECURITY + i += snprintf(&buf[i], sizeof(buf) - i, "%sSCST_STRICT_SECURITY", + (j == i) ? "" : ", "); +#endif + +#ifdef SCST_HIGHMEM + i += snprintf(&buf[i], sizeof(buf) - i, "%sSCST_HIGHMEM", + (j == i) ? "" : ", "); +#endif + + if (j != i) + PRINT_INFO("%s", buf); +} + static int __init init_scst(void) { int res = 0, i; @@ -1501,6 +1572,8 @@ PRINT_INFO("SCST version %s loaded successfully (max mem for " "commands %ld Mb)", SCST_VERSION_STRING, scst_max_cmd_mem >> 20); + scst_print_config(); + out: TRACE_EXIT_RES(res); return res; Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2007-11-02 11:02:50 UTC (rev 216) +++ trunk/scst/src/scst_proc.c 2007-11-02 19:20:59 UTC (rev 217) @@ -1638,6 +1638,22 @@ seq_printf(seq, "DEBUG_SN\n"); #endif +#ifdef USE_EXPECTED_VALUES + seq_printf(seq, "USE_EXPECTED_VALUES\n"); +#endif + +#ifdef ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ + seq_printf(seq, "ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ\n"); +#endif + +#ifdef SCST_STRICT_SECURITY + seq_printf(seq, "SCST_STRICT_SECURITY\n"); +#endif + +#ifdef SCST_HIGHMEM + seq_printf(seq, "SCST_HIGHMEM\n"); +#endif + TRACE_EXIT(); return 0; } Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-11-02 11:02:50 UTC (rev 216) +++ trunk/scst/src/scst_targ.c 2007-11-02 19:20:59 UTC (rev 217) @@ -356,12 +356,13 @@ if (scst_cmd_is_expected_set(cmd)) { /* * Command data length can't be easily - * determined from the CDB. Get it from + * determined from the CDB. ToDo, that should + * be fixed. Until it's fixed, get it from * the supplied expected value, but - * limit it to some reasonable value (50MB). + * limit it to some reasonable value (15MB). */ cmd->bufflen = min(cmd->expected_transfer_len, - 50*1024*1024); + 15*1024*1024); } else cmd->bufflen = 0; } else @@ -428,24 +429,18 @@ goto out_error; } + if (unlikely(state == SCST_CMD_STATE_XMIT_RESP)) + goto set_res; + #ifdef EXTRACHECKS - if ((state != SCST_CMD_STATE_XMIT_RESP) && - (((cmd->data_direction == SCST_DATA_UNKNOWN) && - (state != SCST_CMD_STATE_DEV_PARSE)) || - ((cmd->bufflen != 0) && - (cmd->data_direction == SCST_DATA_NONE) && - (cmd->status == 0)) || - ((cmd->bufflen == 0) && - (cmd->data_direction != SCST_DATA_NONE)) || - ((cmd->bufflen != 0) && (cmd->sg == NULL) && - (state > SCST_CMD_STATE_PREPARE_SPACE)))) - { + if ((cmd->bufflen != 0) && + ((cmd->data_direction == SCST_DATA_NONE) || + ((cmd->sg == NULL) && (state > SCST_CMD_STATE_PREPARE_SPACE)))) { PRINT_ERROR("Dev handler %s parse() returned " - "invalid cmd data_direction %d, " - "bufflen %d or state %d (opcode 0x%x)", - dev->handler->name, - cmd->data_direction, cmd->bufflen, - state, cmd->cdb[0]); + "invalid cmd data_direction %d, bufflen %d, state %d " + "or sg %p (opcode 0x%x)", dev->handler->name, + cmd->data_direction, cmd->bufflen, state, cmd->sg, + cmd->cdb[0]); goto out_error; } #endif @@ -478,7 +473,8 @@ if (unlikely(cmd->bufflen != cmd->expected_transfer_len)) { PRINT_INFO("Warning: expected transfer length %d for " "opcode 0x%02x (handler %s, target %s) doesn't " - "match decoded value %d. Faulty initiator?", + "match decoded value %d. Faulty initiator or " + "scst_scsi_op_table should be updated?", cmd->expected_transfer_len, cmd->cdb[0], dev->handler->name, cmd->tgtt->name, cmd->bufflen); @@ -486,6 +482,16 @@ #endif } + if ((cmd->data_direction == SCST_DATA_UNKNOWN) || + ((cmd->bufflen == 0) && (cmd->data_direction != SCST_DATA_NONE))) { + PRINT_ERROR("Wrong data direction (%d) or/and buffer " + "length (%d). Opcode 0x%x, handler %s, target %s", + cmd->data_direction, cmd->bufflen, cmd->cdb[0], + dev->handler->name, cmd->tgtt->name); + goto out_error; + } + +set_res: switch (state) { case SCST_CMD_STATE_PREPARE_SPACE: case SCST_CMD_STATE_DEV_PARSE: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-02-01 15:41:50
|
Revision: 253 http://scst.svn.sourceforge.net/scst/?rev=253&view=rev Author: vlnb Date: 2008-02-01 07:41:38 -0800 (Fri, 01 Feb 2008) Log Message: ----------- Clustering statistic added Modified Paths: -------------- trunk/scst/src/scst_mem.c trunk/scst/src/scst_mem.h Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2008-02-01 10:33:47 UTC (rev 252) +++ trunk/scst/src/scst_mem.c 2008-02-01 15:41:38 UTC (rev 253) @@ -602,6 +602,23 @@ goto out_fail_free_sg_entries; } + if (cache) { + atomic_add(pages_to_alloc - obj->sg_count, + &pool->cache_acc[order].merged); + } else { + if (no_cached) { + atomic_add(pages_to_alloc, + &pool->acc.other_pages); + atomic_add(pages_to_alloc - obj->sg_count, + &pool->acc.other_merged); + } else { + atomic_add(pages_to_alloc, + &pool->acc.big_pages); + atomic_add(pages_to_alloc - obj->sg_count, + &pool->acc.big_merged); + } + } + success: spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock); sgv_pools_mgr.mgr.thr.active_pages_total += 1 << order; @@ -795,6 +812,10 @@ atomic_set(&pool->acc.other_alloc, 0); atomic_set(&pool->acc.big_alloc, 0); + atomic_set(&pool->acc.other_pages, 0); + atomic_set(&pool->acc.big_pages, 0); + atomic_set(&pool->acc.other_merged, 0); + atomic_set(&pool->acc.big_merged, 0); pool->clustered = clustered; pool->alloc_fns.alloc_pages_fn = scst_alloc_sys_pages; @@ -811,6 +832,7 @@ atomic_set(&pool->cache_acc[i].total_alloc, 0); atomic_set(&pool->cache_acc[i].hit_alloc, 0); + atomic_set(&pool->cache_acc[i].merged, 0); if (i <= sgv_pools_mgr.sgv_max_local_order) { size = sizeof(*obj) + (1 << i) * @@ -1156,28 +1178,49 @@ static void scst_do_sgv_read(struct seq_file *seq, const struct sgv_pool *pool) { - int i, total = 0, hit = 0; + int i, total = 0, hit = 0, merged = 0, allocated = 0; + int oa, om; for(i = 0; i < SGV_POOL_ELEMENTS; i++) { + int t; + hit += atomic_read(&pool->cache_acc[i].hit_alloc); total += atomic_read(&pool->cache_acc[i].total_alloc); + + t = atomic_read(&pool->cache_acc[i].total_alloc) - + atomic_read(&pool->cache_acc[i].hit_alloc); + allocated += t * (1 << i); + merged += atomic_read(&pool->cache_acc[i].merged); } - seq_printf(seq, "\n%-30s %-11d %-11d %d/%d (P/O)\n", pool->name, - hit, total, - pool->acc.cached_pages, - pool->acc.cached_entries); + seq_printf(seq, "\n%-30s %-11d %-11d %-11d %d/%d (P/O)\n", pool->name, + hit, total, (allocated != 0) ? merged*100/allocated : 0, + pool->acc.cached_pages, pool->acc.cached_entries); for(i = 0; i < SGV_POOL_ELEMENTS; i++) { - seq_printf(seq, " %-28s %-11d %-11d\n", pool->cache_names[i], + int t = atomic_read(&pool->cache_acc[i].total_alloc) - + atomic_read(&pool->cache_acc[i].hit_alloc); + allocated = t * (1 << i); + merged = atomic_read(&pool->cache_acc[i].merged); + + seq_printf(seq, " %-28s %-11d %-11d %d\n", + pool->cache_names[i], atomic_read(&pool->cache_acc[i].hit_alloc), - atomic_read(&pool->cache_acc[i].total_alloc)); + atomic_read(&pool->cache_acc[i].total_alloc), + (allocated != 0) ? merged*100/allocated : 0); } - seq_printf(seq, " %-28s %-11d %-11d\n", "big/other", - atomic_read(&pool->acc.big_alloc), - atomic_read(&pool->acc.other_alloc)); + allocated = atomic_read(&pool->acc.big_pages); + merged = atomic_read(&pool->acc.big_merged); + oa = atomic_read(&pool->acc.other_pages); + om = atomic_read(&pool->acc.other_merged); + seq_printf(seq, " %-40s %d/%-9d %d/%d\n", "big/other", + atomic_read(&pool->acc.big_alloc), + atomic_read(&pool->acc.other_alloc), + (allocated != 0) ? merged*100/allocated : 0, + (oa != 0) ? om/oa : 0); + return; } @@ -1196,8 +1239,8 @@ sgv_pools_mgr.mgr.thr.releases_on_hiwmk, sgv_pools_mgr.mgr.thr.releases_failed); - seq_printf(seq, "%-30s %-11s %-11s %-11s", "Name", "Hit", "Total", - "Cached"); + seq_printf(seq, "%-30s %-11s %-11s %-11s %-11s", "Name", "Hit", "Total", + "% merged", "Cached"); mutex_lock(&sgv_pools_mgr.scst_sgv_pool_mutex); list_for_each_entry(pool, &sgv_pools_mgr.scst_sgv_pool_list, Modified: trunk/scst/src/scst_mem.h =================================================================== --- trunk/scst/src/scst_mem.h 2008-02-01 10:33:47 UTC (rev 252) +++ trunk/scst/src/scst_mem.h 2008-02-01 15:41:38 UTC (rev 253) @@ -54,11 +54,14 @@ { u32 cached_pages, cached_entries; atomic_t big_alloc, other_alloc; + atomic_t big_pages, other_pages; + atomic_t big_merged, other_merged; }; struct sgv_pool_cache_acc { - atomic_t total_alloc, hit_alloc; + atomic_t total_alloc, hit_alloc; + atomic_t merged; }; struct sgv_pool_alloc_fns This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-12 15:58:40
|
Revision: 365 http://scst.svn.sourceforge.net/scst/?rev=365&view=rev Author: vlnb Date: 2008-05-12 08:58:34 -0700 (Mon, 12 May 2008) Log Message: ----------- - Fixed GFP_KERNEL misuse. Reported independently by mb...@ch... and Erez Zilber <er...@Vo...> - Fixed not sufficient in_irq() to determine atomic allocation context. Reported by mb...@ch... Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_priv.h trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-05-07 18:44:15 UTC (rev 364) +++ trunk/scst/src/scst_lib.c 2008-05-12 15:58:34 UTC (rev 365) @@ -1089,7 +1089,7 @@ TRACE(TRACE_DEBUG | TRACE_SCSI, "%s", "Sending RELEASE req to " "SCSI mid-level"); rc = scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0, - sense, SCST_DEFAULT_TIMEOUT, 0, GFP_KERNEL); + sense, SCST_DEFAULT_TIMEOUT, 0, 0); TRACE_DBG("MODE_SENSE done: %x", rc); if (scsi_status_is_good(rc)) { @@ -2336,7 +2336,7 @@ TRACE(TRACE_SCSI, "%s", "Doing internal MODE_SENSE"); res = scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ, buffer, sizeof(buffer), sense_buffer, SCST_DEFAULT_TIMEOUT, - 0, GFP_KERNEL); + 0, 0); TRACE_DBG("MODE_SENSE done: %x", res); Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2008-05-07 18:44:15 UTC (rev 364) +++ trunk/scst/src/scst_priv.h 2008-05-12 15:58:34 UTC (rev 365) @@ -133,6 +133,11 @@ return SCST_CONTEXT_DIRECT; } +static inline bool scst_is_context_gfp_atomic(void) +{ + return irqs_disabled() || in_atomic() || in_interrupt(); +} + extern unsigned long scst_max_cmd_mem; extern mempool_t *scst_mgmt_mempool; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-07 18:44:15 UTC (rev 364) +++ trunk/scst/src/scst_targ.c 2008-05-12 15:58:34 UTC (rev 365) @@ -1086,7 +1086,8 @@ } if (cmd->status == SAM_STAT_CHECK_CONDITION) - scst_alloc_set_sense(cmd, in_irq(), rq_sense, rq_sense_len); + scst_alloc_set_sense(cmd, scst_is_context_gfp_atomic(), + rq_sense, rq_sense_len); TRACE(TRACE_SCSI, "result=%x, cmd->status=%x, resid=%d, " "cmd->msg_status=%x, cmd->host_status=%x, " This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-20 14:17:29
|
Revision: 379 http://scst.svn.sourceforge.net/scst/?rev=379&view=rev Author: vlnb Date: 2008-05-20 07:17:25 -0700 (Tue, 20 May 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: As discussed earlier today, GNU-style named initializers should be replaced by C99-style named initializers. The patch below realizes this. The patch below contains one additional change: double quotes are added around a #warning message. These double qoutes are not required by the C89 or C99 language standards, but many tools expect these (e.g. checkpatch.pl). This patch has been tested as follows: * Verified that SCST still compiles and links (make scst iscsi && make -C srpt) * Verified that checkpatch.pl does no longer complain on named initializers. * Verified that the kernel patch generated by scripts/generate-kernel-patch applies cleanly to the 2.6.25.4 kernel, that the patched kernel compiles cleanly, installs properly and that it was possible after reboot to load the modules scst, iscsi-scst and ib_srpt load. Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_cdrom.c trunk/scst/src/dev_handlers/scst_changer.c trunk/scst/src/dev_handlers/scst_disk.c trunk/scst/src/dev_handlers/scst_modisk.c trunk/scst/src/dev_handlers/scst_processor.c trunk/scst/src/dev_handlers/scst_raid.c trunk/scst/src/dev_handlers/scst_tape.c trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_main.c Modified: trunk/scst/src/dev_handlers/scst_cdrom.c =================================================================== --- trunk/scst/src/dev_handlers/scst_cdrom.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_cdrom.c 2008-05-20 14:17:25 UTC (rev 379) @@ -27,15 +27,15 @@ #define CDROM_NAME "dev_cdrom" -#define CDROM_TYPE { \ - name: CDROM_NAME, \ - type: TYPE_ROM, \ - parse_atomic: 1, \ - dev_done_atomic: 1, \ - attach: cdrom_attach, \ - detach: cdrom_detach, \ - parse: cdrom_parse, \ - dev_done: cdrom_done, \ +#define CDROM_TYPE { \ + .name = CDROM_NAME, \ + .type = TYPE_ROM, \ + .parse_atomic = 1, \ + .dev_done_atomic = 1, \ + .attach = cdrom_attach, \ + .detach = cdrom_detach, \ + .parse = cdrom_parse, \ + .dev_done = cdrom_done, \ } #define CDROM_SMALL_TIMEOUT (3 * HZ) Modified: trunk/scst/src/dev_handlers/scst_changer.c =================================================================== --- trunk/scst/src/dev_handlers/scst_changer.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_changer.c 2008-05-20 14:17:25 UTC (rev 379) @@ -26,15 +26,15 @@ #define CHANGER_NAME "dev_changer" -#define CHANGER_TYPE { \ - name: CHANGER_NAME, \ - type: TYPE_MEDIUM_CHANGER,\ - parse_atomic: 1, \ -/* dev_done_atomic: 1,*/ \ - attach: changer_attach, \ -/* detach: changer_detach,*/ \ - parse: changer_parse, \ -/* dev_done: changer_done*/ \ +#define CHANGER_TYPE { \ + .name = CHANGER_NAME, \ + .type = TYPE_MEDIUM_CHANGER, \ + .parse_atomic = 1, \ +/* .dev_done_atomic = 1, */ \ + .attach = changer_attach, \ +/* .detach = changer_detach, */ \ + .parse = changer_parse, \ +/* .dev_done = changer_done */ \ } #define CHANGER_RETRIES 2 Modified: trunk/scst/src/dev_handlers/scst_disk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_disk.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_disk.c 2008-05-20 14:17:25 UTC (rev 379) @@ -32,29 +32,29 @@ # define DISK_NAME "dev_disk" # define DISK_PERF_NAME "dev_disk_perf" -#define DISK_TYPE { \ - name: DISK_NAME, \ - type: TYPE_DISK, \ - parse_atomic: 1, \ - dev_done_atomic: 1, \ - exec_atomic: 1, \ - attach: disk_attach, \ - detach: disk_detach, \ - parse: disk_parse, \ - dev_done: disk_done, \ +#define DISK_TYPE { \ + .name = DISK_NAME, \ + .type = TYPE_DISK, \ + .parse_atomic = 1, \ + .dev_done_atomic = 1, \ + .exec_atomic = 1, \ + .attach = disk_attach, \ + .detach = disk_detach, \ + .parse = disk_parse, \ + .dev_done = disk_done, \ } -#define DISK_PERF_TYPE { \ - name: DISK_PERF_NAME, \ - type: TYPE_DISK, \ - parse_atomic: 1, \ - dev_done_atomic: 1, \ - exec_atomic: 1, \ - attach: disk_attach, \ - detach: disk_detach, \ - parse: disk_parse, \ - dev_done: disk_done, \ - exec: disk_exec, \ +#define DISK_PERF_TYPE { \ + .name = DISK_PERF_NAME, \ + .type = TYPE_DISK, \ + .parse_atomic = 1, \ + .dev_done_atomic = 1, \ + .exec_atomic = 1, \ + .attach = disk_attach, \ + .detach = disk_detach, \ + .parse = disk_parse, \ + .dev_done = disk_done, \ + .exec = disk_exec, \ } #define DISK_SMALL_TIMEOUT (3 * HZ) Modified: trunk/scst/src/dev_handlers/scst_modisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_modisk.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_modisk.c 2008-05-20 14:17:25 UTC (rev 379) @@ -32,29 +32,29 @@ # define MODISK_NAME "dev_modisk" # define MODISK_PERF_NAME "dev_modisk_perf" -#define MODISK_TYPE { \ - name: MODISK_NAME, \ - type: TYPE_MOD, \ - parse_atomic: 1, \ - dev_done_atomic: 1, \ - exec_atomic: 1, \ - attach: modisk_attach, \ - detach: modisk_detach, \ - parse: modisk_parse, \ - dev_done: modisk_done, \ +#define MODISK_TYPE { \ + .name = MODISK_NAME, \ + .type = TYPE_MOD, \ + .parse_atomic = 1, \ + .dev_done_atomic = 1, \ + .exec_atomic = 1, \ + .attach = modisk_attach, \ + .detach = modisk_detach, \ + .parse = modisk_parse, \ + .dev_done = modisk_done, \ } -#define MODISK_PERF_TYPE { \ - name: MODISK_PERF_NAME, \ - type: TYPE_MOD, \ - parse_atomic: 1, \ - dev_done_atomic: 1, \ - exec_atomic: 1, \ - attach: modisk_attach, \ - detach: modisk_detach, \ - parse: modisk_parse, \ - dev_done: modisk_done, \ - exec: modisk_exec, \ +#define MODISK_PERF_TYPE { \ + .name = MODISK_PERF_NAME, \ + .type = TYPE_MOD, \ + .parse_atomic = 1, \ + .dev_done_atomic = 1, \ + .exec_atomic = 1, \ + .attach = modisk_attach, \ + .detach = modisk_detach, \ + .parse = modisk_parse, \ + .dev_done = modisk_done, \ + .exec = modisk_exec, \ } #define MODISK_SMALL_TIMEOUT (3 * HZ) Modified: trunk/scst/src/dev_handlers/scst_processor.c =================================================================== --- trunk/scst/src/dev_handlers/scst_processor.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_processor.c 2008-05-20 14:17:25 UTC (rev 379) @@ -26,15 +26,15 @@ #define PROCESSOR_NAME "dev_processor" -#define PROCESSOR_TYPE { \ - name: PROCESSOR_NAME, \ - type: TYPE_PROCESSOR, \ - parse_atomic: 1, \ -/* dev_done_atomic: 1,*/ \ - attach: processor_attach, \ -/* detach: processor_detach,*/ \ - parse: processor_parse, \ -/* dev_done: processor_done*/ \ +#define PROCESSOR_TYPE { \ + .name = PROCESSOR_NAME, \ + .type = TYPE_PROCESSOR, \ + .parse_atomic = 1, \ +/* .dev_done_atomic = 1,*/ \ + .attach = processor_attach, \ +/* .detach = processor_detach,*/ \ + .parse = processor_parse, \ +/* .dev_done = processor_done*/ \ } #define PROCESSOR_RETRIES 2 Modified: trunk/scst/src/dev_handlers/scst_raid.c =================================================================== --- trunk/scst/src/dev_handlers/scst_raid.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_raid.c 2008-05-20 14:17:25 UTC (rev 379) @@ -26,15 +26,15 @@ #define RAID_NAME "dev_raid" -#define RAID_TYPE { \ - name: RAID_NAME, \ - type: TYPE_RAID, \ - parse_atomic: 1, \ -/* dev_done_atomic: 1,*/ \ - attach: raid_attach, \ -/* detach: raid_detach,*/ \ - parse: raid_parse, \ -/* dev_done: raid_done*/ \ +#define RAID_TYPE { \ + .name = RAID_NAME, \ + .type = TYPE_RAID, \ + .parse_atomic = 1, \ +/* .dev_done_atomic = 1,*/ \ + .attach = raid_attach, \ +/* .detach = raid_detach,*/ \ + .parse = raid_parse, \ +/* .dev_done = raid_done*/ \ } #define RAID_RETRIES 2 Modified: trunk/scst/src/dev_handlers/scst_tape.c =================================================================== --- trunk/scst/src/dev_handlers/scst_tape.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_tape.c 2008-05-20 14:17:25 UTC (rev 379) @@ -32,29 +32,29 @@ # define TAPE_NAME "dev_tape" # define TAPE_PERF_NAME "dev_tape_perf" -#define TAPE_TYPE { \ - name: TAPE_NAME, \ - type: TYPE_TAPE, \ - parse_atomic: 1, \ - dev_done_atomic: 1, \ - exec_atomic: 1, \ - attach: tape_attach, \ - detach: tape_detach, \ - parse: tape_parse, \ - dev_done: tape_done, \ +#define TAPE_TYPE { \ + .name = TAPE_NAME, \ + .type = TYPE_TAPE, \ + .parse_atomic = 1, \ + .dev_done_atomic = 1, \ + .exec_atomic = 1, \ + .attach = tape_attach, \ + .detach = tape_detach, \ + .parse = tape_parse, \ + .dev_done = tape_done, \ } -#define TAPE_PERF_TYPE { \ - name: TAPE_PERF_NAME, \ - type: TYPE_TAPE, \ - parse_atomic: 1, \ - dev_done_atomic: 1, \ - exec_atomic: 1, \ - attach: tape_attach, \ - detach: tape_detach, \ - parse: tape_parse, \ - dev_done: tape_done, \ - exec: tape_exec, \ +#define TAPE_PERF_TYPE { \ + .name = TAPE_PERF_NAME, \ + .type = TYPE_TAPE, \ + .parse_atomic = 1, \ + .dev_done_atomic = 1, \ + .exec_atomic = 1, \ + .attach = tape_attach, \ + .detach = tape_detach, \ + .parse = tape_parse, \ + .dev_done = tape_done, \ + .exec = tape_exec, \ } #define TAPE_RETRIES 2 Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-05-20 14:17:25 UTC (rev 379) @@ -27,10 +27,10 @@ #include "scst_dev_handler.h" #if defined(CONFIG_HIGHMEM4G) || defined(CONFIG_HIGHMEM64G) -#warning HIGHMEM kernel configurations are not supported by this module, \ +#warning "HIGHMEM kernel configurations are not supported by this module, \ because nowadays it doesn't worth the effort. Consider change \ VMSPLIT option or use 64-bit configuration instead. See README file \ - for details. + for details." #endif #define DEV_USER_MAJOR 237 @@ -2910,10 +2910,10 @@ } /* Needed only for /proc support */ -#define USR_TYPE { \ - name: DEV_USER_NAME, \ - type: -1, \ - parse: dev_usr_parse, \ +#define USR_TYPE { \ + .name = DEV_USER_NAME, \ + .type = -1, \ + .parse = dev_usr_parse, \ } static struct scst_dev_type dev_user_devtype = USR_TYPE; Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-20 14:17:25 UTC (rev 379) @@ -254,59 +254,59 @@ static int vdisk_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, struct scst_tgt_dev *tgt_dev); -#define VDISK_TYPE { \ - name: VDISK_NAME, \ - type: TYPE_DISK, \ - exec_sync: 1, \ - threads_num: -1, \ - parse_atomic: 1, \ - exec_atomic: 0, \ - dev_done_atomic: 1, \ - attach: vdisk_attach, \ - detach: vdisk_detach, \ - attach_tgt: vdisk_attach_tgt, \ - detach_tgt: vdisk_detach_tgt, \ - parse: vdisk_parse, \ - exec: vdisk_do_job, \ - read_proc: vdisk_read_proc, \ - write_proc: vdisk_write_proc, \ - task_mgmt_fn: vdisk_task_mgmt_fn, \ +#define VDISK_TYPE { \ + .name = VDISK_NAME, \ + .type = TYPE_DISK, \ + .exec_sync = 1, \ + .threads_num = -1, \ + .parse_atomic = 1, \ + .exec_atomic = 0, \ + .dev_done_atomic = 1, \ + .attach = vdisk_attach, \ + .detach = vdisk_detach, \ + .attach_tgt = vdisk_attach_tgt, \ + .detach_tgt = vdisk_detach_tgt, \ + .parse = vdisk_parse, \ + .exec = vdisk_do_job, \ + .read_proc = vdisk_read_proc, \ + .write_proc = vdisk_write_proc, \ + .task_mgmt_fn = vdisk_task_mgmt_fn, \ } -#define VDISK_BLK_TYPE { \ - name: VDISK_NAME "_blk", \ - type: TYPE_DISK, \ - threads_num: 0, \ - parse_atomic: 1, \ - exec_atomic: 0, \ - dev_done_atomic: 1, \ - no_proc: 1, \ - attach: vdisk_attach, \ - detach: vdisk_detach, \ - attach_tgt: vdisk_attach_tgt, \ - detach_tgt: vdisk_detach_tgt, \ - parse: vdisk_parse, \ - exec: vdisk_do_job, \ - task_mgmt_fn: vdisk_task_mgmt_fn, \ +#define VDISK_BLK_TYPE { \ + .name = VDISK_NAME "_blk", \ + .type = TYPE_DISK, \ + .threads_num = 0, \ + .parse_atomic = 1, \ + .exec_atomic = 0, \ + .dev_done_atomic = 1, \ + .no_proc = 1, \ + .attach = vdisk_attach, \ + .detach = vdisk_detach, \ + .attach_tgt = vdisk_attach_tgt, \ + .detach_tgt = vdisk_detach_tgt, \ + .parse = vdisk_parse, \ + .exec = vdisk_do_job, \ + .task_mgmt_fn = vdisk_task_mgmt_fn, \ } -#define VCDROM_TYPE { \ - name: VCDROM_NAME, \ - type: TYPE_ROM, \ - exec_sync: 1, \ - threads_num: -1, \ - parse_atomic: 1, \ - exec_atomic: 0, \ - dev_done_atomic: 1, \ - attach: vdisk_attach, \ - detach: vdisk_detach, \ - attach_tgt: vdisk_attach_tgt, \ - detach_tgt: vdisk_detach_tgt, \ - parse: vcdrom_parse, \ - exec: vcdrom_exec, \ - read_proc: vcdrom_read_proc, \ - write_proc: vcdrom_write_proc, \ - task_mgmt_fn: vdisk_task_mgmt_fn, \ +#define VCDROM_TYPE { \ + .name = VCDROM_NAME, \ + .type = TYPE_ROM, \ + .exec_sync = 1, \ + .threads_num = -1, \ + .parse_atomic = 1, \ + .exec_atomic = 0, \ + .dev_done_atomic = 1, \ + .attach = vdisk_attach, \ + .detach = vdisk_detach, \ + .attach_tgt = vdisk_attach_tgt, \ + .detach_tgt = vdisk_detach_tgt, \ + .parse = vcdrom_parse, \ + .exec = vcdrom_exec, \ + .read_proc = vcdrom_read_proc, \ + .write_proc = vcdrom_write_proc, \ + .task_mgmt_fn = vdisk_task_mgmt_fn, \ } static DEFINE_MUTEX(scst_vdisk_mutex); Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-05-20 09:32:14 UTC (rev 378) +++ trunk/scst/src/scst_main.c 2008-05-20 14:17:25 UTC (rev 379) @@ -149,7 +149,7 @@ struct scst_dev_type scst_null_devtype = { - name: "none", + .name = "none", }; int __scst_register_target_template(struct scst_tgt_template *vtt, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-05-27 14:31:38
|
Revision: 400 http://scst.svn.sourceforge.net/scst/?rev=400&view=rev Author: vlnb Date: 2008-05-27 07:31:31 -0700 (Tue, 27 May 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: The patch below fixes the following checkpatch warning: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable This patch has been tested as follows: - Verified that the output of the following command did not change due to the patch below: find -name '*.[ch]'|xargs grep -h -w EXPORT_SYMBOL | sort - Checked that make -s clean && make -s iscsi scst && make -s -C srpt still works. - Checked that the patch generated by generate-kernel-patch still applies cleanly to the 2.6.25.4 kernel, and that the patched kernel tree still compiles, installs and boots fine, and that the iscsi-scst, ib_srpt, scst_disk and scst_vdisk modules still load. Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/scst/src/scst_debug.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_debug.c =================================================================== --- trunk/scst/src/scst_debug.c 2008-05-27 14:28:37 UTC (rev 399) +++ trunk/scst/src/scst_debug.c 2008-05-27 14:31:31 UTC (rev 400) @@ -63,6 +63,7 @@ return i; } +EXPORT_SYMBOL(debug_print_prefix); void debug_print_buffer(const char *log_level, const void *data, int len) { @@ -117,7 +118,6 @@ spin_unlock_irqrestore(&trace_buf_lock, flags); return; } +EXPORT_SYMBOL(debug_print_buffer); -EXPORT_SYMBOL(debug_print_prefix); -EXPORT_SYMBOL(debug_print_buffer); #endif /* DEBUG || TRACING */ Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-05-27 14:28:37 UTC (rev 399) +++ trunk/scst/src/scst_lib.c 2008-05-27 14:31:31 UTC (rev 400) @@ -64,6 +64,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_alloc_sense); int scst_alloc_set_sense(struct scst_cmd *cmd, int atomic, const uint8_t *sense, unsigned int len) @@ -85,6 +86,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_alloc_set_sense); void scst_set_cmd_error_status(struct scst_cmd *cmd, int status) { @@ -102,6 +104,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_set_cmd_error_status); void scst_set_cmd_error(struct scst_cmd *cmd, int key, int asc, int ascq) { @@ -125,6 +128,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_set_cmd_error); void scst_set_sense(uint8_t *buffer, int len, int key, int asc, int ascq) @@ -138,6 +142,7 @@ TRACE_BUFFER("Sense set", buffer, len); return; } +EXPORT_SYMBOL(scst_set_sense); void scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, unsigned int len) @@ -150,6 +155,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_set_cmd_error_sense); void scst_set_busy(struct scst_cmd *cmd) { @@ -174,6 +180,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_set_busy); void scst_set_resp_data_len(struct scst_cmd *cmd, int resp_data_len) { @@ -214,6 +221,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_set_resp_data_len); /* Called under scst_mutex and suspended activity */ int scst_alloc_device(int gfp_mask, struct scst_device **out_dev) @@ -1275,11 +1283,13 @@ { __scst_cmd_get(cmd); } +EXPORT_SYMBOL(scst_cmd_get); void scst_cmd_put(struct scst_cmd *cmd) { __scst_cmd_put(cmd); } +EXPORT_SYMBOL(scst_cmd_put); struct scst_cmd *scst_alloc_cmd(int gfp_mask) { @@ -1837,6 +1847,7 @@ TRACE_EXIT(); return res; } +EXPORT_SYMBOL(scst_get_cdb_info); /* * Routine to extract a lun number from an 8-byte LUN structure @@ -1954,6 +1965,7 @@ TRACE_EXIT_RES(block_shift); return block_shift; } +EXPORT_SYMBOL(scst_calc_block_shift); int scst_sbc_generic_parse(struct scst_cmd *cmd, int (*get_block_shift)(struct scst_cmd *cmd)) @@ -2008,6 +2020,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_sbc_generic_parse); int scst_cdrom_generic_parse(struct scst_cmd *cmd, int (*get_block_shift)(struct scst_cmd *cmd)) @@ -2052,6 +2065,7 @@ TRACE_EXIT(); return res; } +EXPORT_SYMBOL(scst_cdrom_generic_parse); int scst_modisk_generic_parse(struct scst_cmd *cmd, int (*get_block_shift)(struct scst_cmd *cmd)) @@ -2096,6 +2110,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_modisk_generic_parse); int scst_tape_generic_parse(struct scst_cmd *cmd, int (*get_block_size)(struct scst_cmd *cmd)) @@ -2133,6 +2148,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_tape_generic_parse); static int scst_null_parse(struct scst_cmd *cmd) { @@ -2166,18 +2182,21 @@ { return scst_null_parse(cmd); } +EXPORT_SYMBOL(scst_changer_generic_parse); int scst_processor_generic_parse(struct scst_cmd *cmd, int (*nothing)(struct scst_cmd *cmd)) { return scst_null_parse(cmd); } +EXPORT_SYMBOL(scst_processor_generic_parse); int scst_raid_generic_parse(struct scst_cmd *cmd, int (*nothing)(struct scst_cmd *cmd)) { return scst_null_parse(cmd); } +EXPORT_SYMBOL(scst_raid_generic_parse); int scst_block_generic_dev_done(struct scst_cmd *cmd, void (*set_block_shift)(struct scst_cmd *cmd, int block_shift)) @@ -2234,6 +2253,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_block_generic_dev_done); int scst_tape_generic_dev_done(struct scst_cmd *cmd, void (*set_block_size)(struct scst_cmd *cmd, int block_shift)) @@ -2298,6 +2318,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_tape_generic_dev_done); static void scst_check_internal_sense(struct scst_device *dev, int result, uint8_t *sense, int sense_len) @@ -2427,6 +2448,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_obtain_device_parameters); /* Called under dev_lock and BH off */ void scst_process_reset(struct scst_device *dev, @@ -2766,6 +2788,7 @@ list_add_tail(&data->thr_data_list_entry, &tgt_dev->thr_data_list); spin_unlock(&tgt_dev->thr_data_lock); } +EXPORT_SYMBOL(scst_add_thr_data); void scst_del_all_thr_data(struct scst_tgt_dev *tgt_dev) { @@ -2782,6 +2805,7 @@ spin_unlock(&tgt_dev->thr_data_lock); return; } +EXPORT_SYMBOL(scst_del_all_thr_data); void scst_dev_del_all_thr_data(struct scst_device *dev) { @@ -2801,6 +2825,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_dev_del_all_thr_data); struct scst_thr_data_hdr *scst_find_thr_data(struct scst_tgt_dev *tgt_dev) { @@ -2817,6 +2842,7 @@ spin_unlock(&tgt_dev->thr_data_lock); return res; } +EXPORT_SYMBOL(scst_find_thr_data); /* dev_lock supposed to be held and BH disabled */ void __scst_block_dev(struct scst_device *dev) @@ -3181,6 +3207,7 @@ spin_unlock_irqrestore(&lock, flags); return rv; } +EXPORT_SYMBOL(scst_random); #endif #ifdef DEBUG_TM Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-05-27 14:28:37 UTC (rev 399) +++ trunk/scst/src/scst_main.c 2008-05-27 14:31:31 UTC (rev 400) @@ -251,6 +251,7 @@ PRINT_ERROR("Failed to register target template %s", vtt->name); goto out; } +EXPORT_SYMBOL(__scst_register_target_template); void scst_unregister_target_template(struct scst_tgt_template *vtt) { @@ -292,6 +293,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_unregister_target_template); struct scst_tgt *scst_register(struct scst_tgt_template *vtt, const char *target_name) @@ -365,6 +367,7 @@ target_name, vtt->name); goto out; } +EXPORT_SYMBOL(scst_register); static inline int test_sess_list(struct scst_tgt *tgt) { @@ -419,6 +422,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_unregister); void scst_suspend_activity(void) { @@ -454,6 +458,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_suspend_activity); void scst_resume_activity(void) { @@ -494,6 +499,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_resume_activity); static int scst_register_device(struct scsi_device *scsidp) { @@ -707,6 +713,7 @@ scst_free_device(dev); goto out_up; } +EXPORT_SYMBOL(scst_register_virtual_device); void scst_unregister_virtual_device(int id) { @@ -752,6 +759,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_unregister_virtual_device); int __scst_register_dev_driver(struct scst_dev_type *dev_type, const char *version) @@ -839,6 +847,7 @@ dev_type->name, dev_type->type); goto out; } +EXPORT_SYMBOL(__scst_register_dev_driver); void scst_unregister_dev_driver(struct scst_dev_type *dev_type) { @@ -889,6 +898,7 @@ scst_resume_activity(); goto out; } +EXPORT_SYMBOL(scst_unregister_dev_driver); int __scst_register_virtual_dev_driver(struct scst_dev_type *dev_type, const char *version) @@ -932,6 +942,7 @@ dev_type->name); goto out; } +EXPORT_SYMBOL(__scst_register_virtual_dev_driver); void scst_unregister_virtual_dev_driver(struct scst_dev_type *dev_type) { @@ -945,6 +956,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_unregister_virtual_dev_driver); /* Called under scst_mutex */ int scst_add_dev_threads(struct scst_device *dev, int num) @@ -1268,6 +1280,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_add_cmd_threads); void scst_del_cmd_threads(int num) { @@ -1280,6 +1293,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_del_cmd_threads); static void scst_stop_all_threads(void) { @@ -1347,11 +1361,13 @@ { __scst_get(0); } +EXPORT_SYMBOL(scst_get); void scst_put(void) { __scst_put(); } +EXPORT_SYMBOL(scst_put); #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) static int scst_add(struct class_device *cdev) @@ -1746,117 +1762,7 @@ return; } -/* - * Device Handler Side (i.e. scst_vdisk) - */ -EXPORT_SYMBOL(__scst_register_dev_driver); -EXPORT_SYMBOL(scst_unregister_dev_driver); -EXPORT_SYMBOL(scst_register); -EXPORT_SYMBOL(scst_unregister); -EXPORT_SYMBOL(scst_register_virtual_device); -EXPORT_SYMBOL(scst_unregister_virtual_device); -EXPORT_SYMBOL(__scst_register_virtual_dev_driver); -EXPORT_SYMBOL(scst_unregister_virtual_dev_driver); - -EXPORT_SYMBOL(scst_set_busy); -EXPORT_SYMBOL(scst_set_cmd_error_status); -EXPORT_SYMBOL(scst_set_cmd_error); -EXPORT_SYMBOL(scst_set_resp_data_len); -EXPORT_SYMBOL(scst_alloc_sense); -EXPORT_SYMBOL(scst_alloc_set_sense); -EXPORT_SYMBOL(scst_set_sense); -EXPORT_SYMBOL(scst_set_cmd_error_sense); - -EXPORT_SYMBOL(scst_process_active_cmd); - -/* - * Target Driver Side (i.e. HBA) - */ -EXPORT_SYMBOL(scst_register_session); -EXPORT_SYMBOL(scst_unregister_session_ex); - -EXPORT_SYMBOL(__scst_register_target_template); -EXPORT_SYMBOL(scst_unregister_target_template); - -EXPORT_SYMBOL(scst_cmd_init_done); -EXPORT_SYMBOL(scst_tgt_cmd_done); -EXPORT_SYMBOL(scst_restart_cmd); -EXPORT_SYMBOL(scst_rx_cmd); -EXPORT_SYMBOL(scst_rx_data); -EXPORT_SYMBOL(scst_rx_mgmt_fn); - -EXPORT_SYMBOL(scst_find_cmd); -EXPORT_SYMBOL(scst_find_cmd_by_tag); - -/* - * Global Commands - */ -EXPORT_SYMBOL(scst_suspend_activity); -EXPORT_SYMBOL(scst_resume_activity); - -EXPORT_SYMBOL(scst_add_cmd_threads); -EXPORT_SYMBOL(scst_del_cmd_threads); - -#if defined(DEBUG) || defined(TRACING) -EXPORT_SYMBOL(scst_proc_log_entry_read); -EXPORT_SYMBOL(scst_proc_log_entry_write); -#endif - -EXPORT_SYMBOL(scst_create_proc_entry); -EXPORT_SYMBOL(scst_single_seq_open); - -EXPORT_SYMBOL(scst_get); -EXPORT_SYMBOL(scst_put); - -EXPORT_SYMBOL(scst_cmd_get); -EXPORT_SYMBOL(scst_cmd_put); - -EXPORT_SYMBOL(scst_alloc); -EXPORT_SYMBOL(scst_free); - -EXPORT_SYMBOL(scst_check_local_events); - -/* Tgt_dev's threads local storage */ -EXPORT_SYMBOL(scst_add_thr_data); -EXPORT_SYMBOL(scst_del_all_thr_data); -EXPORT_SYMBOL(scst_dev_del_all_thr_data); -EXPORT_SYMBOL(scst_find_thr_data); - -/* SGV pool routines */ -EXPORT_SYMBOL(sgv_pool_create); -EXPORT_SYMBOL(sgv_pool_destroy); -EXPORT_SYMBOL(sgv_pool_set_allocator); -EXPORT_SYMBOL(sgv_pool_alloc); -EXPORT_SYMBOL(sgv_pool_free); -EXPORT_SYMBOL(sgv_get_priv); - -/* Generic parse() routines */ -EXPORT_SYMBOL(scst_calc_block_shift); -EXPORT_SYMBOL(scst_sbc_generic_parse); -EXPORT_SYMBOL(scst_cdrom_generic_parse); -EXPORT_SYMBOL(scst_modisk_generic_parse); -EXPORT_SYMBOL(scst_tape_generic_parse); -EXPORT_SYMBOL(scst_changer_generic_parse); -EXPORT_SYMBOL(scst_processor_generic_parse); -EXPORT_SYMBOL(scst_raid_generic_parse); - -/* Generic dev_done() routines */ -EXPORT_SYMBOL(scst_block_generic_dev_done); -EXPORT_SYMBOL(scst_tape_generic_dev_done); - -/* - * Other Commands - */ -EXPORT_SYMBOL(scst_get_cdb_info); -EXPORT_SYMBOL(scst_cmd_get_tgt_priv_lock); -EXPORT_SYMBOL(scst_cmd_set_tgt_priv_lock); -EXPORT_SYMBOL(scst_obtain_device_parameters); - -#ifdef DEBUG -EXPORT_SYMBOL(scst_random); -#endif - module_init(init_scst); module_exit(exit_scst); Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2008-05-27 14:28:37 UTC (rev 399) +++ trunk/scst/src/scst_mem.c 2008-05-27 14:31:31 UTC (rev 400) @@ -718,11 +718,13 @@ TRACE_MEM("%s", "Allocation failed"); goto out; } +EXPORT_SYMBOL(sgv_pool_alloc); void *sgv_get_priv(struct sgv_pool_obj *sgv) { return sgv->allocator_priv; } +EXPORT_SYMBOL(sgv_get_priv); void sgv_pool_free(struct sgv_pool_obj *sgv) { @@ -747,6 +749,7 @@ atomic_sub(pages, &sgv_pools_mgr.mgr.thr.active_pages_total); return; } +EXPORT_SYMBOL(sgv_pool_free); struct scatterlist *scst_alloc(int size, unsigned long gfp_mask, int *count) { @@ -794,6 +797,7 @@ res = NULL; goto out; } +EXPORT_SYMBOL(scst_alloc); void scst_free(struct scatterlist *sg, int count) { @@ -805,6 +809,7 @@ kfree(sg); return; } +EXPORT_SYMBOL(scst_free); static void sgv_pool_cached_init(struct sgv_pool *pool) { @@ -977,6 +982,7 @@ pool->alloc_fns.free_pages_fn = free_pages_fn; return; } +EXPORT_SYMBOL(sgv_pool_set_allocator); struct sgv_pool *sgv_pool_create(const char *name, int clustered) { @@ -1004,6 +1010,7 @@ pool = NULL; goto out; } +EXPORT_SYMBOL(sgv_pool_create); void sgv_pool_destroy(struct sgv_pool *pool) { @@ -1014,6 +1021,7 @@ TRACE_EXIT(); } +EXPORT_SYMBOL(sgv_pool_destroy); static int sgv_pool_cached_shrinker(int nr, gfp_t gfpm) { Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2008-05-27 14:28:37 UTC (rev 399) +++ trunk/scst/src/scst_proc.c 2008-05-27 14:31:31 UTC (rev 400) @@ -351,6 +351,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_proc_log_entry_write); static ssize_t scst_proc_scsi_tgt_gen_write_log(struct file *file, const char __user *buf, size_t length, loff_t *off) @@ -1964,6 +1965,7 @@ TRACE_EXIT_RES(res); return res; } +EXPORT_SYMBOL(scst_proc_log_entry_read); static int log_info_show(struct seq_file *seq, void *v) { @@ -2125,6 +2127,7 @@ TRACE_EXIT(); return p; } +EXPORT_SYMBOL(scst_create_proc_entry); int scst_single_seq_open(struct inode *inode, struct file *file) { @@ -2137,3 +2140,4 @@ #endif return single_open(file, pdata->show, PDE(inode)->data); } +EXPORT_SYMBOL(scst_single_seq_open); Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-27 14:28:37 UTC (rev 399) +++ trunk/scst/src/scst_targ.c 2008-05-27 14:31:31 UTC (rev 400) @@ -97,6 +97,7 @@ TRACE_EXIT(); return cmd; } +EXPORT_SYMBOL(scst_rx_cmd); static int scst_init_cmd(struct scst_cmd *cmd, int context) { @@ -312,6 +313,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_cmd_init_done); static int scst_pre_parse(struct scst_cmd *cmd) { @@ -786,6 +788,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_restart_cmd); /* No locks */ static int scst_queue_retry_cmd(struct scst_cmd *cmd, int finished_cmds) @@ -1012,6 +1015,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_rx_data); static int scst_tgt_pre_exec(struct scst_cmd *cmd) { @@ -1592,6 +1596,7 @@ res = -1; goto out; } +EXPORT_SYMBOL(scst_check_local_events); /* * The result of cmd execution, if any, should be reported @@ -2653,6 +2658,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_tgt_cmd_done); static int scst_finish_cmd(struct scst_cmd *cmd) { @@ -3209,6 +3215,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_process_active_cmd); /* Called under cmd_list_lock and IRQs disabled */ static void scst_do_job_active(struct list_head *cmd_list, @@ -4756,6 +4763,7 @@ mcmd = NULL; goto out; } +EXPORT_SYMBOL(scst_rx_mgmt_fn); /* scst_mutex supposed to be held */ static struct scst_acg *scst_find_acg(const char *initiator_name) @@ -4937,6 +4945,7 @@ sess = NULL; goto out; } +EXPORT_SYMBOL(scst_register_session); /* * Must not be called in parallel with scst_rx_cmd() or @@ -5005,6 +5014,7 @@ TRACE_EXIT(); return; } +EXPORT_SYMBOL(scst_unregister_session_ex); static void scst_pre_unreg_sess(struct scst_session *sess) { @@ -5196,6 +5206,7 @@ TRACE_EXIT(); return cmd; } +EXPORT_SYMBOL(scst_find_cmd); struct scst_cmd *scst_find_cmd_by_tag(struct scst_session *sess, uint64_t tag) @@ -5207,6 +5218,7 @@ spin_unlock_irqrestore(&sess->sess_list_lock, flags); return cmd; } +EXPORT_SYMBOL(scst_find_cmd_by_tag); void *scst_cmd_get_tgt_priv_lock(struct scst_cmd *cmd) { @@ -5217,6 +5229,7 @@ spin_unlock_irqrestore(&scst_main_lock, flags); return res; } +EXPORT_SYMBOL(scst_cmd_get_tgt_priv_lock); void scst_cmd_set_tgt_priv_lock(struct scst_cmd *cmd, void *val) { @@ -5225,3 +5238,4 @@ cmd->tgt_priv = val; spin_unlock_irqrestore(&scst_main_lock, flags); } +EXPORT_SYMBOL(scst_cmd_set_tgt_priv_lock); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-06-12 18:37:34
|
Revision: 410 http://scst.svn.sourceforge.net/scst/?rev=410&view=rev Author: vlnb Date: 2008-06-12 11:37:31 -0700 (Thu, 12 Jun 2008) Log Message: ----------- Fixes broken REQUEST SENSE Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-06-12 14:59:48 UTC (rev 409) +++ trunk/scst/src/scst_lib.c 2008-06-12 18:37:31 UTC (rev 410) @@ -906,7 +906,7 @@ res->cmd_lists = orig_cmd->cmd_lists; res->sess = orig_cmd->sess; - res->state = SCST_CMD_STATE_DEV_PARSE; + res->state = SCST_CMD_STATE_PRE_PARSE; res->atomic = scst_cmd_atomic(orig_cmd); res->internal = 1; res->tgtt = orig_cmd->tgtt; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-06-12 14:59:48 UTC (rev 409) +++ trunk/scst/src/scst_targ.c 2008-06-12 18:37:31 UTC (rev 410) @@ -2177,15 +2177,18 @@ return res; } -static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) +static int scst_done_cmd_check(struct scst_cmd **pcmd, int *pres) { int res = 0, rc; + struct scst_cmd *cmd = *pcmd; TRACE_ENTRY(); if (unlikely(cmd->cdb[0] == REQUEST_SENSE)) { - if (cmd->internal) + if (cmd->internal) { cmd = scst_complete_request_sense(cmd); + *pcmd = cmd; + } } else if (unlikely(scst_check_auto_sense(cmd))) { PRINT_INFO("Command finished with CHECK CONDITION, but " "without sense data (opcode 0x%x), issuing " @@ -2323,7 +2326,7 @@ TRACE_ENTRY(); - rc = scst_done_cmd_check(cmd, &res); + rc = scst_done_cmd_check(&cmd, &res); if (rc) goto out; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-06-13 10:31:55
|
Revision: 412 http://scst.svn.sourceforge.net/scst/?rev=412&view=rev Author: vlnb Date: 2008-06-13 03:31:50 -0700 (Fri, 13 Jun 2008) Log Message: ----------- - Complete the fix for broken REQUEST SENSE - Cleanup: cleanup_lock shouldn't be IRQ Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-06-12 18:55:13 UTC (rev 411) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-06-13 10:31:50 UTC (rev 412) @@ -2716,9 +2716,9 @@ down_write(&dev->dev_rwsem); - spin_lock_irq(&cleanup_lock); + spin_lock(&cleanup_lock); list_add_tail(&dev->cleanup_list_entry, &cleanup_list); - spin_unlock_irq(&cleanup_lock); + spin_unlock(&cleanup_lock); wake_up(&cleanup_list_waitQ); wake_up(&dev->cmd_lists.cmd_list_waitQ); @@ -2823,7 +2823,7 @@ current->flags |= PF_NOFREEZE; - spin_lock_irq(&cleanup_lock); + spin_lock(&cleanup_lock); while (!kthread_should_stop()) { wait_queue_t wait; init_waitqueue_entry(&wait, current); @@ -2834,9 +2834,9 @@ set_current_state(TASK_INTERRUPTIBLE); if (test_cleanup_list()) break; - spin_unlock_irq(&cleanup_lock); + spin_unlock(&cleanup_lock); schedule(); - spin_lock_irq(&cleanup_lock); + spin_lock(&cleanup_lock); } set_current_state(TASK_RUNNING); remove_wait_queue(&cleanup_list_waitQ, &wait); @@ -2859,9 +2859,9 @@ typeof(*dev), cleanup_list_entry); list_del(&dev->cleanup_list_entry); - spin_unlock_irq(&cleanup_lock); + spin_unlock(&cleanup_lock); rc = dev_user_process_cleanup(dev); - spin_lock_irq(&cleanup_lock); + spin_lock(&cleanup_lock); if (rc != 0) list_add_tail(&dev->cleanup_list_entry, @@ -2871,9 +2871,9 @@ if (list_empty(&cl_devs)) break; - spin_unlock_irq(&cleanup_lock); + spin_unlock(&cleanup_lock); msleep(100); - spin_lock_irq(&cleanup_lock); + spin_lock(&cleanup_lock); while (!list_empty(&cl_devs)) { dev = list_entry(cl_devs.next, typeof(*dev), @@ -2883,7 +2883,7 @@ } } } - spin_unlock_irq(&cleanup_lock); + spin_unlock(&cleanup_lock); /* * If kthread_should_stop() is true, we are guaranteed to be Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-06-12 18:55:13 UTC (rev 411) +++ trunk/scst/src/scst_targ.c 2008-06-13 10:31:50 UTC (rev 412) @@ -2319,17 +2319,17 @@ return res; } -static int scst_pre_dev_done(struct scst_cmd *cmd) +static int scst_pre_dev_done(struct scst_cmd **pcmd) { int res = SCST_CMD_STATE_RES_CONT_SAME, rc; TRACE_ENTRY(); - rc = scst_done_cmd_check(&cmd, &res); + rc = scst_done_cmd_check(pcmd, &res); if (rc) goto out; - cmd->state = SCST_CMD_STATE_DEV_DONE; + (*pcmd)->state = SCST_CMD_STATE_DEV_DONE; out: TRACE_EXIT_HRES(res); @@ -3153,7 +3153,7 @@ break; case SCST_CMD_STATE_PRE_DEV_DONE: - res = scst_pre_dev_done(cmd); + res = scst_pre_dev_done(&cmd); EXTRACHECKS_BUG_ON(res == SCST_CMD_STATE_RES_NEED_THREAD); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-06-23 18:08:09
|
Revision: 420 http://scst.svn.sourceforge.net/scst/?rev=420&view=rev Author: vlnb Date: 2008-06-23 09:32:51 -0700 (Mon, 23 Jun 2008) Log Message: ----------- - Fixes incorrect allocation length 0 by scst_user module - Fixes missed case of "allocation length 0 for READ6/WRITE6 means 256". Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/scst_cdbprobe.h trunk/scst/src/scst_lib.c Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2008-06-19 17:54:25 UTC (rev 419) +++ trunk/scst/src/dev_handlers/scst_user.c 2008-06-23 16:32:51 UTC (rev 420) @@ -490,6 +490,12 @@ TRACE_ENTRY(); + /* User space can return from PARSE bufflen 0 and direction non-NONE */ + if (unlikely(bufflen == 0)) { + cmd->data_direction = SCST_DATA_NONE; + goto out; + } + gfp_mask = __GFP_NOWARN; gfp_mask |= (scst_cmd_atomic(cmd) ? GFP_ATOMIC : GFP_KERNEL); Modified: trunk/scst/src/scst_cdbprobe.h =================================================================== --- trunk/scst/src/scst_cdbprobe.h 2008-06-19 17:54:25 UTC (rev 419) +++ trunk/scst/src/scst_cdbprobe.h 2008-06-23 16:32:51 UTC (rev 420) @@ -23,6 +23,7 @@ /* 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); @@ -131,7 +132,7 @@ {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)", @@ -141,7 +142,7 @@ {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", Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-06-19 17:54:25 UTC (rev 419) +++ trunk/scst/src/scst_lib.c 2008-06-23 16:32:51 UTC (rev 420) @@ -1657,6 +1657,7 @@ 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], @@ -1811,6 +1812,14 @@ 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; @@ -1907,6 +1916,15 @@ 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(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |