svn commit: r357237 - head/sys/sys

Mateusz Guzik mjg at FreeBSD.org
Wed Jan 29 01:51:22 UTC 2020


Author: mjg
Date: Wed Jan 29 01:51:21 2020
New Revision: 357237
URL: https://svnweb.freebsd.org/changeset/base/357237

Log:
  vfs: add VNPASS macro and augment VNASSERT to print more about the assert
  
  Sample out put now instead of mere VNASSERT failed:
  VNASSERT failed: vp->v_holdcnt == 1234 not true at /usr/src/sys/kern/vfs_subr.c:3148 (vputx)
  
  Reviewed by:	kib
  Differential Revision:	https://reviews.freebsd.org/D23396

Modified:
  head/sys/sys/systm.h

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Wed Jan 29 00:28:50 2020	(r357236)
+++ head/sys/sys/systm.h	Wed Jan 29 01:51:21 2020	(r357237)
@@ -107,15 +107,23 @@ void	kassert_panic(const char *fmt, ...)  __printflike
 } while (0)
 #define	VNASSERT(exp, vp, msg) do {					\
 	if (__predict_false(!(exp))) {					\
-		vn_printf(vp, "VNASSERT failed\n");			\
+		vn_printf(vp, "VNASSERT failed: %s not true at %s:%d (%s)\n",\
+		   #exp, __FILE__, __LINE__, __func__);	 		\
 		kassert_panic msg;					\
 	}								\
 } while (0)
+#define	VNPASS(exp, vp)	do {						\
+	const char *_exp = #exp;					\
+	VNASSERT(exp, vp, ("condition %s not met at %s:%d (%s)",	\
+	    _exp, __FILE__, __LINE__, __func__));			\
+} while (0)
 #else
 #define	KASSERT(exp,msg) do { \
 } while (0)
 
 #define	VNASSERT(exp, vp, msg) do { \
+} while (0)
+#define	VNPASS(exp, vp) do { \
 } while (0)
 #endif
 


More information about the svn-src-all mailing list