Module Name:    src
Committed By:   riastradh
Date:           Sat Dec 14 16:58:38 UTC 2019

Modified Files:
        src/sys/dev: cgd.c cgd_crypto.c

Log Message:
Just use KASSERTMSG and panic.  No need for custom wrappers.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/cgd.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/cgd_crypto.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/cgd.c
diff -u src/sys/dev/cgd.c:1.117 src/sys/dev/cgd.c:1.118
--- src/sys/dev/cgd.c:1.117	Sun Dec  8 12:14:40 2019
+++ src/sys/dev/cgd.c	Sat Dec 14 16:58:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.117 2019/12/08 12:14:40 mlelstv Exp $ */
+/* $NetBSD: cgd.c,v 1.118 2019/12/14 16:58:38 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.117 2019/12/08 12:14:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.118 2019/12/14 16:58:38 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -262,14 +262,6 @@ static void	hexprint(const char *, void 
 #define DPRINTF_FOLLOW(y)
 #endif
 
-#ifdef DIAGNOSTIC
-#define DIAGPANIC(x)		panic x
-#define DIAGCONDPANIC(x,y)	if (x) panic y
-#else
-#define DIAGPANIC(x)
-#define DIAGCONDPANIC(x,y)
-#endif
-
 /* Global variables */
 
 /* Utility Functions */
@@ -1047,15 +1039,15 @@ cgd_cipher(struct cgd_softc *cs, void *d
 
 	DPRINTF_FOLLOW(("cgd_cipher() dir=%d\n", dir));
 
-	DIAGCONDPANIC(len % blocksize != 0,
-	    ("cgd_cipher: len %% blocksize != 0"));
+	KASSERTMSG(len % blocksize == 0,
+	    "cgd_cipher: len %% blocksize != 0");
 
 	/* ensure that sizeof(daddr_t) <= blocksize (for encblkno IVing) */
-	DIAGCONDPANIC(sizeof(daddr_t) > blocksize,
-	    ("cgd_cipher: sizeof(daddr_t) > blocksize"));
+	KASSERTMSG(sizeof(daddr_t) <= blocksize,
+	    "cgd_cipher: sizeof(daddr_t) > blocksize");
 
-	DIAGCONDPANIC(blocksize > CGD_MAXBLOCKSIZE,
-	    ("cgd_cipher: blocksize > CGD_MAXBLOCKSIZE"));
+	KASSERTMSG(blocksize <= CGD_MAXBLOCKSIZE,
+	    "cgd_cipher: blocksize > CGD_MAXBLOCKSIZE");
 
 	dstuio.uio_iov = dstiov;
 	dstuio.uio_iovcnt = 1;
@@ -1098,7 +1090,7 @@ hexprint(const char *start, void *buf, i
 {
 	char	*c = buf;
 
-	DIAGCONDPANIC(len < 0, ("hexprint: called with len < 0"));
+	KASSERTMSG(len >= 0, "hexprint: called with len < 0");
 	printf("%s: len=%06d 0x", start, len);
 	while (len--)
 		printf("%02x", (unsigned char) *c++);

Index: src/sys/dev/cgd_crypto.c
diff -u src/sys/dev/cgd_crypto.c:1.16 src/sys/dev/cgd_crypto.c:1.17
--- src/sys/dev/cgd_crypto.c:1.16	Thu Sep 26 11:47:38 2019
+++ src/sys/dev/cgd_crypto.c	Sat Dec 14 16:58:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd_crypto.c,v 1.16 2019/09/26 11:47:38 gutteridge Exp $ */
+/* $NetBSD: cgd_crypto.c,v 1.17 2019/12/14 16:58:38 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd_crypto.c,v 1.16 2019/09/26 11:47:38 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd_crypto.c,v 1.17 2019/12/14 16:58:38 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -49,12 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: cgd_crypto.c
 #include <crypto/des/des.h>
 #include <crypto/blowfish/blowfish.h>
 
-#ifdef DIAGNOSTIC
-#define DIAGPANIC(x)	panic x
-#else
-#define DIAGPANIC(x)
-#endif
-
 /*
  * The general framework provides only one generic function.
  * It takes the name of an algorithm and returns a struct cryptfuncs *
@@ -296,7 +290,7 @@ cgd_cipher_aes_cbc(void *privdata, struc
 		cgd_cipher_uio(&encd, aes_cbc_dec_int, dstuio, srcuio);
 		break;
 	default:
-		DIAGPANIC(("%s: unrecognised direction %d", __func__, dir));
+		panic("%s: unrecognised direction %d", __func__, dir);
 	}
 }
 
@@ -396,7 +390,7 @@ cgd_cipher_aes_xts(void *privdata, struc
 		cgd_cipher_uio(&encd, aes_xts_dec_int, dstuio, srcuio);
 		break;
 	default:
-		DIAGPANIC(("%s: unrecognised direction %d", __func__, dir));
+		panic("%s: unrecognised direction %d", __func__, dir);
 	}
 }
 
@@ -511,7 +505,7 @@ cgd_cipher_3des_cbc(void *privdata, stru
 		cgd_cipher_uio(&ce, c3des_cbc_dec_int, dstuio, srcuio);
 		break;
 	default:
-		DIAGPANIC(("%s: unrecognised direction %d", __func__, dir));
+		panic("%s: unrecognised direction %d", __func__, dir);
 	}
 }
 
@@ -609,7 +603,7 @@ cgd_cipher_bf_cbc(void *privdata, struct
 		cgd_cipher_uio(&be, bf_cbc_dec_int, dstuio, srcuio);
 		break;
 	default:
-		DIAGPANIC(("%s: unrecognised direction %d", __func__, dir));
+		panic("%s: unrecognised direction %d", __func__, dir);
 	}
 
 }

Reply via email to