aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2025-01-01 14:38:38 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2025-01-31 16:00:49 +0000
commite3cf2321b084df599a28979e624ff8083c150dc7 (patch)
treeac69b9c39f365e0211ba190fbf41ff614a102fcf
parent1de8fcf419fce890474271215dce3b6e4876b60a (diff)
linuxkpi: Add `get_file_active()`
[Why] This is used by the i915 DRM driver starting from Linux 6.7. Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48757
-rw-r--r--sys/compat/linuxkpi/common/include/linux/fs.h1
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h
index 86b922ac9a1d..56de0e3e490a 100644
--- a/sys/compat/linuxkpi/common/include/linux/fs.h
+++ b/sys/compat/linuxkpi/common/include/linux/fs.h
@@ -265,6 +265,7 @@ get_file(struct linux_file *f)
}
struct linux_file * linux67_get_file_rcu(struct linux_file **f);
+struct linux_file * get_file_active(struct linux_file **f);
#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 60700
#define get_file_rcu(f) linux67_get_file_rcu(f)
#else
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index e5049a4b8f43..3e2938ab2c2b 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -1121,6 +1121,20 @@ linux67_get_file_rcu(struct linux_file **f)
}
}
+struct linux_file *
+get_file_active(struct linux_file **f)
+{
+ struct linux_file *file1;
+
+ rcu_read_lock();
+ file1 = __get_file_rcu(f);
+ rcu_read_unlock();
+ if (IS_ERR(file1))
+ file1 = NULL;
+
+ return (file1);
+}
+
static void
linux_file_kqfilter_detach(struct knote *kn)
{