aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPaul Richards <paul@FreeBSD.org>2000-05-03 17:45:04 +0000
committerPaul Richards <paul@FreeBSD.org>2000-05-03 17:45:04 +0000
commit8651b9ec1bac5c7f80d5f67e77402a418f1ccfbb (patch)
tree2c4a3689d633d8c94428889ad2eb106c7fc6daab /sys
parentac4a79b0fbf1cd1d3b6e56c747344e363d2b24f3 (diff)
downloadsrc-8651b9ec1bac5c7f80d5f67e77402a418f1ccfbb.tar.gz
src-8651b9ec1bac5c7f80d5f67e77402a418f1ccfbb.zip
If BUS_DEBUG is defined then create a sysctl, debug.bus_debug, that
is used to control whether the debug messages are output at runtime. It defaults to on so that if you define BUS_DEBUG in your kernel then you get all the debugging info when you boot. It's very useful for disabling all the debugging info when you're developing a loadable device driver and you're doing lots of loads and unloads but don't always want to see all the debugging info.
Notes
Notes: svn path=/head/; revision=59925
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_bus.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index de36141d57b3..ddd1e4f6b6b0 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -46,7 +46,12 @@
MALLOC_DEFINE(M_BUS, "bus", "Bus data structures");
#ifdef BUS_DEBUG
-#define PDEBUG(a) (printf(__FUNCTION__ ":%d: ", __LINE__), printf a, printf("\n"))
+#include <sys/sysctl.h>
+
+static int bus_debug = 1;
+SYSCTL_INT(_debug, OID_AUTO, bus_debug, CTLFLAG_RW, &bus_debug, 0, "Debug bus code");
+
+#define PDEBUG(a) if (bus_debug) {printf(__FUNCTION__ ":%d: ", __LINE__), printf a, printf("\n");}
#define DEVICENAME(d) ((d)? device_get_name(d): "no device")
#define DRIVERNAME(d) ((d)? d->name : "no driver")
#define DEVCLANAME(d) ((d)? d->name : "no devclass")