diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2024-01-19 21:54:03 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2024-01-24 05:11:27 +0000 |
commit | 41fb6dc3d4df632ffacf91b5631a718442d129d5 (patch) | |
tree | 9026c5cbab5ac23e750689de6f5df3dbb1b38816 | |
parent | 5c41d888de1aba0e82531fb6df4cc3b6989d37bd (diff) | |
download | src-41fb6dc3d4df632ffacf91b5631a718442d129d5.tar.gz src-41fb6dc3d4df632ffacf91b5631a718442d129d5.zip |
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
-rw-r--r-- | sys/compat/linuxkpi/common/src/linux_compat.c | 14 |
1 files changed, 14 insertions, 0 deletions
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, }; |