git: 7dff3d1cdfd1 - stable/14 - kcmp(2): implement for devfs files
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 31 Jan 2024 00:46:12 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=7dff3d1cdfd1556d2137ddd8dd1916e0945ed240
commit 7dff3d1cdfd1556d2137ddd8dd1916e0945ed240
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-01-19 21:36:50 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-30 20:24:43 +0000
kcmp(2): implement for devfs files
(cherry picked from commit 5c41d888de1aba0e82531fb6df4cc3b6989d37bd)
---
sys/fs/devfs/devfs_vnops.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 1df7d13be919..b8cf8c12d32e 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -2012,6 +2012,14 @@ dev2udev(struct cdev *x)
return (cdev2priv(x)->cdp_inode);
}
+static int
+devfs_cmp_f(struct file *fp1, struct file *fp2, struct thread *td)
+{
+ if (fp2->f_type != DTYPE_VNODE || fp2->f_ops != &devfs_ops_f)
+ return (3);
+ return (kcmp_cmp((uintptr_t)fp1->f_data, (uintptr_t)fp2->f_data));
+}
+
static struct fileops devfs_ops_f = {
.fo_read = devfs_read_f,
.fo_write = devfs_write_f,
@@ -2027,6 +2035,7 @@ static struct fileops devfs_ops_f = {
.fo_seek = vn_seek,
.fo_fill_kinfo = vn_fill_kinfo,
.fo_mmap = devfs_mmap_f,
+ .fo_cmp = devfs_cmp_f,
.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
};