aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-05-08 10:09:59 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-06-24 16:47:04 +0000
commit272a12639440c2865fefba8b38771f8dd0ac5778 (patch)
treeccd417e8765db66bfc1daab8bc76fb2b88d20e59
parent682f135f5de39cfc24cfd529ea8a161e94c76c8e (diff)
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
-rw-r--r--sys/compat/linuxkpi/common/include/linux/fs.h1
-rw-r--r--sys/compat/linuxkpi/common/include/linux/mount.h14
-rw-r--r--sys/compat/linuxkpi/common/include/linux/shmem_fs.h5
-rw-r--r--sys/compat/linuxkpi/common/src/linux_shmemfs.c9
4 files changed, 29 insertions, 0 deletions
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)