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.
This commit is contained in:
Paul Richards 2000-05-03 17:45:04 +00:00
parent ac4a79b0fb
commit 8651b9ec1b

View File

@ -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")