From 8864544bcf0eb6baa94793b373780ec2d5d732c7 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 3 May 2000 17:45:04 +0000 Subject: 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(-) (limited to 'sys/kern') diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index de36141..ddd1e4f 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") -- cgit v1.1