git: 23af3ca2d418 - stable/13 - kern/subr_unit.c: more uses for is_bitmap()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 05 Jun 2023 08:36:02 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=23af3ca2d4183c298435297b2e0aca226e2277dd commit 23af3ca2d4183c298435297b2e0aca226e2277dd Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-05-12 22:39:35 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-06-05 08:35:00 +0000 kern/subr_unit.c: more uses for is_bitmap() (cherry picked from commit 36b1f8a81ef96b42ce446efb79cffd577f1819f7) --- sys/kern/subr_unit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/kern/subr_unit.c b/sys/kern/subr_unit.c index fd9425e95dd5..6c1368c64e00 100644 --- a/sys/kern/subr_unit.c +++ b/sys/kern/subr_unit.c @@ -207,6 +207,12 @@ CTASSERT((sizeof(struct unr) % sizeof(bitstr_t)) == 0); /* Number of bits we can store in the bitmap */ #define NBITS (NBBY * sizeof(((struct unrb *)NULL)->map)) +static inline bool +is_bitmap(struct unrhdr *uh, struct unr *up) +{ + return (up->ptr != uh && up->ptr != NULL); +} + /* Is the unrb empty in at least the first len bits? */ static inline bool ub_empty(struct unrb *ub, int len) { @@ -246,7 +252,7 @@ check_unrhdr(struct unrhdr *uh, int line) z = 0; TAILQ_FOREACH(up, &uh->head, list) { z++; - if (up->ptr != uh && up->ptr != NULL) { + if (is_bitmap(uh, up)) { ub = up->ptr; KASSERT (up->len <= NBITS, ("UNR inconsistency: len %u max %zd (line %d)\n", @@ -409,12 +415,6 @@ clear_unrhdr(struct unrhdr *uh) check_unrhdr(uh, __LINE__); } -static __inline int -is_bitmap(struct unrhdr *uh, struct unr *up) -{ - return (up->ptr != uh && up->ptr != NULL); -} - /* * Look for sequence of items which can be combined into a bitmap, if * multiple are present, take the one which saves most memory.