Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Feb 2024 01:52:53 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e314d3d7aa65 - stable/13 - kcmp(2): implement for linuxkpi cdevs
Message-ID:  <202402110152.41B1qrjj089648@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

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

commit e314d3d7aa65159291fad83ea95c867b473b0dca
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-01-19 21:54:03 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-11 01:40:29 +0000

    kcmp(2): implement for linuxkpi cdevs
    
    (cherry picked from commit 41fb6dc3d4df632ffacf91b5631a718442d129d5)
---
 sys/compat/linuxkpi/common/src/linux_compat.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index df48674163aa..85fb072b9943 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -1900,6 +1900,19 @@ linux_iminor(struct inode *inode)
 	return (minor(ldev->dev));
 }
 
+static int
+linux_file_kcmp(struct file *fp1, struct file *fp2, struct thread *td)
+{
+	struct linux_file *filp1, *filp2;
+
+	if (fp2->f_type != DTYPE_DEV)
+		return (3);
+
+	filp1 = fp1->f_data;
+	filp2 = fp2->f_data;
+	return (kcmp_cmp((uintptr_t)filp1->f_cdev, (uintptr_t)filp2->f_cdev));
+}
+
 struct fileops linuxfileops = {
 	.fo_read = linux_file_read,
 	.fo_write = linux_file_write,
@@ -1914,6 +1927,7 @@ struct fileops linuxfileops = {
 	.fo_chmod = invfo_chmod,
 	.fo_chown = invfo_chown,
 	.fo_sendfile = invfo_sendfile,
+	.fo_cmp = linux_file_kcmp,
 	.fo_flags = DFLAG_PASSABLE,
 };
 



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