The branch main has been updated by jhibbits:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7814374b7cd5d905583d4159f5f28b9970fcf5cd

commit 7814374b7cd5d905583d4159f5f28b9970fcf5cd
Author:     Justin Hibbits <[email protected]>
AuthorDate: 2023-04-07 19:13:53 +0000
Commit:     Justin Hibbits <[email protected]>
CommitDate: 2023-04-24 13:54:23 +0000

    IfAPI: Hide the macros that touch ifnet members
    
    Nothing should be directly touching the ifnet members, which are hidden
    in <net/if_private.h>, so hide them in the same header to avoid errors
    from users.
    
    Sponsored by:   Juniper Networks, Inc.
---
 sys/net/if_private.h | 17 +++++++++++++++++
 sys/net/if_var.h     | 17 -----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/sys/net/if_private.h b/sys/net/if_private.h
index 64ebf83f5850..8802b08c6a05 100644
--- a/sys/net/if_private.h
+++ b/sys/net/if_private.h
@@ -192,6 +192,23 @@ struct ifnet {
        int     if_ispare[4];           /* general use */
 };
 
+#define        IF_AFDATA_LOCK_INIT(ifp)        \
+       mtx_init(&(ifp)->if_afdata_lock, "if_afdata", NULL, MTX_DEF)
+
+#define        IF_AFDATA_WLOCK(ifp)    mtx_lock(&(ifp)->if_afdata_lock)
+#define        IF_AFDATA_WUNLOCK(ifp)  mtx_unlock(&(ifp)->if_afdata_lock)
+#define        IF_AFDATA_LOCK(ifp)     IF_AFDATA_WLOCK(ifp)
+#define        IF_AFDATA_UNLOCK(ifp)   IF_AFDATA_WUNLOCK(ifp)
+#define        IF_AFDATA_TRYLOCK(ifp)  mtx_trylock(&(ifp)->if_afdata_lock)
+#define        IF_AFDATA_DESTROY(ifp)  mtx_destroy(&(ifp)->if_afdata_lock)
+
+#define        IF_AFDATA_LOCK_ASSERT(ifp)      
MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ifp)->if_afdata_lock))
+#define        IF_AFDATA_WLOCK_ASSERT(ifp)     
mtx_assert(&(ifp)->if_afdata_lock, MA_OWNED)
+#define        IF_AFDATA_UNLOCK_ASSERT(ifp)    
mtx_assert(&(ifp)->if_afdata_lock, MA_NOTOWNED)
+
+#define IF_LLADDR(ifp)                                                 \
+    LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr))
+
 #endif /* _KERNEL */
 
 #endif /* _NET_IF_PRIVATE_H_ */
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index e21bf44516cc..98d65be2ef81 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -392,20 +392,6 @@ typedef void (*group_change_event_handler_t)(void *, const 
char *);
 EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t);
 #endif /* _SYS_EVENTHANDLER_H_ */
 
-#define        IF_AFDATA_LOCK_INIT(ifp)        \
-       mtx_init(&(ifp)->if_afdata_lock, "if_afdata", NULL, MTX_DEF)
-
-#define        IF_AFDATA_WLOCK(ifp)    mtx_lock(&(ifp)->if_afdata_lock)
-#define        IF_AFDATA_WUNLOCK(ifp)  mtx_unlock(&(ifp)->if_afdata_lock)
-#define        IF_AFDATA_LOCK(ifp)     IF_AFDATA_WLOCK(ifp)
-#define        IF_AFDATA_UNLOCK(ifp)   IF_AFDATA_WUNLOCK(ifp)
-#define        IF_AFDATA_TRYLOCK(ifp)  mtx_trylock(&(ifp)->if_afdata_lock)
-#define        IF_AFDATA_DESTROY(ifp)  mtx_destroy(&(ifp)->if_afdata_lock)
-
-#define        IF_AFDATA_LOCK_ASSERT(ifp)      
MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ifp)->if_afdata_lock))
-#define        IF_AFDATA_WLOCK_ASSERT(ifp)     
mtx_assert(&(ifp)->if_afdata_lock, MA_OWNED)
-#define        IF_AFDATA_UNLOCK_ASSERT(ifp)    
mtx_assert(&(ifp)->if_afdata_lock, MA_NOTOWNED)
-
 /*
  * 72 was chosen below because it is the size of a TCP/IP
  * header (40) + the minimum mss (32).
@@ -564,9 +550,6 @@ void        if_data_copy(struct ifnet *, struct if_data *);
 uint64_t if_get_counter_default(struct ifnet *, ift_counter);
 void   if_inc_counter(struct ifnet *, ift_counter, int64_t);
 
-#define IF_LLADDR(ifp)                                                 \
-    LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr))
-
 uint64_t if_setbaudrate(if_t ifp, uint64_t baudrate);
 uint64_t if_getbaudrate(const if_t ifp);
 int if_setcapabilities(if_t ifp, int capabilities);

Reply via email to