[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>
This commit is contained in:
committed by
James Bottomley
parent
9ef3e4a452
commit
824d7b570b
@ -135,4 +135,24 @@ extern void scsi_kunmap_atomic_sg(void *virt);
|
||||
extern struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *, gfp_t);
|
||||
extern void scsi_free_sgtable(struct scatterlist *, int);
|
||||
|
||||
extern int scsi_dma_map(struct scsi_cmnd *cmd);
|
||||
extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
|
||||
|
||||
#define scsi_sg_count(cmd) ((cmd)->use_sg)
|
||||
#define scsi_sglist(cmd) ((struct scatterlist *)(cmd)->request_buffer)
|
||||
#define scsi_bufflen(cmd) ((cmd)->request_bufflen)
|
||||
|
||||
static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
|
||||
{
|
||||
cmd->resid = resid;
|
||||
}
|
||||
|
||||
static inline int scsi_get_resid(struct scsi_cmnd *cmd)
|
||||
{
|
||||
return cmd->resid;
|
||||
}
|
||||
|
||||
#define scsi_for_each_sg(cmd, sg, nseg, __i) \
|
||||
for (__i = 0, sg = scsi_sglist(cmd); __i < (nseg); __i++, (sg)++)
|
||||
|
||||
#endif /* _SCSI_SCSI_CMND_H */
|
||||
|
Reference in New Issue
Block a user