Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Feb 2024 01:52:50 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: 81d146d078e9 - stable/13 - kcmp(2): implement for vnode files
Message-ID:  <202402110152.41B1qoRF089558@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=81d146d078e94707af2ed13bce6e42c0518e77b7

commit 81d146d078e94707af2ed13bce6e42c0518e77b7
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-01-19 21:24:31 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-11 01:40:29 +0000

    kcmp(2): implement for vnode files
    
    (cherry picked from commit f04220c1b0641fa68d01dc85d9fef706b02f4079)
---
 sys/kern/kern_descrip.c | 1 +
 sys/kern/vfs_vnops.c    | 9 +++++++++
 sys/sys/vnode.h         | 1 +
 3 files changed, 11 insertions(+)

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 0a28f47bccdf..f51a1092114d 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -5305,6 +5305,7 @@ struct fileops path_fileops = {
 	.fo_chown = badfo_chown,
 	.fo_sendfile = badfo_sendfile,
 	.fo_fill_kinfo = vn_fill_kinfo,
+	.fo_cmp = vn_cmp,
 	.fo_flags = DFLAG_PASSABLE,
 };
 
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index d2df3e2c5e4d..e095fb9df13b 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -123,6 +123,7 @@ struct 	fileops vnops = {
 	.fo_fill_kinfo = vn_fill_kinfo,
 	.fo_mmap = vn_mmap,
 	.fo_fallocate = vn_fallocate,
+	.fo_cmp = vn_cmp,
 	.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
 };
 
@@ -4064,3 +4065,11 @@ vn_lktype_write(struct mount *mp, struct vnode *vp)
 		return (LK_SHARED);
 	return (LK_EXCLUSIVE);
 }
+
+int
+vn_cmp(struct file *fp1, struct file *fp2, struct thread *td)
+{
+	if (fp2->f_type != DTYPE_VNODE)
+		return (3);
+	return (kcmp_cmp((uintptr_t)fp1->f_vnode, (uintptr_t)fp2->f_vnode));
+}
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index fb7c446d7ee0..196965eba9a3 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -804,6 +804,7 @@ int	vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc,
 	    void *alloc_arg, int lkflags, struct vnode **rvp);
 int	vn_utimes_perm(struct vnode *vp, struct vattr *vap,
 	    struct ucred *cred, struct thread *td);
+int	vn_cmp(struct file *, struct file *, struct thread *td);
 
 int	vn_io_fault_uiomove(char *data, int xfersize, struct uio *uio);
 int	vn_io_fault_pgmove(vm_page_t ma[], vm_offset_t offset, int xfersize,



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