summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>2001-07-09 21:11:10 +0000
committerjoerg <joerg@FreeBSD.org>2001-07-09 21:11:10 +0000
commit58dee69a9b28866386c7b354697c2db0e709199c (patch)
tree32151dc561146ba69257292870b81cbc439745c2 /sys/dev
parent8fea824b7cbaebf8418a6aa8bab0b6581c2f1ecc (diff)
downloadFreeBSD-src-58dee69a9b28866386c7b354697c2db0e709199c.zip
FreeBSD-src-58dee69a9b28866386c7b354697c2db0e709199c.tar.gz
Log when the user is turning debugging on/off.
Also sanitize the TRACE* macros a bit so they syntactically behave like single C statements (even inside in `if' statement). Submitted by: des
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/fdc/fdc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 09d19d7..c410c5a 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -252,11 +252,11 @@ static char const * const fdstates[] =
/* CAUTION: fd_debug causes huge amounts of logging output */
static int volatile fd_debug = 0;
-#define TRACE0(arg) if(fd_debug) printf(arg)
-#define TRACE1(arg1, arg2) if(fd_debug) printf(arg1, arg2)
+#define TRACE0(arg) do { if (fd_debug) printf(arg); } while (0)
+#define TRACE1(arg1, arg2) do { if (fd_debug) printf(arg1, arg2); } while (0)
#else /* FDC_DEBUG */
-#define TRACE0(arg)
-#define TRACE1(arg1, arg2)
+#define TRACE0(arg) do { } while (0)
+#define TRACE1(arg1, arg2) do { } while (0)
#endif /* FDC_DEBUG */
static void
@@ -2413,7 +2413,11 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
#ifdef FDC_DEBUG
case FD_DEBUG:
- fd_debug = *(int *)addr;
+ if ((fd_debug != 0) != (*(int *)addr != 0)) {
+ fd_debug = (*(int *)addr != 0);
+ printf("fd%d: debugging turned %s\n",
+ fd->fdu, fd_debug ? "on" : "off");
+ }
break;
#endif
OpenPOWER on IntegriCloud