Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jan 2020 01:51:22 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357237 - head/sys/sys
Message-ID:  <202001290151.00T1pMHu085400@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001290151.00T1pMHu085400>