git: 272a12639440 - main - linuxkpi: Define `struct vfsmount` in <linux/mount.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 24 Jun 2026 16:47:50 UTC
The branch main has been updated by dumbbell:

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

commit 272a12639440c2865fefba8b38771f8dd0ac5778
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-05-08 10:09:59 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-06-24 16:47:04 +0000

    linuxkpi: Define `struct vfsmount` in <linux/mount.h>
    
    In the context of the DRM drivers, this is used to show GEM objects in a
    shmfs virtual filesystem. The new `shmem_file_setup_with_mnt()` - also
    introduced in this commit as an alias to `shmem_file_setup()` - takes a
    `struct vfsmount` as its first argument to indicate which shmfs mount
    should be used.
    
    For now, the structure is empty. As we don't present GEM objects in a
    virtual filesystem right now, we can defer the actual implementation of
    this structure once we have an actual use for it.
    
    The DRM generic code started to use it in Linux 6.13.
    
    Reviewed by:    emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D57572
---
 sys/compat/linuxkpi/common/include/linux/fs.h       |  1 +
 sys/compat/linuxkpi/common/include/linux/mount.h    | 14 ++++++++++++++
 sys/compat/linuxkpi/common/include/linux/shmem_fs.h |  5 +++++
 sys/compat/linuxkpi/common/src/linux_shmemfs.c      |  9 +++++++++
 4 files changed, 29 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h
index 749a9fd22d3d..65409bd775cd 100644
--- a/sys/compat/linuxkpi/common/include/linux/fs.h
+++ b/sys/compat/linuxkpi/common/include/linux/fs.h
@@ -43,6 +43,7 @@
 #include <linux/capability.h>
 #include <linux/wait_bit.h>
 #include <linux/kernel.h>
+#include <linux/mount.h>
 #include <linux/mutex.h>
 
 struct module;
diff --git a/sys/compat/linuxkpi/common/include/linux/mount.h b/sys/compat/linuxkpi/common/include/linux/mount.h
new file mode 100644
index 000000000000..f0a2a0a4e295
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/mount.h
@@ -0,0 +1,14 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 The FreeBSD Foundation
+ * Copyright (c) 2026 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
+ */
+
+#ifndef _LINUXKPI_LINUX_MOUNT_H_
+#define	_LINUXKPI_LINUX_MOUNT_H_
+
+struct vfsmount {
+};
+
+#endif
diff --git a/sys/compat/linuxkpi/common/include/linux/shmem_fs.h b/sys/compat/linuxkpi/common/include/linux/shmem_fs.h
index 5e91725d4a1c..1e49d8c73493 100644
--- a/sys/compat/linuxkpi/common/include/linux/shmem_fs.h
+++ b/sys/compat/linuxkpi/common/include/linux/shmem_fs.h
@@ -39,6 +39,8 @@ 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);
+struct linux_file *linux_shmem_file_setup_with_mnt(struct vfsmount *mount,
+    const char *name, loff_t size, unsigned long flags);
 void linux_shmem_truncate_range(vm_object_t obj, loff_t lstart,
     loff_t lend);
 
@@ -51,6 +53,9 @@ void linux_shmem_truncate_range(vm_object_t obj, loff_t lstart,
 #define	shmem_file_setup(...) \
   linux_shmem_file_setup(__VA_ARGS__)
 
+#define	shmem_file_setup_with_mnt(...) \
+  linux_shmem_file_setup_with_mnt(__VA_ARGS__)
+
 #define	shmem_truncate_range(...) \
   linux_shmem_truncate_range(__VA_ARGS__)
 
diff --git a/sys/compat/linuxkpi/common/src/linux_shmemfs.c b/sys/compat/linuxkpi/common/src/linux_shmemfs.c
index d5c118ba7624..e94d6cf8279d 100644
--- a/sys/compat/linuxkpi/common/src/linux_shmemfs.c
+++ b/sys/compat/linuxkpi/common/src/linux_shmemfs.c
@@ -93,6 +93,15 @@ err_0:
 	return (ERR_PTR(error));
 }
 
+struct linux_file *
+linux_shmem_file_setup_with_mnt(struct vfsmount *mount,
+    const char *name, loff_t size, unsigned long flags)
+{
+	pr_debug("%s: TODO\n", __func__);
+
+	return (linux_shmem_file_setup(name, size, flags));
+}
+
 static vm_ooffset_t
 linux_invalidate_mapping_pages_sub(vm_object_t obj, vm_pindex_t start,
     vm_pindex_t end, int flags)