PERFORCE change 118263 for review

John Baldwin jhb at FreeBSD.org
Mon Apr 16 21:02:27 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=118263

Change 118263 by jhb at jhb_mutex on 2007/04/16 21:01:38

	Add "show rman" and "show allrman"

Affected files ...

.. //depot/projects/smpng/sys/kern/subr_rman.c#33 edit

Differences ...

==== //depot/projects/smpng/sys/kern/subr_rman.c#33 (text+ko) ====

@@ -55,6 +55,8 @@
  * permitted.
  */
 
+#include "opt_ddb.h"
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/kern/subr_rman.c,v 1.55 2007/02/23 22:53:56 scottl Exp $");
 
@@ -70,6 +72,10 @@
 #include <sys/rman.h>
 #include <sys/sysctl.h>
 
+#ifdef DDB
+#include <ddb/ddb.h>
+#endif
+
 /*
  * We use a linked list rather than a bitmap because we need to be able to
  * represent potentially huge objects (like all of a processor's physical
@@ -911,3 +917,47 @@
 
 SYSCTL_NODE(_hw_bus, OID_AUTO, rman, CTLFLAG_RD, sysctl_rman,
     "kernel resource manager");
+
+#ifdef DDB
+static void
+dump_rman(struct rman *rm)
+{
+	struct resource_i *r;
+	const char *devname;
+
+	if (db_pager_quit)
+		return;
+	db_printf("rman: %s\n", rm->rm_descr);
+	db_printf("    0x%lx-0x%lx (full range)\n", rm->rm_start, rm->rm_end);
+	TAILQ_FOREACH(r, &rm->rm_list, r_link) {
+		if (r->r_dev != NULL) {
+			devname = device_get_nameunit(r->r_dev);
+			if (devname == NULL)
+				devname = "nomatch";
+		} else
+			devname = NULL;
+		db_printf("    0x%lx-0x%lx ", r->r_start, r->r_end);
+		if (devname != NULL)
+			db_printf("(%s)\n", devname);
+		else
+			db_printf("----\n");
+		if (db_pager_quit)
+			return;
+	}
+}
+
+DB_SHOW_COMMAND(rman, db_show_rman)
+{
+
+	if (have_addr)
+		dump_rman((struct rman *)addr);
+}
+
+DB_SHOW_COMMAND(allrman, db_show_all_rman)
+{
+	struct rman *rm;
+
+	TAILQ_FOREACH(rm, &rman_head, rm_link)
+		dump_rman(rm);
+}
+#endif


More information about the p4-projects mailing list