diff options
author | joerg <joerg@FreeBSD.org> | 2001-07-09 21:11:10 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 2001-07-09 21:11:10 +0000 |
commit | 58dee69a9b28866386c7b354697c2db0e709199c (patch) | |
tree | 32151dc561146ba69257292870b81cbc439745c2 /sys/isa/fd.c | |
parent | 8fea824b7cbaebf8418a6aa8bab0b6581c2f1ecc (diff) | |
download | FreeBSD-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/isa/fd.c')
-rw-r--r-- | sys/isa/fd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 09d19d7..c410c5a 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.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 |