Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_SCATTERLIST_H |
| 2 | #define _LINUX_SCATTERLIST_H |
| 3 | |
Herbert Xu | d32311f | 2005-09-17 14:41:40 +1000 | [diff] [blame] | 4 | #include <asm/scatterlist.h> |
| 5 | #include <linux/mm.h> |
| 6 | #include <linux/string.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | |
Herbert Xu | 03fd9ce | 2006-08-14 23:11:53 +1000 | [diff] [blame^] | 8 | static inline void sg_set_buf(struct scatterlist *sg, const void *buf, |
Herbert Xu | d32311f | 2005-09-17 14:41:40 +1000 | [diff] [blame] | 9 | unsigned int buflen) |
| 10 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | sg->page = virt_to_page(buf); |
| 12 | sg->offset = offset_in_page(buf); |
| 13 | sg->length = buflen; |
| 14 | } |
| 15 | |
Herbert Xu | 03fd9ce | 2006-08-14 23:11:53 +1000 | [diff] [blame^] | 16 | static inline void sg_init_one(struct scatterlist *sg, const void *buf, |
Herbert Xu | d32311f | 2005-09-17 14:41:40 +1000 | [diff] [blame] | 17 | unsigned int buflen) |
| 18 | { |
| 19 | memset(sg, 0, sizeof(*sg)); |
| 20 | sg_set_buf(sg, buf, buflen); |
| 21 | } |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #endif /* _LINUX_SCATTERLIST_H */ |