Index: sys/sys/systm.h =================================================================== --- sys/sys/systm.h +++ sys/sys/systm.h @@ -100,11 +100,30 @@ #endif #endif +#ifndef __FILE_NAME__ +#define __FILE_NAME__ __FILE__ +#endif + #ifdef INVARIANTS /* The option is always available */ #define KASSERT(exp,msg) do { \ if (__predict_false(!(exp))) \ kassert_panic msg; \ } while (0) +#define KPASS(exp) do { \ + if (__predict_false(!(exp))) \ + kassert_panic("condition %s false at %s (%s:%d)", #exp, \ + __func__, __FILE_NAME__, __LINE__); \ +} while (0) +#define KPASS2(exp,str) do { \ + if (__predict_false(!(exp))) \ + kassert_panic("condition %s false at %s (%s:%d): %s", #exp,\ + __func__, __FILE_NAME__, __LINE__, str); \ +} while (0) +#define KPASS3(exp,fmt,fmtarg) do { \ + if (__predict_false(!(exp))) \ + kassert_panic("condition %s false at %s (%s:%d): " #fmt,\ + #exp, __func__, __FILE_NAME__, __LINE__, fmtarg); \ +} while (0) #define VNASSERT(exp, vp, msg) do { \ if (__predict_false(!(exp))) { \ vn_printf(vp, "VNASSERT failed: %s not true at %s:%d (%s)\n",\ @@ -120,6 +139,12 @@ #else #define KASSERT(exp,msg) do { \ } while (0) +#define KPASS(exp) do { \ +} while (0) +#define KPASS2(exp,str) do { \ +} while (0) +#define KPASS3(exp,fmt,fmtarg) do { \ +} while (0) #define VNASSERT(exp, vp, msg) do { \ } while (0)