git: f3490083b731 - main - linuxkpi: Add `sg_alloc_table_from_pages_segment()`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Mon, 13 Feb 2023 21:09:55 UTC
The branch main has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=f3490083b731700f2aa7c17ac6fe159826dc59a5

commit f3490083b731700f2aa7c17ac6fe159826dc59a5
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-02-10 15:37:31 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-02-13 21:09:32 +0000

    linuxkpi: Add `sg_alloc_table_from_pages_segment()`
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38541
---
 sys/compat/linuxkpi/common/include/linux/scatterlist.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

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
@@ -427,6 +427,20 @@ sg_alloc_table_from_pages(struct sg_table *sgt,
 #endif
 }
 
+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)
 {