diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2023-05-12 22:39:35 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2023-05-29 22:10:35 +0000 |
commit | 36b1f8a81ef96b42ce446efb79cffd577f1819f7 (patch) | |
tree | c7394151e175ed5bde8e3114ec9830d496cd179f | |
parent | 042ec55f9df769697feb6cee472959d001a0f033 (diff) | |
download | src-36b1f8a81ef96b42ce446efb79cffd577f1819f7.tar.gz src-36b1f8a81ef96b42ce446efb79cffd577f1819f7.zip |
kern/subr_unit.c: more uses for is_bitmap()
To facilitate it, move the is_bitmap() definition earlier.
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40089
-rw-r--r-- | sys/kern/subr_unit.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/subr_unit.c b/sys/kern/subr_unit.c index 22710f546d4f..a1878ea4b144 100644 --- a/sys/kern/subr_unit.c +++ b/sys/kern/subr_unit.c @@ -194,6 +194,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) { @@ -233,7 +239,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", @@ -396,12 +402,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. |