kcmp(2): implement for vnode files

Reviewed by:	brooks, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43518
This commit is contained in:
Konstantin Belousov 2024-01-19 23:24:31 +02:00
parent f28526e946
commit f04220c1b0
3 changed files with 11 additions and 0 deletions

View file

@ -5285,6 +5285,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,
};

View file

@ -123,6 +123,7 @@ struct fileops vnops = {
.fo_mmap = vn_mmap,
.fo_fallocate = vn_fallocate,
.fo_fspacectl = vn_fspacectl,
.fo_cmp = vn_cmp,
.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
};
@ -4228,3 +4229,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));
}

View file

@ -818,6 +818,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,