From 88a7dd376c33f59c9a5f94cdbce7994ff32aaef4 Mon Sep 17 00:00:00 2001 From: glebius Date: Mon, 8 Jun 2020 17:40:39 +0000 Subject: [PATCH] Move MPASS() macros to systm.h. They are widely used all over the kernel and aren't contained only to the locking code. Reviewed by: kib, mjg Differential Revision: https://reviews.freebsd.org/D23656 --- sys/sys/lock.h | 10 ---------- sys/sys/systm.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/sys/lock.h b/sys/sys/lock.h index e82ff7db4825..9dd4e642f320 100644 --- a/sys/sys/lock.h +++ b/sys/sys/lock.h @@ -162,16 +162,6 @@ struct lock_class { #define lock_initialized(lo) ((lo)->lo_flags & LO_INITIALIZED) -/* - * Helpful macros for quickly coming up with assertions with informative - * panic messages. - */ -#define MPASS(ex) MPASS4(ex, #ex, __FILE__, __LINE__) -#define MPASS2(ex, what) MPASS4(ex, what, __FILE__, __LINE__) -#define MPASS3(ex, file, line) MPASS4(ex, #ex, file, line) -#define MPASS4(ex, what, file, line) \ - KASSERT((ex), ("Assertion %s failed at %s:%d", what, file, line)) - extern struct lock_class lock_class_mtx_sleep; extern struct lock_class lock_class_mtx_spin; extern struct lock_class lock_class_sx; diff --git a/sys/sys/systm.h b/sys/sys/systm.h index a8322845d759..cadd3994dd9d 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -141,6 +141,16 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2); #include #endif +/* + * Helpful macros for quickly coming up with assertions with informative + * panic messages. + */ +#define MPASS(ex) MPASS4(ex, #ex, __FILE__, __LINE__) +#define MPASS2(ex, what) MPASS4(ex, what, __FILE__, __LINE__) +#define MPASS3(ex, file, line) MPASS4(ex, #ex, file, line) +#define MPASS4(ex, what, file, line) \ + KASSERT((ex), ("Assertion %s failed at %s:%d", what, file, line)) + /* * Assert that a pointer can be loaded from memory atomically. *