Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jan 2025 16:03:22 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien?= =?utf-8?Q?P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e3cf2321b084 - main - linuxkpi: Add `get_file_active()`
Message-ID:  <202501311603.50VG3MnG038857@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dumbbell:

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

commit e3cf2321b084df599a28979e624ff8083c150dc7
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2025-01-01 14:38:38 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2025-01-31 16:00:49 +0000

    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
---
 sys/compat/linuxkpi/common/include/linux/fs.h |  1 +
 sys/compat/linuxkpi/common/src/linux_compat.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

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)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501311603.50VG3MnG038857>