aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2023-02-10 15:37:31 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2023-02-16 11:55:20 +0000
commit1d5100d9be2d97d2c74fe15f29a7a42cbada144b (patch)
treeb847319b88ab1426d83026b7364dd39c34a44c77
parent9410b6b994469040262200f1465fb30c9cd8b64b (diff)
downloadsrc-1d5100d9be2d97d2c74fe15f29a7a42cbada144b.tar.gz
src-1d5100d9be2d97d2c74fe15f29a7a42cbada144b.zip
linuxkpi: Add `sg_alloc_table_from_pages_segment()`
Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38541 (cherry picked from commit f3490083b731700f2aa7c17ac6fe159826dc59a5)
-rw-r--r--sys/compat/linuxkpi/common/include/linux/scatterlist.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
index d1a71258c27d..fe4bce06819d 100644
--- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h
+++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
@@ -428,6 +428,20 @@ sg_alloc_table_from_pages(struct sg_table *sgt,
}
static inline int
+sg_alloc_table_from_pages_segment(struct sg_table *sgt,
+ struct page **pages, unsigned int count, unsigned int off,
+ unsigned long size, unsigned int max_segment, gfp_t gfp_mask)
+{
+#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 51300
+ return (PTR_ERR_OR_ZERO(__sg_alloc_table_from_pages(sgt, pages, count, off, size,
+ max_segment, NULL, 0, gfp_mask)));
+#else
+ return (__sg_alloc_table_from_pages(sgt, pages, count, off, size,
+ max_segment, gfp_mask));
+#endif
+}
+
+static inline int
sg_nents(struct scatterlist *sg)
{
int nents;