git: 67f938c5ff1a - main - kevent: Make references to filter definitions const
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 02 Jun 2023 17:43:38 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=67f938c5ff1a4c90fcb9372132c8458ed67aba57 commit 67f938c5ff1a4c90fcb9372132c8458ed67aba57 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-06-02 17:14:13 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-06-02 17:43:15 +0000 kevent: Make references to filter definitions const Follow-up revisions can make individual filter definitions const. No functional change intended. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35842 --- sys/kern/kern_event.c | 17 ++++++++--------- sys/sys/event.h | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index add480ac5dff..199df2d6d661 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -107,7 +107,7 @@ static int kqueue_acquire(struct file *fp, struct kqueue **kqp); static void kqueue_release(struct kqueue *kq, int locked); static void kqueue_destroy(struct kqueue *kq); static void kqueue_drain(struct kqueue *kq, struct thread *td); -static int kqueue_expand(struct kqueue *kq, struct filterops *fops, +static int kqueue_expand(struct kqueue *kq, const struct filterops *fops, uintptr_t ident, int mflag); static void kqueue_task(void *arg, int pending); static int kqueue_scan(struct kqueue *kq, int maxevents, @@ -115,7 +115,7 @@ static int kqueue_scan(struct kqueue *kq, int maxevents, const struct timespec *timeout, struct kevent *keva, struct thread *td); static void kqueue_wakeup(struct kqueue *kq); -static struct filterops *kqueue_fo_find(int filt); +static const struct filterops *kqueue_fo_find(int filt); static void kqueue_fo_release(int filt); struct g_kevent_args; static int kern_kevent_generic(struct thread *td, @@ -341,10 +341,9 @@ extern struct filterops fs_filtops; * Table for all system-defined filters. */ static struct mtx filterops_lock; -MTX_SYSINIT(kqueue_filterops, &filterops_lock, "protect sysfilt_ops", - MTX_DEF); +MTX_SYSINIT(kqueue_filterops, &filterops_lock, "protect sysfilt_ops", MTX_DEF); static struct { - struct filterops *for_fop; + const struct filterops *for_fop; int for_nolock; int for_refcnt; } sysfilt_ops[EVFILT_SYSCOUNT] = { @@ -1400,7 +1399,7 @@ kern_kevent_anonymous(struct thread *td, int nevents, } int -kqueue_add_filteropts(int filt, struct filterops *filtops) +kqueue_add_filteropts(int filt, const struct filterops *filtops) { int error; @@ -1448,7 +1447,7 @@ kqueue_del_filteropts(int filt) return error; } -static struct filterops * +static const struct filterops * kqueue_fo_find(int filt) { @@ -1491,7 +1490,7 @@ static int kqueue_register(struct kqueue *kq, struct kevent *kev, struct thread *td, int mflag) { - struct filterops *fops; + const struct filterops *fops; struct file *fp; struct knote *kn, *tkn; struct knlist *knl; @@ -1820,7 +1819,7 @@ kqueue_schedtask(struct kqueue *kq) * Return 0 on success (or no work necessary), return errno on failure. */ static int -kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident, +kqueue_expand(struct kqueue *kq, const struct filterops *fops, uintptr_t ident, int mflag) { struct klist *list, *tmp_knhash, *to_free; diff --git a/sys/sys/event.h b/sys/sys/event.h index b5b63c228a8f..7deef9fcebb2 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -308,7 +308,7 @@ struct knote { struct aioliojob *p_lio; /* LIO job pointer */ void *p_v; /* generic other pointer */ } kn_ptr; - struct filterops *kn_fop; + const struct filterops *kn_fop; #define kn_id kn_kevent.ident #define kn_filter kn_kevent.filter @@ -350,7 +350,7 @@ void knlist_cleardel(struct knlist *knl, struct thread *td, void knote_fdclose(struct thread *p, int fd); int kqfd_register(int fd, struct kevent *kev, struct thread *p, int mflag); -int kqueue_add_filteropts(int filt, struct filterops *filtops); +int kqueue_add_filteropts(int filt, const struct filterops *filtops); int kqueue_del_filteropts(int filt); void kqueue_drain_schedtask(void);