diff options
author | eivind <eivind@FreeBSD.org> | 1999-01-08 17:31:30 +0000 |
---|---|---|
committer | eivind <eivind@FreeBSD.org> | 1999-01-08 17:31:30 +0000 |
commit | a8dc66f457be84eefbe16e70c901ceb11137ba65 (patch) | |
tree | e5747f527c552fa90334c779c047697b372582fb /sys/dev/snp | |
parent | 1c69824749ed0aa6efce159d39ab3f17fc9e25f2 (diff) | |
download | FreeBSD-src-a8dc66f457be84eefbe16e70c901ceb11137ba65.zip FreeBSD-src-a8dc66f457be84eefbe16e70c901ceb11137ba65.tar.gz |
Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT as
discussed on -hackers.
Introduce 'KASSERT(assertion, ("panic message", args))' for simple
check + panic.
Reviewed by: msmith
Diffstat (limited to 'sys/dev/snp')
-rw-r--r-- | sys/dev/snp/snp.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index c4b13e5..06f17dd 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -135,10 +135,8 @@ snpread(dev, uio, flag) caddr_t from; char *nbuf; -#ifdef DIAGNOSTIC - if ((snp->snp_len + snp->snp_base) > snp->snp_blen) - panic("snoop buffer error"); -#endif + KASSERT(snp->snp_len + snp->snp_base <= snp->snp_blen, + ("snoop buffer error")); if (snp->snp_tty == NULL) return (EIO); @@ -212,10 +210,9 @@ snpin(snp, buf, n) if (n == 0) return 0; -#ifdef DIAGNOSTIC - if (n < 0) - panic("bad snoop char count"); + KASSERT(n > 0, ("negative snoop char count")); +#ifdef DIAGNOSTIC if (!(snp->snp_flags & SNOOP_OPEN)) { printf("Snoop: data coming to closed device.\n"); return 0; |