git: 4e0d3f7b3c32 - main - linuxkpi: Move `invalidate_mapping_pages()` to <linux/pagemap.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 13 Dec 2023 18:28:44 UTC
The branch main has been updated by dumbbell:

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

commit 4e0d3f7b3c3295e51ded2bab39f36842f405b4eb
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-12-08 17:07:00 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-12-13 18:18:46 +0000

    linuxkpi: Move `invalidate_mapping_pages()` to <linux/pagemap.h>
    
    [Why]
    This is consistent with Linux.
    
    [How]
    The definition is moved from <linux/shmem_fs.h> to <linux/pagemap.h> and
    the latter is included from the former. This is how it is done on Linux.
    
    Prototypes are also expanded with argument names. I got a build failure
    in the DRM 5.18 drivers because the compiler considered that the
    `pgoff_t` argument was there twice.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D43018
---
 sys/compat/linuxkpi/common/include/linux/pagemap.h  |  6 ++++++
 sys/compat/linuxkpi/common/include/linux/shmem_fs.h | 15 ++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/pagemap.h b/sys/compat/linuxkpi/common/include/linux/pagemap.h
index aa2e2a4e3950..7244b61257dc 100644
--- a/sys/compat/linuxkpi/common/include/linux/pagemap.h
+++ b/sys/compat/linuxkpi/common/include/linux/pagemap.h
@@ -33,6 +33,12 @@
 #include <linux/highmem.h>
 #include <linux/vmalloc.h>
 
+#define	invalidate_mapping_pages(...) \
+  linux_invalidate_mapping_pages(__VA_ARGS__)
+
+unsigned long linux_invalidate_mapping_pages(vm_object_t obj, pgoff_t start,
+    pgoff_t end);
+
 static inline void
 release_pages(struct page **pages, int nr)
 {
diff --git a/sys/compat/linuxkpi/common/include/linux/shmem_fs.h b/sys/compat/linuxkpi/common/include/linux/shmem_fs.h
index eb31c5ad827a..d373cfa1d611 100644
--- a/sys/compat/linuxkpi/common/include/linux/shmem_fs.h
+++ b/sys/compat/linuxkpi/common/include/linux/shmem_fs.h
@@ -29,14 +29,15 @@
 #ifndef	_LINUXKPI_LINUX_SHMEM_FS_H_
 #define	_LINUXKPI_LINUX_SHMEM_FS_H_
 
-/* Shared memory support */
-unsigned long linux_invalidate_mapping_pages(vm_object_t, pgoff_t, pgoff_t);
-struct page *linux_shmem_read_mapping_page_gfp(vm_object_t, int, gfp_t);
-struct linux_file *linux_shmem_file_setup(const char *, loff_t, unsigned long);
-void linux_shmem_truncate_range(vm_object_t, loff_t, loff_t);
+#include <linux/pagemap.h>
 
-#define	invalidate_mapping_pages(...) \
-  linux_invalidate_mapping_pages(__VA_ARGS__)
+/* Shared memory support */
+struct page *linux_shmem_read_mapping_page_gfp(vm_object_t obj, int pindex,
+    gfp_t gfp);
+struct linux_file *linux_shmem_file_setup(const char *name, loff_t size,
+    unsigned long flags);
+void linux_shmem_truncate_range(vm_object_t obj, loff_t lstart,
+    loff_t lend);
 
 #define	shmem_read_mapping_page(...) \
   linux_shmem_read_mapping_page_gfp(__VA_ARGS__, 0)