svn commit: r361931 - head/sys/sys

Gleb Smirnoff glebius at FreeBSD.org
Mon Jun 8 17:40:40 UTC 2020


Author: glebius
Date: Mon Jun  8 17:40:39 2020
New Revision: 361931
URL: https://svnweb.freebsd.org/changeset/base/361931

Log:
  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

Modified:
  head/sys/sys/lock.h
  head/sys/sys/systm.h

Modified: head/sys/sys/lock.h
==============================================================================
--- head/sys/sys/lock.h	Mon Jun  8 16:11:44 2020	(r361930)
+++ head/sys/sys/lock.h	Mon Jun  8 17:40:39 2020	(r361931)
@@ -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;

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Mon Jun  8 16:11:44 2020	(r361930)
+++ head/sys/sys/systm.h	Mon Jun  8 17:40:39 2020	(r361931)
@@ -142,6 +142,16 @@ void	kassert_panic(const char *fmt, ...)  __printflike
 #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.
  *
  * This assertion enforces stronger alignment than necessary.  For example,


More information about the svn-src-all mailing list