git: 24e1c6ae7d3f - main - domains: init with standard SYSINIT(9) or VNET_SYSINIT()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Jan 2022 18:22:56 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=24e1c6ae7d3f7731a0884a62e9d5273e5ca1335a commit 24e1c6ae7d3f7731a0884a62e9d5273e5ca1335a Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-01-03 18:15:22 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2022-01-03 18:15:22 +0000 domains: init with standard SYSINIT(9) or VNET_SYSINIT() There left only three modules that used dom_init(). And netipsec was the last one to use dom_destroy(). Differential revision: https://reviews.freebsd.org/D33540 --- share/man/man9/domain.9 | 2 -- sys/kern/uipc_debug.c | 1 - sys/kern/uipc_domain.c | 4 ---- sys/kern/uipc_usrreq.c | 10 ++-------- sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 4 ++-- sys/sys/domain.h | 4 ---- 6 files changed, 4 insertions(+), 21 deletions(-) diff --git a/share/man/man9/domain.9 b/share/man/man9/domain.9 index 867cfa104718..2fc0fd328392 100644 --- a/share/man/man9/domain.9 +++ b/share/man/man9/domain.9 @@ -69,8 +69,6 @@ struct domain { int dom_family; /* AF_xxx */ char *dom_name; int dom_flags; - void (*dom_init) /* initialize domain data structures */ - (void); int (*dom_probe)(void); /* check for support (optional) */ void (*dom_destroy) /* cleanup structures / state */ (void); diff --git a/sys/kern/uipc_debug.c b/sys/kern/uipc_debug.c index 86c3199a3c26..2f60bb64ed3b 100644 --- a/sys/kern/uipc_debug.c +++ b/sys/kern/uipc_debug.c @@ -251,7 +251,6 @@ db_print_domain(struct domain *d, const char *domain_name, int indent) db_printf("dom_name: %s\n", d->dom_name); db_print_indent(indent); - db_printf("dom_init: %p ", d->dom_init); db_printf("dom_externalize: %p ", d->dom_externalize); db_printf("dom_dispose: %p\n", d->dom_dispose); diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index da21ed29a716..832db9f6e667 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -188,8 +188,6 @@ domain_init(void *arg) return; KASSERT((flags & DOMF_INITED) == 0 || !IS_DEFAULT_VNET(curvnet), ("Premature initialization of domain in non-default vnet")); - if (dp->dom_init) - (*dp->dom_init)(); for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { /* * Note that with VIMAGE enabled, domain_init() will be @@ -237,8 +235,6 @@ vnet_domain_uninit(void *arg) if ((atomic_load_acq_int(&dp->dom_flags) & DOMF_SUPPORTED) == 0) return; - if (dp->dom_destroy) - (*dp->dom_destroy)(); } #endif diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index ceeb4741e3f4..89d4198652c3 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -303,7 +303,6 @@ static void unp_gc(__unused void *, int); static void unp_scan(struct mbuf *, void (*)(struct filedescent **, int)); static void unp_discard(struct file *); static void unp_freerights(struct filedescent **, int); -static void unp_init(void); static int unp_internalize(struct mbuf **, struct thread *); static void unp_internalize_fp(struct file *); static int unp_externalize(struct mbuf *, struct mbuf **, int); @@ -459,7 +458,6 @@ static struct protosw localsw[] = { static struct domain localdomain = { .dom_family = AF_LOCAL, .dom_name = "local", - .dom_init = unp_init, .dom_externalize = unp_externalize, .dom_dispose = unp_dispose, .dom_protosw = localsw, @@ -2148,15 +2146,10 @@ unp_zdtor(void *mem, int size __unused, void *arg __unused) #endif static void -unp_init(void) +unp_init(void *arg __unused) { uma_dtor dtor; -#ifdef VIMAGE - if (!IS_DEFAULT_VNET(curvnet)) - return; -#endif - #ifdef INVARIANTS dtor = unp_zdtor; #else @@ -2177,6 +2170,7 @@ unp_init(void) UNP_LINK_LOCK_INIT(); UNP_DEFERRED_LOCK_INIT(); } +SYSINIT(unp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, unp_init, NULL); static void unp_internalize_cleanup_rights(struct mbuf *control) diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index 973372b21761..c822276185cb 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -1907,7 +1907,7 @@ sdp_zone_change(void *tag) } static void -sdp_init(void) +sdp_init(void *arg __unused) { LIST_INIT(&sdp_list); @@ -1919,6 +1919,7 @@ sdp_init(void) rx_comp_wq = create_singlethread_workqueue("rx_comp_wq"); ib_register_client(&sdp_client); } +SYSINIT(sdp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, sdp_init, NULL); extern struct domain sdpdomain; @@ -1966,7 +1967,6 @@ struct protosw sdpsw[] = { struct domain sdpdomain = { .dom_family = AF_INET_SDP, .dom_name = "SDP", - .dom_init = sdp_init, .dom_protosw = sdpsw, .dom_protoswNPROTOSW = &sdpsw[sizeof(sdpsw)/sizeof(sdpsw[0])], }; diff --git a/sys/sys/domain.h b/sys/sys/domain.h index dc09c9786443..c9defe8e4341 100644 --- a/sys/sys/domain.h +++ b/sys/sys/domain.h @@ -51,11 +51,7 @@ struct domain { int dom_family; /* AF_xxx */ char *dom_name; int dom_flags; - void (*dom_init) /* initialize domain data structures */ - (void); int (*dom_probe)(void); /* check for support (optional) */ - void (*dom_destroy) /* cleanup structures / state */ - (void); int (*dom_externalize) /* externalize access rights */ (struct mbuf *, struct mbuf **, int); void (*dom_dispose) /* dispose of internalized rights */