summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/kern/uipc_domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/kern/uipc_domain.c')
-rw-r--r--freebsd/sys/kern/uipc_domain.c69
1 files changed, 37 insertions, 32 deletions
diff --git a/freebsd/sys/kern/uipc_domain.c b/freebsd/sys/kern/uipc_domain.c
index 3af4448c..7c0e7085 100644
--- a/freebsd/sys/kern/uipc_domain.c
+++ b/freebsd/sys/kern/uipc_domain.c
@@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$");
#include <net/vnet.h>
-#include <vm/uma.h>
-
/*
* System initialization
*
@@ -139,9 +137,12 @@ protosw_init(struct protosw *pr)
#define DEFAULT(foo, bar) if ((foo) == NULL) (foo) = (bar)
DEFAULT(pu->pru_accept, pru_accept_notsupp);
+ DEFAULT(pu->pru_aio_queue, pru_aio_queue_notsupp);
DEFAULT(pu->pru_bind, pru_bind_notsupp);
+ DEFAULT(pu->pru_bindat, pru_bindat_notsupp);
DEFAULT(pu->pru_connect, pru_connect_notsupp);
DEFAULT(pu->pru_connect2, pru_connect2_notsupp);
+ DEFAULT(pu->pru_connectat, pru_connectat_notsupp);
DEFAULT(pu->pru_control, pru_control_notsupp);
DEFAULT(pu->pru_disconnect, pru_disconnect_notsupp);
DEFAULT(pu->pru_listen, pru_listen_notsupp);
@@ -154,6 +155,7 @@ protosw_init(struct protosw *pr)
DEFAULT(pu->pru_sosend, sosend_generic);
DEFAULT(pu->pru_soreceive, soreceive_generic);
DEFAULT(pu->pru_sopoll, sopoll_generic);
+ DEFAULT(pu->pru_ready, pru_ready_notsupp);
#undef DEFAULT
if (pr->pr_init)
(*pr->pr_init)();
@@ -196,11 +198,7 @@ void
vnet_domain_uninit(void *arg)
{
struct domain *dp = arg;
- struct protosw *pr;
- for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
- if (pr->pr_destroy)
- (*pr->pr_destroy)();
if (dp->dom_destroy)
(*dp->dom_destroy)();
}
@@ -249,8 +247,8 @@ domaininit(void *dummy)
if (max_linkhdr < 16) /* XXX */
max_linkhdr = 16;
- callout_init(&pffast_callout, CALLOUT_MPSAFE);
- callout_init(&pfslow_callout, CALLOUT_MPSAFE);
+ callout_init(&pffast_callout, 1);
+ callout_init(&pfslow_callout, 1);
mtx_lock(&dom_mtx);
KASSERT(domain_init_status == 0, ("domaininit called too late!"));
@@ -272,21 +270,31 @@ domainfinalize(void *dummy)
callout_reset(&pfslow_callout, 1, pfslowtimo, NULL);
}
+struct domain *
+pffinddomain(int family)
+{
+ struct domain *dp;
+
+ for (dp = domains; dp != NULL; dp = dp->dom_next)
+ if (dp->dom_family == family)
+ return (dp);
+ return (NULL);
+}
+
struct protosw *
pffindtype(int family, int type)
{
struct domain *dp;
struct protosw *pr;
- for (dp = domains; dp; dp = dp->dom_next)
- if (dp->dom_family == family)
- goto found;
- return (0);
-found:
+ dp = pffinddomain(family);
+ if (dp == NULL)
+ return (NULL);
+
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
if (pr->pr_type && pr->pr_type == type)
return (pr);
- return (0);
+ return (NULL);
}
struct protosw *
@@ -294,21 +302,22 @@ pffindproto(int family, int protocol, int type)
{
struct domain *dp;
struct protosw *pr;
- struct protosw *maybe = 0;
+ struct protosw *maybe;
+ maybe = NULL;
if (family == 0)
- return (0);
- for (dp = domains; dp; dp = dp->dom_next)
- if (dp->dom_family == family)
- goto found;
- return (0);
-found:
+ return (NULL);
+
+ dp = pffinddomain(family);
+ if (dp == NULL)
+ return (NULL);
+
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
if ((pr->pr_protocol == protocol) && (pr->pr_type == type))
return (pr);
if (type == SOCK_RAW && pr->pr_type == SOCK_RAW &&
- pr->pr_protocol == 0 && maybe == (struct protosw *)0)
+ pr->pr_protocol == 0 && maybe == NULL)
maybe = pr;
}
return (maybe);
@@ -336,12 +345,10 @@ pf_proto_register(int family, struct protosw *npr)
return (ENXIO);
/* Try to find the specified domain based on the family. */
- for (dp = domains; dp; dp = dp->dom_next)
- if (dp->dom_family == family)
- goto found;
- return (EPFNOSUPPORT);
+ dp = pffinddomain(family);
+ if (dp == NULL)
+ return (EPFNOSUPPORT);
-found:
/* Initialize backpointer to struct domain. */
npr->pr_domain = dp;
fpr = NULL;
@@ -407,12 +414,10 @@ pf_proto_unregister(int family, int protocol, int type)
return (EPROTOTYPE);
/* Try to find the specified domain based on the family type. */
- for (dp = domains; dp; dp = dp->dom_next)
- if (dp->dom_family == family)
- goto found;
- return (EPFNOSUPPORT);
+ dp = pffinddomain(family);
+ if (dp == NULL)
+ return (EPFNOSUPPORT);
-found:
dpr = NULL;
/* Lock out everyone else while we are manipulating the protosw. */