git: 2ed4c9d94dc6 - stable/14 - if_clone: Use static initializers

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Thu, 13 Mar 2025 10:14:29 UTC
The branch stable/14 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=2ed4c9d94dc64a453908984942b9dadbbaa5536e

commit 2ed4c9d94dc64a453908984942b9dadbbaa5536e
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-03-06 04:51:44 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-03-13 10:13:50 +0000

    if_clone: Use static initializers
    
    While here, remove vnet_if_clone_init() which is therefore an empty function.
    
    MFC after:      1 week
    
    (cherry picked from commit 1ba655149ed0447f93e997a60330d9b962d061f2)
---
 sys/net/if.c       | 1 -
 sys/net/if_clone.c | 9 +--------
 sys/net/if_clone.h | 1 -
 3 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/sys/net/if.c b/sys/net/if.c
index 4bc626b2de75..cf8df9a05d86 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -435,7 +435,6 @@ vnet_if_init(const void *unused __unused)
 
 	CK_STAILQ_INIT(&V_ifnet);
 	CK_STAILQ_INIT(&V_ifg_head);
-	vnet_if_clone_init();
 }
 VNET_SYSINIT(vnet_if_init, SI_SUB_INIT_IF, SI_ORDER_SECOND, vnet_if_init,
     NULL);
diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c
index 50ebed285d28..9f0dc7cd9649 100644
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -130,7 +130,7 @@ static int ifc_advanced_create_wrapper(struct if_clone *ifc, char *name, size_t
 static struct mtx if_cloners_mtx;
 MTX_SYSINIT(if_cloners_lock, &if_cloners_mtx, "if_cloners lock", MTX_DEF);
 VNET_DEFINE_STATIC(int, if_cloners_count);
-VNET_DEFINE(LIST_HEAD(, if_clone), if_cloners);
+VNET_DEFINE(LIST_HEAD(, if_clone), if_cloners) = LIST_HEAD_INITIALIZER();
 
 #define	V_if_cloners_count	VNET(if_cloners_count)
 #define	V_if_cloners		VNET(if_cloners)
@@ -185,13 +185,6 @@ VNET_DEFINE(LIST_HEAD(, if_clone), if_cloners);
 
 static MALLOC_DEFINE(M_CLONE, "clone", "interface cloning framework");
 
-void
-vnet_if_clone_init(void)
-{
-
-	LIST_INIT(&V_if_cloners);
-}
-
 /*
  * Lookup and create a clone network interface.
  */
diff --git a/sys/net/if_clone.h b/sys/net/if_clone.h
index 86aa52c0ed25..8206af53a07b 100644
--- a/sys/net/if_clone.h
+++ b/sys/net/if_clone.h
@@ -150,7 +150,6 @@ typedef void (*if_clone_event_handler_t)(void *, struct if_clone *);
 EVENTHANDLER_DECLARE(if_clone_event, if_clone_event_handler_t);
 
 /* The below interfaces used only by net/if.c. */
-void	vnet_if_clone_init(void);
 int	if_clone_create(char *, size_t, caddr_t);
 int	if_clone_destroy(const char *);
 int	if_clone_list(struct if_clonereq *);