Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/systm.h
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
* and/or add to the VM_GUEST_VM type if specific VM functionality is | * and/or add to the VM_GUEST_VM type if specific VM functionality is | ||||
* ever implemented (e.g. vendor-specific paravirtualization features). | * ever implemented (e.g. vendor-specific paravirtualization features). | ||||
* Keep in sync with vm_guest_sysctl_names[]. | * Keep in sync with vm_guest_sysctl_names[]. | ||||
*/ | */ | ||||
enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV, | enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV, | ||||
VM_LAST }; | VM_LAST }; | ||||
#if defined(WITNESS) || defined(INVARIANTS) | #if defined(WITNESS) || defined(INVARIANTS) | ||||
void kassert_panic(const char *fmt, ...) __printflike(1, 2); | #define kassert_panic(format, ...) _kassert_panic(1, format, \ | ||||
## __VA_ARGS__) | |||||
#define kassert_warn(format, ...) _kassert_panic(0, format, \ | |||||
## __VA_ARGS__) | |||||
void _kassert_panic(int fatal, const char *fmt, ...) __printflike(2, 3); | |||||
#endif | #endif | ||||
#ifdef INVARIANTS /* The option is always available */ | #ifdef INVARIANTS /* The option is always available */ | ||||
#define KASSERT(exp,msg) do { \ | #define KASSERT(exp,msg) do { \ | ||||
if (__predict_false(!(exp))) \ | if (__predict_false(!(exp))) \ | ||||
kassert_panic msg; \ | kassert_panic msg; \ | ||||
} while (0) | } while (0) | ||||
#define KASSERT_WARN(exp,msg) do { \ | |||||
ngie: Existing style(9) bugs in the macro with a space missing between exp and msg? | |||||
if (__predict_false(!(exp))) \ | |||||
kassert_warn msg; \ | |||||
} while (0) | |||||
#define VNASSERT(exp, vp, msg) do { \ | #define VNASSERT(exp, vp, msg) do { \ | ||||
if (__predict_false(!(exp))) { \ | if (__predict_false(!(exp))) { \ | ||||
vn_printf(vp, "VNASSERT failed\n"); \ | vn_printf(vp, "VNASSERT failed\n"); \ | ||||
kassert_panic msg; \ | kassert_panic msg; \ | ||||
} \ | } \ | ||||
} while (0) | } while (0) | ||||
#else | #else | ||||
#define KASSERT(exp,msg) do { \ | #define KASSERT(exp,msg) do { \ | ||||
} while (0) | |||||
#define KASSERT_WARN(exp,msg) do { \ | |||||
} while (0) | } while (0) | ||||
#define VNASSERT(exp, vp, msg) do { \ | #define VNASSERT(exp, vp, msg) do { \ | ||||
} while (0) | } while (0) | ||||
#endif | #endif | ||||
#ifndef CTASSERT /* Allow lint to override */ | #ifndef CTASSERT /* Allow lint to override */ | ||||
#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") | #define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") | ||||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |
Existing style(9) bugs in the macro with a space missing between exp and msg?