scatterlist.h 520 B

1234567891011121314151617181920212223
  1. #ifndef _LINUX_SCATTERLIST_H
  2. #define _LINUX_SCATTERLIST_H
  3. #include <asm/scatterlist.h>
  4. #include <linux/mm.h>
  5. #include <linux/string.h>
  6. static inline void sg_set_buf(struct scatterlist *sg, void *buf,
  7. unsigned int buflen)
  8. {
  9. sg->page = virt_to_page(buf);
  10. sg->offset = offset_in_page(buf);
  11. sg->length = buflen;
  12. }
  13. static inline void sg_init_one(struct scatterlist *sg, void *buf,
  14. unsigned int buflen)
  15. {
  16. memset(sg, 0, sizeof(*sg));
  17. sg_set_buf(sg, buf, buflen);
  18. }
  19. #endif /* _LINUX_SCATTERLIST_H */