From 8651b9ec1bac5c7f80d5f67e77402a418f1ccfbb Mon Sep 17 00:00:00 2001 From: Paul Richards Date: Wed, 3 May 2000 17:45:04 +0000 Subject: [PATCH] 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. --- sys/kern/subr_bus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index de36141d57b..ddd1e4f6b6b 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 + +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")