Skip to content

Commit

Permalink
Move MPASS() macros to systm.h. They are widely used all over
Browse files Browse the repository at this point in the history
the kernel and aren't contained only to the locking code.

Reviewed by:	kib, mjg
Differential Revision:	https://reviews.freebsd.org/D23656
  • Loading branch information
glebius committed Jun 8, 2020
1 parent 33bb3db commit 953171b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 0 additions & 10 deletions sys/sys/lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions sys/sys/systm.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
#include <sys/kpilite.h>
#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.
*
Expand Down

0 comments on commit 953171b

Please sign in to comment.