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
This commit is contained in:
Mateusz Guzik 2020-01-29 01:51:21 +00:00
parent 827bea2645
commit f0a747d129
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357237

View File

@ -107,16 +107,24 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
} 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
#ifndef CTASSERT /* Allow lint to override */