On Sun, 20 Jul 2008 20:50:18 +0200
Albert Pauw <[EMAIL PROTECTED]> wrote:

> From 38ac36d4c2f88cdd961ec6828134fd3779a56ec5 Mon Sep 17 00:00:00 2001
> From: Albert Pauw <[EMAIL PROTECTED]>
> Date: Sun, 20 Jul 2008 08:00:06 +0200
> Subject: [PATCH] ccording to SSC-2 Rev 8 the Read Block Limits return data is 
> made up of
>  6 bytes, index 0-5:
> 
> 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 <[EMAIL PROTECTED]>
> ---
>  usr/ssc.c |   13 +++++++------
>  1 files changed, 7 insertions(+), 6 deletions(-)

Thanks, applied with some modifications.


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

I replaced 0x0ff with 0xff.


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

I removed this line.
_______________________________________________
Stgt-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/stgt-devel

Reply via email to