mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
kcmp(2): implement for generic file types
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:
parent
211bdd601e
commit
f28526e946
|
@ -139,6 +139,7 @@ static struct fileops kqueueops = {
|
|||
.fo_chmod = invfo_chmod,
|
||||
.fo_chown = invfo_chown,
|
||||
.fo_sendfile = invfo_sendfile,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_fill_kinfo = kqueue_fill_kinfo,
|
||||
};
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ static struct fileops eventfdops = {
|
|||
.fo_chown = invfo_chown,
|
||||
.fo_sendfile = invfo_sendfile,
|
||||
.fo_fill_kinfo = eventfd_fill_kinfo,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_flags = DFLAG_PASSABLE
|
||||
};
|
||||
|
||||
|
|
|
@ -2158,3 +2158,11 @@ sys_kcmp(struct thread *td, struct kcmp_args *uap)
|
|||
return (kern_kcmp(td, uap->pid1, uap->pid2, uap->type,
|
||||
uap->idx1, uap->idx2));
|
||||
}
|
||||
|
||||
int
|
||||
file_kcmp_generic(struct file *fp1, struct file *fp2, struct thread *td)
|
||||
{
|
||||
if (fp1->f_type != fp2->f_type)
|
||||
return (3);
|
||||
return (kcmp_cmp((uintptr_t)fp1->f_data, (uintptr_t)fp2->f_data));
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@ struct fileops pipeops = {
|
|||
.fo_chown = pipe_chown,
|
||||
.fo_sendfile = invfo_sendfile,
|
||||
.fo_fill_kinfo = pipe_fill_kinfo,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_flags = DFLAG_PASSABLE
|
||||
};
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ struct fileops socketops = {
|
|||
.fo_sendfile = invfo_sendfile,
|
||||
.fo_fill_kinfo = soo_fill_kinfo,
|
||||
.fo_aio_queue = soo_aio_queue,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_flags = DFLAG_PASSABLE
|
||||
};
|
||||
|
||||
|
|
|
@ -371,6 +371,7 @@ static struct fileops timerfdops = {
|
|||
.fo_chown = invfo_chown,
|
||||
.fo_sendfile = invfo_sendfile,
|
||||
.fo_fill_kinfo = timerfd_fill_kinfo,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_flags = DFLAG_PASSABLE,
|
||||
};
|
||||
|
||||
|
|
|
@ -610,6 +610,7 @@ static struct fileops ptsdev_ops = {
|
|||
.fo_chown = invfo_chown,
|
||||
.fo_sendfile = invfo_sendfile,
|
||||
.fo_fill_kinfo = ptsdev_fill_kinfo,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_flags = DFLAG_PASSABLE,
|
||||
};
|
||||
|
||||
|
|
|
@ -2661,6 +2661,7 @@ static struct fileops mqueueops = {
|
|||
.fo_chown = mqf_chown,
|
||||
.fo_sendfile = invfo_sendfile,
|
||||
.fo_fill_kinfo = mqf_fill_kinfo,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_flags = DFLAG_PASSABLE,
|
||||
};
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ static struct fileops ksem_ops = {
|
|||
.fo_chown = ksem_chown,
|
||||
.fo_sendfile = invfo_sendfile,
|
||||
.fo_fill_kinfo = ksem_fill_kinfo,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_flags = DFLAG_PASSABLE
|
||||
};
|
||||
|
||||
|
|
|
@ -169,6 +169,7 @@ struct fileops shm_ops = {
|
|||
.fo_add_seals = shm_add_seals,
|
||||
.fo_fallocate = shm_fallocate,
|
||||
.fo_fspacectl = shm_fspacectl,
|
||||
.fo_cmp = file_kcmp_generic,
|
||||
.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE,
|
||||
};
|
||||
|
||||
|
|
|
@ -279,6 +279,7 @@ fo_seek_t vn_seek;
|
|||
fo_fill_kinfo_t vn_fill_kinfo;
|
||||
fo_kqfilter_t vn_kqfilter_opath;
|
||||
int vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif);
|
||||
int file_kcmp_generic(struct file *fp1, struct file *fp2, struct thread *td);
|
||||
|
||||
void finit(struct file *, u_int, short, void *, struct fileops *);
|
||||
void finit_vnode(struct file *, u_int, void *, struct fileops *);
|
||||
|
|
Loading…
Reference in a new issue