summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/kern/subr_unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/kern/subr_unit.c')
-rw-r--r--freebsd/sys/kern/subr_unit.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/freebsd/sys/kern/subr_unit.c b/freebsd/sys/kern/subr_unit.c
index 1deeeb8b..426253dc 100644
--- a/freebsd/sys/kern/subr_unit.c
+++ b/freebsd/sys/kern/subr_unit.c
@@ -1,6 +1,8 @@
#include <machine/rtems-bsd-kernel-space.h>
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2004 Poul-Henning Kamp
* All rights reserved.
*
@@ -368,6 +370,26 @@ delete_unrhdr(struct unrhdr *uh)
Free(uh);
}
+void
+clear_unrhdr(struct unrhdr *uh)
+{
+ struct unr *up, *uq;
+
+ KASSERT(TAILQ_EMPTY(&uh->ppfree),
+ ("unrhdr has postponed item for free"));
+ TAILQ_FOREACH_SAFE(up, &uh->head, list, uq) {
+ if (up->ptr != uh) {
+ Free(up->ptr);
+ }
+ Free(up);
+ }
+ uh->busy = 0;
+ uh->alloc = 0;
+ init_unrhdr(uh, uh->low, uh->high, uh->mtx);
+
+ check_unrhdr(uh, __LINE__);
+}
+
static __inline int
is_bitmap(struct unrhdr *uh, struct unr *up)
{