Author: bz
Date: Wed Oct 19 10:16:42 2011
New Revision: 226535
URL: http://svn.freebsd.org/changeset/base/226535

Log:
  Adjust the PF_ASSERT() macro to what we usually use in the network stack:
  PF_LOCK_ASSERT() and PF_UNLOCK_ASSERT().
  
  MFC after:    3 days

Modified:
  head/sys/contrib/pf/net/if_pfsync.c
  head/sys/contrib/pf/net/pf_ioctl.c
  head/sys/contrib/pf/net/pf_table.c
  head/sys/contrib/pf/net/pfvar.h

Modified: head/sys/contrib/pf/net/if_pfsync.c
==============================================================================
--- head/sys/contrib/pf/net/if_pfsync.c Wed Oct 19 10:09:01 2011        
(r226534)
+++ head/sys/contrib/pf/net/if_pfsync.c Wed Oct 19 10:16:42 2011        
(r226535)
@@ -2143,7 +2143,7 @@ pfsync_sendout(void)
        int q, count = 0;
 
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #else
        splassert(IPL_NET);
 #endif
@@ -2378,7 +2378,7 @@ pfsync_insert_state(struct pf_state *st)
 #endif
 
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #else
        splassert(IPL_SOFTNET);
 #endif
@@ -2430,7 +2430,7 @@ pfsync_defer(struct pf_state *st, struct
        struct pfsync_deferral *pd;
 
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #else
        splassert(IPL_SOFTNET);
 #endif
@@ -2477,7 +2477,7 @@ pfsync_undefer(struct pfsync_deferral *p
        int s;
 
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #else
        splassert(IPL_SOFTNET);
 #endif
@@ -2560,7 +2560,7 @@ pfsync_update_state(struct pf_state *st)
        int sync = 0;
 
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #else
        splassert(IPL_SOFTNET);
 #endif
@@ -2710,7 +2710,7 @@ pfsync_delete_state(struct pf_state *st)
 #endif
 
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #else
        splassert(IPL_SOFTNET);
 #endif
@@ -2771,7 +2771,7 @@ pfsync_clear_states(u_int32_t creatorid,
 #endif
 
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #else
        splassert(IPL_SOFTNET);
 #endif

Modified: head/sys/contrib/pf/net/pf_ioctl.c
==============================================================================
--- head/sys/contrib/pf/net/pf_ioctl.c  Wed Oct 19 10:09:01 2011        
(r226534)
+++ head/sys/contrib/pf/net/pf_ioctl.c  Wed Oct 19 10:16:42 2011        
(r226535)
@@ -4259,7 +4259,7 @@ hook_pf(void)
        struct pfil_head *pfh_inet6;
 #endif
 
-       PF_ASSERT(MA_NOTOWNED);
+       PF_UNLOCK_ASSERT();
 
        if (V_pf_pfil_hooked)
                return (0); 
@@ -4300,7 +4300,7 @@ dehook_pf(void)
        struct pfil_head *pfh_inet6;
 #endif
 
-       PF_ASSERT(MA_NOTOWNED);
+       PF_UNLOCK_ASSERT();
 
        if (V_pf_pfil_hooked == 0)
                return (0);

Modified: head/sys/contrib/pf/net/pf_table.c
==============================================================================
--- head/sys/contrib/pf/net/pf_table.c  Wed Oct 19 10:09:01 2011        
(r226534)
+++ head/sys/contrib/pf/net/pf_table.c  Wed Oct 19 10:16:42 2011        
(r226535)
@@ -906,7 +906,7 @@ pfr_lookup_addr(struct pfr_ktable *kt, s
                pfr_prepare_network(&mask, ad->pfra_af, ad->pfra_net);
                s = splsoftnet(); /* rn_lookup makes use of globals */
 #ifdef __FreeBSD__
-               PF_ASSERT(MA_OWNED);
+               PF_LOCK_ASSERT();
 #endif
                ke = (struct pfr_kentry *)rn_lookup(&sa, &mask, head);
                splx(s);
@@ -1127,7 +1127,7 @@ pfr_route_kentry(struct pfr_ktable *kt, 
 
        s = splsoftnet();
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #endif
        if (KENTRY_NETWORK(ke)) {
                pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);
@@ -1166,7 +1166,7 @@ pfr_unroute_kentry(struct pfr_ktable *kt
 
        s = splsoftnet();
 #ifdef __FreeBSD__
-       PF_ASSERT(MA_OWNED);
+       PF_LOCK_ASSERT();
 #endif
        if (KENTRY_NETWORK(ke)) {
                pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);

Modified: head/sys/contrib/pf/net/pfvar.h
==============================================================================
--- head/sys/contrib/pf/net/pfvar.h     Wed Oct 19 10:09:01 2011        
(r226534)
+++ head/sys/contrib/pf/net/pfvar.h     Wed Oct 19 10:16:42 2011        
(r226535)
@@ -240,18 +240,20 @@ struct pfi_dynaddr {
 VNET_DECLARE(struct mtx,        pf_task_mtx);
 #define        V_pf_task_mtx            VNET(pf_task_mtx)
 
-#define        PF_ASSERT(h)    mtx_assert(&V_pf_task_mtx, (h))
+#define        PF_LOCK_ASSERT()        mtx_assert(&V_pf_task_mtx, MA_OWNED)
+#define        PF_UNLOCK_ASSERT()      mtx_assert(&V_pf_task_mtx, MA_NOTOWNED)
 
 #define        PF_LOCK()       do {                            \
-       PF_ASSERT(MA_NOTOWNED);                         \
+       PF_UNLOCK_ASSERT();                             \
        mtx_lock(&V_pf_task_mtx);                       \
 } while(0)
 #define        PF_UNLOCK()     do {                            \
-       PF_ASSERT(MA_OWNED);                            \
+       PF_LOCK_ASSERT();                               \
        mtx_unlock(&V_pf_task_mtx);                     \
 } while(0)
 #else
-#define        PF_ASSERT(h)
+#define        PF_LOCK_ASSERT()
+#define        PF_UNLOCK_ASSERT()
 #define        PF_LOCK()
 #define        PF_UNLOCK()
 #endif /* __FreeBSD__ */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to