summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-04-04 22:32:06 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-04-04 22:32:06 +0000
commitae76891557f91e9bbceae6f7989344637afc975d (patch)
treee5790ca024cb36eda45814ec79248855ad029b81 /sys/kern
parentfd3e92143e6710928ea87ab0297636357134d1ae (diff)
Make extent_print() use printf to avoid the pagination that db_printf
provides, while keeping this behaviour for extent_print_all() which is only called by ddb. Based on a diff from deraadt@.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_extent.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c
index 5ecfa1a52e9..1703d89fad6 100644
--- a/sys/kern/subr_extent.c
+++ b/sys/kern/subr_extent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_extent.c,v 1.34 2008/06/26 05:42:20 ray Exp $ */
+/* $OpenBSD: subr_extent.c,v 1.35 2009/04/04 22:32:05 kettenis Exp $ */
/* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */
/*-
@@ -68,6 +68,10 @@
#define splx(s) ((void)(s))
#endif
+#if defined(DIAGNOSTIC) || defined(DDB)
+void extent_print1(struct extent *, int (*)(const char *, ...));
+#endif
+
static void extent_insert_and_optimize(struct extent *, u_long, u_long,
struct extent_region *, struct extent_region *);
static struct extent_region *extent_alloc_region_descriptor(struct extent *, int);
@@ -142,7 +146,7 @@ extent_print_all(void)
struct extent *ep;
LIST_FOREACH(ep, &ext_list, ex_link) {
- extent_print(ep);
+ extent_print1(ep, db_printf);
}
}
#endif
@@ -1088,28 +1092,32 @@ extent_free_region_descriptor(struct extent *ex, struct extent_region *rp)
splx(s);
}
-#ifndef DDB
-#define db_printf printf
-#endif
-
+
#if defined(DIAGNOSTIC) || defined(DDB) || !defined(_KERNEL)
+
void
extent_print(struct extent *ex)
{
+ extent_print1(ex, printf);
+}
+
+void
+extent_print1(struct extent *ex, int (*pr)(const char *, ...))
+{
struct extent_region *rp;
if (ex == NULL)
panic("extent_print: NULL extent");
#ifdef _KERNEL
- db_printf("extent `%s' (0x%lx - 0x%lx), flags=%b\n", ex->ex_name,
+ (*pr)("extent `%s' (0x%lx - 0x%lx), flags=%b\n", ex->ex_name,
ex->ex_start, ex->ex_end, ex->ex_flags, EXF_BITS);
#else
- db_printf("extent `%s' (0x%lx - 0x%lx), flags = 0x%x\n", ex->ex_name,
+ (*pr)("extent `%s' (0x%lx - 0x%lx), flags = 0x%x\n", ex->ex_name,
ex->ex_start, ex->ex_end, ex->ex_flags);
#endif
LIST_FOREACH(rp, &ex->ex_regions, er_link)
- db_printf(" 0x%lx - 0x%lx\n", rp->er_start, rp->er_end);
+ (*pr)(" 0x%lx - 0x%lx\n", rp->er_start, rp->er_end);
}
#endif