aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2024-01-19 21:36:50 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2024-02-11 01:40:29 +0000
commit890d1f392a1ed6792f0f1563f601181e5b9935a7 (patch)
tree7f3ff434e942d3a438e2227a76a3fdde595e165e
parent81d146d078e94707af2ed13bce6e42c0518e77b7 (diff)
downloadsrc-890d1f392a1ed6792f0f1563f601181e5b9935a7.tar.gz
src-890d1f392a1ed6792f0f1563f601181e5b9935a7.zip
kcmp(2): implement for devfs files
(cherry picked from commit 5c41d888de1aba0e82531fb6df4cc3b6989d37bd)
-rw-r--r--sys/fs/devfs/devfs_vnops.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index a71cfda9fa9a..45c72438f752 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -2024,6 +2024,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,
@@ -2039,6 +2047,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
};