aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2007-05-26 01:04:03 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-05-26 17:29:59 -0400
commit824d7b570b4dec49e868c251d670941b02a1e489 (patch)
tree1590c87323c9f9235945ba03627fd1ce0b731a1f /include
parent9ef3e4a4527e1f65b8776287c6d4fd1fca5ba98f (diff)
[SCSI] scsi_lib: add scatter/gather data buffer accessors
This adds a set of accessors for the scsi data buffer. This is in preparation for chaining sg lists and bidirectional requests (and possibly, the mid-layer dma mapping). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/scsi_cmnd.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index a2e0c1032491..53e170586c26 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -135,4 +135,24 @@ extern void scsi_kunmap_atomic_sg(void *virt);
135extern struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *, gfp_t); 135extern struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *, gfp_t);
136extern void scsi_free_sgtable(struct scatterlist *, int); 136extern void scsi_free_sgtable(struct scatterlist *, int);
137 137
138extern int scsi_dma_map(struct scsi_cmnd *cmd);
139extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
140
141#define scsi_sg_count(cmd) ((cmd)->use_sg)
142#define scsi_sglist(cmd) ((struct scatterlist *)(cmd)->request_buffer)
143#define scsi_bufflen(cmd) ((cmd)->request_bufflen)
144
145static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
146{
147 cmd->resid = resid;
148}
149
150static inline int scsi_get_resid(struct scsi_cmnd *cmd)
151{
152 return cmd->resid;
153}
154
155#define scsi_for_each_sg(cmd, sg, nseg, __i) \
156 for (__i = 0, sg = scsi_sglist(cmd); __i < (nseg); __i++, (sg)++)
157
138#endif /* _SCSI_SCSI_CMND_H */ 158#endif /* _SCSI_SCSI_CMND_H */