git: af641e950df6 - main - LinuxKPI: Include <linux/fs.h> from <linux/mm.h>

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Fri, 20 Nov 2026 18:19:35 UTC
The branch main has been updated by wulf:

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

commit af641e950df629f980e545e0a9f75db4ad156cd6
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2026-11-20 18:17:59 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-11-20 18:17:59 +0000

    LinuxKPI: Include <linux/fs.h> from <linux/mm.h>
    
    and <linux/kernel.h> from <linux/io.h>.
    This reproduces the same namespace pollution as Linux and will help us
    to fix historical bug when these files were included from <linux/fb.h>.
    Fix conflicting Linux name leakage appeared in qat(4) as result.
    
    Differential Revision:  https://reviews.freebsd.org/D60798
---
 sys/compat/linuxkpi/common/include/linux/io.h | 1 +
 sys/compat/linuxkpi/common/include/linux/mm.h | 1 +
 sys/dev/qat/include/common/qat_freebsd.h      | 9 +++++++++
 3 files changed, 11 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h
index 5da0b64045f2..c5d944cb1047 100644
--- a/sys/compat/linuxkpi/common/include/linux/io.h
+++ b/sys/compat/linuxkpi/common/include/linux/io.h
@@ -38,6 +38,7 @@
 #include <linux/err.h>
 #include <asm-generic/io.h>
 #include <linux/types.h>
+#include <linux/kernel.h>
 #if !defined(__arm__)
 #include <asm/set_memory.h>
 #endif
diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h
index 1732e21de5cf..3fa0e32d966e 100644
--- a/sys/compat/linuxkpi/common/include/linux/mm.h
+++ b/sys/compat/linuxkpi/common/include/linux/mm.h
@@ -43,6 +43,7 @@
 #include <linux/shrinker.h>
 #include <linux/page.h>
 #include <linux/page-flags.h>
+#include <linux/fs.h>
 
 #include <asm/pgtable.h>
 
diff --git a/sys/dev/qat/include/common/qat_freebsd.h b/sys/dev/qat/include/common/qat_freebsd.h
index 179d6bbfc228..10511dddb234 100644
--- a/sys/dev/qat/include/common/qat_freebsd.h
+++ b/sys/dev/qat/include/common/qat_freebsd.h
@@ -16,6 +16,15 @@
 #include <sys/param.h>
 #include <sys/lock.h>
 #include <linux/device.h>
+/*
+ * `linux/device.h` redefines `file` to be `linux_file` to manage the
+ * name conflict between the Linux and FreeBSD structures, while avoiding a
+ * extensive rewrite and use of macros in the original drm_fb_helper.[ch]
+ * files.
+ *
+ * We need to undo this here because we use FreeBSD structures.
+ */
+#undef file
 #include <linux/dma-mapping.h>
 #include <linux/completion.h>
 #include <linux/list.h>