aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hyperv
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2022-01-03 18:15:21 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2022-01-03 18:15:21 +0000
commit89128ff3e42196c8b41a3c59f7a2d95c0a4ac0ee (patch)
tree921bc14d71bf9b066da7f1ecc32e3e942809731d /sys/dev/hyperv
parent321e586e46115c69e7e833d592703d997a4ec477 (diff)
downloadsrc-89128ff3e42196c8b41a3c59f7a2d95c0a4ac0ee.tar.gz
src-89128ff3e42196c8b41a3c59f7a2d95c0a4ac0ee.zip
protocols: init with standard SYSINIT(9) or VNET_SYSINIT
The historical BSD network stack loop that rolls over domains and over protocols has no advantages over more modern SYSINIT(9). While doing the sweep, split global and per-VNET initializers. Getting rid of pr_init allows to achieve several things: o Get rid of ifdef's that protect against double foo_init() when both INET and INET6 are compiled in. o Isolate initializers statically to the module they init. o Makes code easier to understand and maintain. Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D33537
Diffstat (limited to 'sys/dev/hyperv')
-rw-r--r--sys/dev/hyperv/hvsock/hv_sock.c10
-rw-r--r--sys/dev/hyperv/hvsock/hv_sock.h1
2 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c
index 6d5ad4fc6609..b2a84befafa2 100644
--- a/sys/dev/hyperv/hvsock/hv_sock.c
+++ b/sys/dev/hyperv/hvsock/hv_sock.c
@@ -118,7 +118,6 @@ static struct protosw hv_socket_protosw[] = {
.pr_domain = &hv_socket_domain,
.pr_protocol = HYPERV_SOCK_PROTO_TRANS,
.pr_flags = PR_CONNREQUIRED,
- .pr_init = hvs_trans_init,
.pr_usrreqs = &hvs_trans_usrreqs,
},
};
@@ -336,12 +335,9 @@ hvs_dom_probe(void)
return (0);
}
-void
-hvs_trans_init(void)
+static void
+hvs_trans_init(void *arg __unused)
{
- /* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
- return;
HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
"%s: HyperV Socket hvs_trans_init called\n", __func__);
@@ -354,6 +350,8 @@ hvs_trans_init(void)
LIST_INIT(&hvs_trans_bound_socks);
LIST_INIT(&hvs_trans_connected_socks);
}
+SYSINIT(hvs_trans_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
+ hvs_trans_init, NULL);
/*
* Called in two cases:
diff --git a/sys/dev/hyperv/hvsock/hv_sock.h b/sys/dev/hyperv/hvsock/hv_sock.h
index 877425968345..a1cfc31f6d74 100644
--- a/sys/dev/hyperv/hvsock/hv_sock.h
+++ b/sys/dev/hyperv/hvsock/hv_sock.h
@@ -96,7 +96,6 @@ struct hvs_pcb {
((struct socket *)((hvspcb)->so))
void hvs_addr_init(struct sockaddr_hvs *, const struct hyperv_guid *);
-void hvs_trans_init(void);
void hvs_trans_close(struct socket *);
void hvs_trans_detach(struct socket *);
void hvs_trans_abort(struct socket *);