vfs_lookup.c: only call ktrcapfail() if KTRACE is enabled

Reviewed by:	emaste, imp, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44931
This commit is contained in:
Konstantin Belousov 2024-04-24 22:06:14 +03:00
parent 66df81021e
commit 6b0cf2a237

View file

@ -86,8 +86,14 @@ static void NDVALIDATE_impl(struct nameidata *, int);
ndp->ni_cnd.cn_flags |= ISRESTARTED; \
} while (0)
#ifdef KTRACE
#define NIKTRCAPFAIL(path) ktrcapfail(CAPFAIL_NAMEI, (path))
#else
#define NIKTRCAPFAIL(path)
#endif
#define NI_CAP_VIOLATION(ndp, path) do { \
ktrcapfail(CAPFAIL_NAMEI, (path)); \
NIKTRCAPFAIL(path); \
(ndp)->ni_lcf &= ~NI_LCF_KTR_FLAGS; \
} while (0)