git: 5e0dbbc238e2 - main - if_vxlan(4): Use static initializers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Jan 2025 09:38:46 UTC
The branch main has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=5e0dbbc238e2e935c68e293314a90f2ce6e6ef16
commit 5e0dbbc238e2e935c68e293314a90f2ce6e6ef16
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-01-24 09:37:24 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-01-24 09:37:24 +0000
if_vxlan(4): Use static initializers
MFC after: 1 week
---
sys/net/if_vxlan.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index b7af304e3126..58285c632771 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -419,7 +419,8 @@ static struct mtx vxlan_list_mtx;
#define VXLAN_LIST_LOCK() mtx_lock(&vxlan_list_mtx)
#define VXLAN_LIST_UNLOCK() mtx_unlock(&vxlan_list_mtx)
-static LIST_HEAD(, vxlan_socket) vxlan_socket_list;
+static LIST_HEAD(, vxlan_socket) vxlan_socket_list =
+ LIST_HEAD_INITIALIZER(vxlan_socket_list);
static eventhandler_tag vxlan_ifdetach_event_tag;
@@ -3609,12 +3610,10 @@ vxlan_tunable_int(struct vxlan_softc *sc, const char *knob, int def)
static void
vxlan_ifdetach_event(void *arg __unused, struct ifnet *ifp)
{
- struct vxlan_softc_head list;
+ struct vxlan_softc_head list = LIST_HEAD_INITIALIZER(list);
struct vxlan_socket *vso;
struct vxlan_softc *sc, *tsc;
- LIST_INIT(&list);
-
if (ifp->if_flags & IFF_RENAMING)
return;
if ((ifp->if_flags & IFF_MULTICAST) == 0)
@@ -3642,7 +3641,6 @@ vxlan_load(void)
{
mtx_init(&vxlan_list_mtx, "vxlan list", NULL, MTX_DEF);
- LIST_INIT(&vxlan_socket_list);
vxlan_ifdetach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event,
vxlan_ifdetach_event, NULL, EVENTHANDLER_PRI_ANY);