The branch main has been updated by zlei:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1ba655149ed0447f93e997a60330d9b962d061f2

commit 1ba655149ed0447f93e997a60330d9b962d061f2
Author:     Zhenlei Huang <z...@freebsd.org>
AuthorDate: 2025-03-06 04:51:44 +0000
Commit:     Zhenlei Huang <z...@freebsd.org>
CommitDate: 2025-03-06 04:51:44 +0000

    if_clone: Use static initializers
    
    While here, remove vnet_if_clone_init() which is therefore an empty 
function.
    
    MFC after:      1 week
---
 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 ce0c3d5c0616..21e3b1a8576a 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -433,7 +433,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 13d89e4e2c59..066547ceeeb3 100644
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -128,7 +128,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)
@@ -183,13 +183,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 e11fc5c8cdd7..5a74ffa1cc2f 100644
--- a/sys/net/if_clone.h
+++ b/sys/net/if_clone.h
@@ -148,7 +148,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 *);

Reply via email to