Module Name: src Committed By: thorpej Date: Wed Jul 13 14:11:46 UTC 2022
Modified Files: src/sys/kern: kern_event.c src/sys/sys: event.h Log Message: Move klist_{init,fini,insert,remove}() into kern_event.c. NFC. To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/kern/kern_event.c cvs rdiff -u -r1.52 -r1.53 src/sys/sys/event.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_event.c diff -u src/sys/kern/kern_event.c:1.142 src/sys/kern/kern_event.c:1.143 --- src/sys/kern/kern_event.c:1.142 Wed Jul 13 03:23:07 2022 +++ src/sys/kern/kern_event.c Wed Jul 13 14:11:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_event.c,v 1.142 2022/07/13 03:23:07 thorpej Exp $ */ +/* $NetBSD: kern_event.c,v 1.143 2022/07/13 14:11:46 thorpej Exp $ */ /*- * Copyright (c) 2008, 2009, 2021 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ #endif /* _KERNEL_OPT */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.142 2022/07/13 03:23:07 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.143 2022/07/13 14:11:46 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -2813,3 +2813,41 @@ knote_clear_eof(struct knote *kn) kn->kn_flags &= ~EV_EOF; mutex_spin_exit(&kq->kq_lock); } + +/* + * Initialize a klist. + */ +void +klist_init(struct klist *list) +{ + SLIST_INIT(list); +} + +/* + * Finalize a klist. + */ +void +klist_fini(struct klist *list) +{ + /* Nothing, for now. */ +} + +/* + * Insert a knote into a klist. + */ +void +klist_insert(struct klist *list, struct knote *kn) +{ + SLIST_INSERT_HEAD(list, kn, kn_selnext); +} + +/* + * Remove a knote from a klist. Returns true if the last + * knote was removed and the list is now empty. + */ +bool +klist_remove(struct klist *list, struct knote *kn) +{ + SLIST_REMOVE(list, kn, knote, kn_selnext); + return SLIST_EMPTY(list); +} Index: src/sys/sys/event.h diff -u src/sys/sys/event.h:1.52 src/sys/sys/event.h:1.53 --- src/sys/sys/event.h:1.52 Sat Feb 12 15:51:29 2022 +++ src/sys/sys/event.h Wed Jul 13 14:11:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: event.h,v 1.52 2022/02/12 15:51:29 thorpej Exp $ */ +/* $NetBSD: event.h,v 1.53 2022/07/13 14:11:46 thorpej Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jle...@freebsd.org> @@ -334,30 +334,10 @@ int kfilter_unregister(const char *); int filt_seltrue(struct knote *, long); extern const struct filterops seltrue_filtops; -static inline void -klist_init(struct klist *list) -{ - SLIST_INIT(list); -} - -static inline void -klist_fini(struct klist *list) -{ - /* Nothing, for now. */ -} - -static inline void -klist_insert(struct klist *list, struct knote *kn) -{ - SLIST_INSERT_HEAD(list, kn, kn_selnext); -} - -static inline bool -klist_remove(struct klist *list, struct knote *kn) -{ - SLIST_REMOVE(list, kn, knote, kn_selnext); - return SLIST_EMPTY(list); -} +void klist_init(struct klist *); +void klist_fini(struct klist *); +void klist_insert(struct klist *, struct knote *); +bool klist_remove(struct klist *, struct knote *); #else /* !_KERNEL */