diff options
| author | Roman Kurakin <rik@FreeBSD.org> | 2008-06-30 21:18:27 +0000 |
|---|---|---|
| committer | Roman Kurakin <rik@FreeBSD.org> | 2008-06-30 21:18:27 +0000 |
| commit | 259edd28004b03c4ea35891a5f2a8728adbd23ac (patch) | |
| tree | fc0d5f8df2864c985a23cc83800e237fc998a308 /sys/dev/cp | |
| parent | 2a61d63038c56cc5f103ff3a3fa4146480c32c92 (diff) | |
Notes
Diffstat (limited to 'sys/dev/cp')
| -rw-r--r-- | sys/dev/cp/cpddk.h | 1 | ||||
| -rw-r--r-- | sys/dev/cp/if_cp.c | 19 |
2 files changed, 13 insertions, 7 deletions
diff --git a/sys/dev/cp/cpddk.h b/sys/dev/cp/cpddk.h index 3ff40bbd68d1..fcdb0d021f3a 100644 --- a/sys/dev/cp/cpddk.h +++ b/sys/dev/cp/cpddk.h @@ -205,6 +205,7 @@ typedef struct _cp_chan_t { void *tag [NTBUF]; /* system dependent data per buffer */ void *sys; /* system dependent data per channel */ unsigned char debug; /* debug level, 0..2 */ + unsigned char debug_shadow; /* debug shadow */ void (*transmit) (struct _cp_chan_t *c, void *tag, int len); void (*receive) (struct _cp_chan_t *c, unsigned char *data, int len); diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c index dbe40bc5bac0..36b12abbf704 100644 --- a/sys/dev/cp/if_cp.c +++ b/sys/dev/cp/if_cp.c @@ -733,8 +733,8 @@ static int cp_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data) if (! (ifp->if_flags & IFF_DEBUG)) d->chan->debug = 0; - else if (! d->chan->debug) - d->chan->debug = 1; + else + d->chan->debug = d->chan->debug_shadow; switch (cmd) { default: CP_DEBUG2 (d, ("ioctl 0x%lx\n", cmd)); return 0; @@ -1349,12 +1349,17 @@ static int cp_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struc error = priv_check (td, PRIV_DRIVER); if (error) return error; - d->chan->debug = *(int*)data; #ifndef NETGRAPH - if (d->chan->debug) - d->ifp->if_flags |= IFF_DEBUG; - else - d->ifp->if_flags &= ~IFF_DEBUG; + /* + * The debug_shadow is always greater than zero for logic + * simplicity. For switching debug off the IFF_DEBUG is + * responsible. + */ + d->chan->debug_shadow = (*(int*)data) ? (*(int*)data) : 1; + if (d->ifp->if_flags & IFF_DEBUG) + d->chan->debug = d->chan->debug_shadow; +#else + d->chan->debug = *(int*)data; #endif return 0; |
