[PATCH] ccording to SSC-2 Rev 8 the Read Block Limits return data is made up of 6 bytes, index 0-5:

Albert Pauw albert.pauw
Sun Jul 20 08:00:06 CEST 2008


Byte 0 contains granularity (bits 0-4)
Byte 1-3 contain  Maximum Block Length Limit (MSB first)
Byte 4-5 contain Minimum Block Length Limit (MSB first)

Since all bytes are zeroed first, Byte 1 is zero.

I also added a defined value for the granularity, as defined by the
Read Block Limits command, and calculate the blk_len out of it.
Now you only need to change the GRANULARITY parameter.

Signed-off-by: Albert Pauw <albert.pauw at gmail.com>
---
 usr/ssc.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/usr/ssc.c b/usr/ssc.c
index cd6623a..3c57b71 100644
--- a/usr/ssc.c
+++ b/usr/ssc.c
@@ -35,6 +35,7 @@
 #include "tgtadm_error.h"
 
 #define BLK_SHIFT	9
+#define GRANULARITY	9
 
 
 static int ssc_rw(int host_no, struct scsi_cmd *cmd)
@@ -73,16 +74,17 @@ static int ssc_read_block_limit(int host_no, struct scsi_cmd *cmd)
 {
 	uint8_t *data;
 	uint8_t buf[256];
-	uint16_t blk_len = 0x200;
+	uint16_t blk_len = 1 << GRANULARITY;
 
 	memset(buf, 0, sizeof(buf));
 	data = buf;
 
-	data[0] = 9;
-	data[2] = blk_len >> 8;
+	data[0] = GRANULARITY;
+	data[1] = (blk_len >> 16) &0x0ff;
+	data[2] = (blk_len >> 8) &0x0ff;
 	data[3] = blk_len & 0x0ff;
-	data[5] = blk_len >> 8;
-	data[6] = blk_len & 0x0ff;
+	data[4] = (blk_len >> 8) &0x0ff;
+	data[5] = blk_len & 0x0ff;
 
 	memcpy(scsi_get_in_buffer(cmd), data, 6);
 	eprintf("In ssc_read_block_limit \n");
@@ -102,7 +104,6 @@ static int ssc_lu_init(struct scsi_lu *lu)
 	lu->attrs.version_desc[0] = 0x0200; /* SSC no version claimed */
 	lu->attrs.version_desc[1] = 0x0960; /* iSCSI */
 	lu->attrs.version_desc[2] = 0x0300; /* SPC-3 */
-	lu->attrs.removable = 1;
 
 	data = lu->mode_block_descriptor;
 	size = lu->size >> BLK_SHIFT;
-- 
1.5.5.1


--------------060303020504010608010207--



More information about the stgt mailing list