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:
parent
9880323a99
commit
24e1c6ae7d
@ -69,8 +69,6 @@ struct domain {
|
|||||||
int dom_family; /* AF_xxx */
|
int dom_family; /* AF_xxx */
|
||||||
char *dom_name;
|
char *dom_name;
|
||||||
int dom_flags;
|
int dom_flags;
|
||||||
void (*dom_init) /* initialize domain data structures */
|
|
||||||
(void);
|
|
||||||
int (*dom_probe)(void); /* check for support (optional) */
|
int (*dom_probe)(void); /* check for support (optional) */
|
||||||
void (*dom_destroy) /* cleanup structures / state */
|
void (*dom_destroy) /* cleanup structures / state */
|
||||||
(void);
|
(void);
|
||||||
|
@ -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_printf("dom_name: %s\n", d->dom_name);
|
||||||
|
|
||||||
db_print_indent(indent);
|
db_print_indent(indent);
|
||||||
db_printf("dom_init: %p ", d->dom_init);
|
|
||||||
db_printf("dom_externalize: %p ", d->dom_externalize);
|
db_printf("dom_externalize: %p ", d->dom_externalize);
|
||||||
db_printf("dom_dispose: %p\n", d->dom_dispose);
|
db_printf("dom_dispose: %p\n", d->dom_dispose);
|
||||||
|
|
||||||
|
@ -188,8 +188,6 @@ domain_init(void *arg)
|
|||||||
return;
|
return;
|
||||||
KASSERT((flags & DOMF_INITED) == 0 || !IS_DEFAULT_VNET(curvnet),
|
KASSERT((flags & DOMF_INITED) == 0 || !IS_DEFAULT_VNET(curvnet),
|
||||||
("Premature initialization of domain in non-default vnet"));
|
("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++) {
|
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
|
||||||
/*
|
/*
|
||||||
* Note that with VIMAGE enabled, domain_init() will be
|
* 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)
|
if ((atomic_load_acq_int(&dp->dom_flags) & DOMF_SUPPORTED) == 0)
|
||||||
return;
|
return;
|
||||||
if (dp->dom_destroy)
|
|
||||||
(*dp->dom_destroy)();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -303,7 +303,6 @@ static void unp_gc(__unused void *, int);
|
|||||||
static void unp_scan(struct mbuf *, void (*)(struct filedescent **, int));
|
static void unp_scan(struct mbuf *, void (*)(struct filedescent **, int));
|
||||||
static void unp_discard(struct file *);
|
static void unp_discard(struct file *);
|
||||||
static void unp_freerights(struct filedescent **, int);
|
static void unp_freerights(struct filedescent **, int);
|
||||||
static void unp_init(void);
|
|
||||||
static int unp_internalize(struct mbuf **, struct thread *);
|
static int unp_internalize(struct mbuf **, struct thread *);
|
||||||
static void unp_internalize_fp(struct file *);
|
static void unp_internalize_fp(struct file *);
|
||||||
static int unp_externalize(struct mbuf *, struct mbuf **, int);
|
static int unp_externalize(struct mbuf *, struct mbuf **, int);
|
||||||
@ -459,7 +458,6 @@ static struct protosw localsw[] = {
|
|||||||
static struct domain localdomain = {
|
static struct domain localdomain = {
|
||||||
.dom_family = AF_LOCAL,
|
.dom_family = AF_LOCAL,
|
||||||
.dom_name = "local",
|
.dom_name = "local",
|
||||||
.dom_init = unp_init,
|
|
||||||
.dom_externalize = unp_externalize,
|
.dom_externalize = unp_externalize,
|
||||||
.dom_dispose = unp_dispose,
|
.dom_dispose = unp_dispose,
|
||||||
.dom_protosw = localsw,
|
.dom_protosw = localsw,
|
||||||
@ -2148,15 +2146,10 @@ unp_zdtor(void *mem, int size __unused, void *arg __unused)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unp_init(void)
|
unp_init(void *arg __unused)
|
||||||
{
|
{
|
||||||
uma_dtor dtor;
|
uma_dtor dtor;
|
||||||
|
|
||||||
#ifdef VIMAGE
|
|
||||||
if (!IS_DEFAULT_VNET(curvnet))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef INVARIANTS
|
#ifdef INVARIANTS
|
||||||
dtor = unp_zdtor;
|
dtor = unp_zdtor;
|
||||||
#else
|
#else
|
||||||
@ -2177,6 +2170,7 @@ unp_init(void)
|
|||||||
UNP_LINK_LOCK_INIT();
|
UNP_LINK_LOCK_INIT();
|
||||||
UNP_DEFERRED_LOCK_INIT();
|
UNP_DEFERRED_LOCK_INIT();
|
||||||
}
|
}
|
||||||
|
SYSINIT(unp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, unp_init, NULL);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unp_internalize_cleanup_rights(struct mbuf *control)
|
unp_internalize_cleanup_rights(struct mbuf *control)
|
||||||
|
@ -1907,7 +1907,7 @@ sdp_zone_change(void *tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sdp_init(void)
|
sdp_init(void *arg __unused)
|
||||||
{
|
{
|
||||||
|
|
||||||
LIST_INIT(&sdp_list);
|
LIST_INIT(&sdp_list);
|
||||||
@ -1919,6 +1919,7 @@ sdp_init(void)
|
|||||||
rx_comp_wq = create_singlethread_workqueue("rx_comp_wq");
|
rx_comp_wq = create_singlethread_workqueue("rx_comp_wq");
|
||||||
ib_register_client(&sdp_client);
|
ib_register_client(&sdp_client);
|
||||||
}
|
}
|
||||||
|
SYSINIT(sdp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, sdp_init, NULL);
|
||||||
|
|
||||||
extern struct domain sdpdomain;
|
extern struct domain sdpdomain;
|
||||||
|
|
||||||
@ -1966,7 +1967,6 @@ struct protosw sdpsw[] = {
|
|||||||
struct domain sdpdomain = {
|
struct domain sdpdomain = {
|
||||||
.dom_family = AF_INET_SDP,
|
.dom_family = AF_INET_SDP,
|
||||||
.dom_name = "SDP",
|
.dom_name = "SDP",
|
||||||
.dom_init = sdp_init,
|
|
||||||
.dom_protosw = sdpsw,
|
.dom_protosw = sdpsw,
|
||||||
.dom_protoswNPROTOSW = &sdpsw[sizeof(sdpsw)/sizeof(sdpsw[0])],
|
.dom_protoswNPROTOSW = &sdpsw[sizeof(sdpsw)/sizeof(sdpsw[0])],
|
||||||
};
|
};
|
||||||
|
@ -51,11 +51,7 @@ struct domain {
|
|||||||
int dom_family; /* AF_xxx */
|
int dom_family; /* AF_xxx */
|
||||||
char *dom_name;
|
char *dom_name;
|
||||||
int dom_flags;
|
int dom_flags;
|
||||||
void (*dom_init) /* initialize domain data structures */
|
|
||||||
(void);
|
|
||||||
int (*dom_probe)(void); /* check for support (optional) */
|
int (*dom_probe)(void); /* check for support (optional) */
|
||||||
void (*dom_destroy) /* cleanup structures / state */
|
|
||||||
(void);
|
|
||||||
int (*dom_externalize) /* externalize access rights */
|
int (*dom_externalize) /* externalize access rights */
|
||||||
(struct mbuf *, struct mbuf **, int);
|
(struct mbuf *, struct mbuf **, int);
|
||||||
void (*dom_dispose) /* dispose of internalized rights */
|
void (*dom_dispose) /* dispose of internalized rights */
|
||||||
|
Loading…
Reference in New Issue
Block a user