diff options
Diffstat (limited to 'include/scsi/scsi_cmnd.h')
| -rw-r--r-- | include/scsi/scsi_cmnd.h | 33 | 
1 files changed, 28 insertions, 5 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index de5f5d8f1f8..e0ae7109814 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -7,6 +7,7 @@  #include <linux/types.h>  #include <linux/timer.h>  #include <linux/scatterlist.h> +#include <scsi/scsi_device.h>  struct Scsi_Host;  struct scsi_device; @@ -55,6 +56,7 @@ struct scsi_cmnd {  	struct scsi_device *device;  	struct list_head list;  /* scsi_cmnd participates in queue lists */  	struct list_head eh_entry; /* entry for the host eh_cmd_q */ +	struct delayed_work abort_work;  	int eh_eflags;		/* Used by error handlr */  	/* @@ -132,6 +134,15 @@ struct scsi_cmnd {  	unsigned char tag;	/* SCSI-II queued command tag */  }; +/* + * Return the driver private allocation behind the command. + * Only works if cmd_size is set in the host template. + */ +static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd) +{ +	return cmd + 1; +} +  /* make sure not to use it with REQ_TYPE_BLOCK_PC commands */  static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)  { @@ -141,8 +152,7 @@ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)  extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);  extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);  extern void scsi_put_command(struct scsi_cmnd *); -extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *, -			       struct device *); +extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *);  extern void scsi_finish_command(struct scsi_cmnd *cmd);  extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count, @@ -155,9 +165,6 @@ extern void scsi_release_buffers(struct scsi_cmnd *cmd);  extern int scsi_dma_map(struct scsi_cmnd *cmd);  extern void scsi_dma_unmap(struct scsi_cmnd *cmd); -struct scsi_cmnd *scsi_allocate_command(gfp_t gfp_mask); -void scsi_free_command(gfp_t gfp_mask, struct scsi_cmnd *cmd); -  static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd)  {  	return cmd->sdb.table.nents; @@ -309,4 +316,20 @@ static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)  	cmd->result = (cmd->result & 0x00ffffff) | (status << 24);  } +static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) +{ +	unsigned int xfer_len = scsi_out(scmd)->length; +	unsigned int prot_op = scsi_get_prot_op(scmd); +	unsigned int sector_size = scmd->device->sector_size; + +	switch (prot_op) { +	case SCSI_PROT_NORMAL: +	case SCSI_PROT_WRITE_STRIP: +	case SCSI_PROT_READ_INSERT: +		return xfer_len; +	} + +	return xfer_len + (xfer_len >> ilog2(sector_size)) * 8; +} +  #endif /* _SCSI_SCSI_CMND_H */  | 
