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
This commit is contained in:
Gleb Smirnoff 2022-01-03 10:15:22 -08:00
parent 9880323a99
commit 24e1c6ae7d
6 changed files with 4 additions and 21 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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])],
};

View File

@ -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 */