aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_cmnd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/scsi_cmnd.h')
-rw-r--r--include/scsi/scsi_cmnd.h36
1 files changed, 22 insertions, 14 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 09d44f91dbdb..c6478bb6f963 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -11,6 +11,11 @@ struct request;
11struct Scsi_Host; 11struct Scsi_Host;
12struct scsi_device; 12struct scsi_device;
13 13
14struct scsi_data_buffer {
15 struct sg_table table;
16 unsigned length;
17 int resid;
18};
14 19
15/* embedded in scsi_cmnd */ 20/* embedded in scsi_cmnd */
16struct scsi_pointer { 21struct scsi_pointer {
@@ -61,15 +66,11 @@ struct scsi_cmnd {
61 /* These elements define the operation we are about to perform */ 66 /* These elements define the operation we are about to perform */
62#define MAX_COMMAND_SIZE 16 67#define MAX_COMMAND_SIZE 16
63 unsigned char cmnd[MAX_COMMAND_SIZE]; 68 unsigned char cmnd[MAX_COMMAND_SIZE];
64 unsigned request_bufflen; /* Actual request size */
65 69
66 struct timer_list eh_timeout; /* Used to time out the command. */ 70 struct timer_list eh_timeout; /* Used to time out the command. */
67 void *request_buffer; /* Actual requested buffer */
68 71
69 /* These elements define the operation we ultimately want to perform */ 72 /* These elements define the operation we ultimately want to perform */
70 struct sg_table sg_table; 73 struct scsi_data_buffer sdb;
71 unsigned short use_sg; /* Number of pieces of scatter-gather */
72
73 unsigned underflow; /* Return error if less than 74 unsigned underflow; /* Return error if less than
74 this amount is transferred */ 75 this amount is transferred */
75 76
@@ -79,10 +80,6 @@ struct scsi_cmnd {
79 reconnects. Probably == sector 80 reconnects. Probably == sector
80 size */ 81 size */
81 82
82 int resid; /* Number of bytes requested to be
83 transferred less actual number
84 transferred (0 if not supported) */
85
86 struct request *request; /* The command we are 83 struct request *request; /* The command we are
87 working on */ 84 working on */
88 85
@@ -133,18 +130,29 @@ extern void scsi_release_buffers(struct scsi_cmnd *cmd);
133extern int scsi_dma_map(struct scsi_cmnd *cmd); 130extern int scsi_dma_map(struct scsi_cmnd *cmd);
134extern void scsi_dma_unmap(struct scsi_cmnd *cmd); 131extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
135 132
136#define scsi_sg_count(cmd) ((cmd)->use_sg) 133static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd)
137#define scsi_sglist(cmd) ((cmd)->sg_table.sgl) 134{
138#define scsi_bufflen(cmd) ((cmd)->request_bufflen) 135 return cmd->sdb.table.nents;
136}
137
138static inline struct scatterlist *scsi_sglist(struct scsi_cmnd *cmd)
139{
140 return cmd->sdb.table.sgl;
141}
142
143static inline unsigned scsi_bufflen(struct scsi_cmnd *cmd)
144{
145 return cmd->sdb.length;
146}
139 147
140static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid) 148static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
141{ 149{
142 cmd->resid = resid; 150 cmd->sdb.resid = resid;
143} 151}
144 152
145static inline int scsi_get_resid(struct scsi_cmnd *cmd) 153static inline int scsi_get_resid(struct scsi_cmnd *cmd)
146{ 154{
147 return cmd->resid; 155 return cmd->sdb.resid;
148} 156}
149 157
150#define scsi_for_each_sg(cmd, sg, nseg, __i) \ 158#define scsi_for_each_sg(cmd, sg, nseg, __i) \