Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168926098
D21784.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D21784.id.diff
View Options
Index: sys/sys/mbuf.h
===================================================================
--- sys/sys/mbuf.h
+++ sys/sys/mbuf.h
@@ -1043,12 +1043,9 @@
static __inline void
m_align(struct mbuf *m, int len)
{
-#ifdef INVARIANTS
- const char *msg = "%s: not a virgin mbuf";
-#endif
int adjust;
- KASSERT(m->m_data == M_START(m), (msg, __func__));
+ KASSERT(m->m_data == M_START(m), ("%s: not a virgin mbuf", __func__));
adjust = M_SIZE(m) - len;
m->m_data += adjust &~ (sizeof(long)-1);
Index: sys/sys/systm.h
===================================================================
--- sys/sys/systm.h
+++ sys/sys/systm.h
@@ -98,15 +98,26 @@
#endif
#endif
-#ifdef INVARIANTS /* The option is always available */
-#define KASSERT(exp,msg) do { \
+#ifdef INVARIANTS
+#define _KASSERT_ESC(...) __VA_ARGS__
+#define _CAR_(first, ...) first
+#define _CAR(args) _CAR_(args)
+#define _CDR_(first, ...) , ##__VA_ARGS__
+#define _CDR(args) _CDR_(args)
+
+#define _KASSERT(fmt, ...) \
+ kassert_panic("%s: " fmt, __VA_ARGS__)
+
+#define KASSERT(exp, msg) do { \
if (__predict_false(!(exp))) \
- kassert_panic msg; \
+ _KASSERT(_CAR(_KASSERT_ESC msg), __func__ \
+ _CDR(_KASSERT_ESC msg)); \
} while (0)
#define VNASSERT(exp, vp, msg) do { \
if (__predict_false(!(exp))) { \
vn_printf(vp, "VNASSERT failed\n"); \
- kassert_panic msg; \
+ _KASSERT(_CAR(_KASSERT_ESC msg), __func__ \
+ _CDR(_KASSERT_ESC msg)); \
} \
} while (0)
#else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 31, 7:17 PM (33 m, 39 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37713501
Default Alt Text
D21784.id.diff (1 KB)
Attached To
Mode
D21784: A terrible hack that causes KASSERT to prepend the function name.
Attached
Detach File
Event Timeline
Log In to Comment