Hello,

with moving towards NET_RLOCK...() shall we add an explicit
assert to state caller owns netlock exclusively? I propose
to introduce NET_ASSERT_WLOCKED()

        NET_ASSERT_WLOCKED()

thanks and
regards
sashan

--------8<---------------8<---------------8<------------------8<--------
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index a26d7f98f21..2dc9d3274fa 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -361,9 +361,17 @@ do {                                                       
                \
                splassert_fail(RW_READ, _s, __func__);                  \
 } while (0)
 
+#define        NET_ASSERT_WLOCKED()                                            
\
+do {                                                                   \
+       int _s = rw_status(&netlock);                                   \
+       if ((splassert_ctl > 0) && (_s != RW_WRITE))                    \
+               splassert_fail(RW_WRITE, _s, __func__);                 \
+} while (0)
+
 #else /* DIAGNOSTIC */
 #define        NET_ASSERT_UNLOCKED()   do {} while (0)
 #define        NET_ASSERT_LOCKED()     do {} while (0)
+#define        NET_ASSERT_WLOCKED()    do {} while (0)
 #endif /* !DIAGNOSTIC */
 
 __returns_twice int    setjmp(label_t *);

Reply via email to