[stgt] [PATCH] added CDB_CONTROL macro to get control field from CDB - needed because control field is not the last byte in VARLEN CDBs

Boaz Harrosh bharrosh at panasas.com
Tue Jun 5 12:15:52 CEST 2012


On 06/05/2012 12:36 AM, john.chandy at uconn.edu wrote:

> From: John A. Chandy <john.chandy at uconn.edu>
> 


Thanks John I will carry this in the OSD tree. But
could you also send it to the stgt-ml for upstream.

And please put the description in the first mail,
as the commit text of this patch, and also add
a Signed-off-by:

(When you "git commit" a patch you need to put an empty line
 between the commit-title (The first line, and the commit-text.
 When sending the email the commit-title becomes the subject line
 and the the commit-text becomes the body of the mail separated
 by the "---" below)

Thanks
Boaz

> ---
>  usr/scsi.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/usr/scsi.c b/usr/scsi.c
> index 4ec81d1..3d46ac1 100644
> --- a/usr/scsi.c
> +++ b/usr/scsi.c
> @@ -43,6 +43,8 @@ static unsigned char scsi_command_size[8] = {6, 10, 10, 12, 16, 12, 10, 10};
>  #define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7]
>  #define CDB_SIZE(cmd) (((((cmd)->scb[0] >> 5) & 7) < 6) ? \
>  				COMMAND_SIZE((cmd)->scb[0]) : (cmd)->scb_len)
> +#define CDB_CONTROL(cmd) (((cmd)->scb[0] == 0x7f) ? (cmd)->scb[1] \
> +			  : (cmd)->scb[CDB_SIZE((cmd))-1])
>  
>  int get_scsi_command_size(unsigned char op)
>  {
> @@ -189,7 +191,7 @@ int scsi_cmd_perform(int host_no, struct scsi_cmd *cmd)
>  	unsigned char op = cmd->scb[0];
>  	struct it_nexus_lu_info *itn_lu;
>  
> -	if (cmd->scb[CDB_SIZE(cmd) - 1] & ((1U << 0) | (1U << 2))) {
> +	if (CDB_CONTROL(cmd) & ((1U << 0) | (1U << 2))) {
>  		/*
>  		 * We don't support a linked command. SAM-3 say that
>  		 * it's optional. It's obsolete in SAM-4.


--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list