diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-05-09 03:02:57 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-16 05:07:10 -0400 |
commit | 96b418c960af0d5c7185ff5c4af9376eb37ac9d3 (patch) | |
tree | c909c9d317262cadb37357e0e13d7c2922cfebc0 /include/linux/scatterlist.h | |
parent | ab83407e9ee35a4972457aa487be6a7a21afd715 (diff) |
Add sg helpers for iterating over a scatterlist table
First step to being able to change the scatterlist setup without
having to modify drivers (a lot :-)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/scatterlist.h')
-rw-r--r-- | include/linux/scatterlist.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 4efbd9c445f5..bed5ab4d756a 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -20,4 +20,13 @@ static inline void sg_init_one(struct scatterlist *sg, const void *buf, | |||
20 | sg_set_buf(sg, buf, buflen); | 20 | sg_set_buf(sg, buf, buflen); |
21 | } | 21 | } |
22 | 22 | ||
23 | #define sg_next(sg) ((sg) + 1) | ||
24 | #define sg_last(sg, nents) (&(sg[(nents) - 1])) | ||
25 | |||
26 | /* | ||
27 | * Loop over each sg element, following the pointer to a new list if necessary | ||
28 | */ | ||
29 | #define for_each_sg(sglist, sg, nr, __i) \ | ||
30 | for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg)) | ||
31 | |||
23 | #endif /* _LINUX_SCATTERLIST_H */ | 32 | #endif /* _LINUX_SCATTERLIST_H */ |