git: 41fb6dc3d4df - main - kcmp(2): implement for linuxkpi cdevs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 24 Jan 2024 05:12:22 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=41fb6dc3d4df632ffacf91b5631a718442d129d5
commit 41fb6dc3d4df632ffacf91b5631a718442d129d5
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-01-19 21:54:03 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-24 05:11:27 +0000
kcmp(2): implement for linuxkpi cdevs
Reviewed by: brooks, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43518
---
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 4a998a557514..36ed7b84cc94 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -1721,6 +1721,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,
@@ -1735,6 +1748,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,
};