diff options
author | wollman <wollman@FreeBSD.org> | 1996-07-09 19:12:53 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1996-07-09 19:12:53 +0000 |
commit | f53b019e3b9c566c1558586c1ccda33019257a28 (patch) | |
tree | 9c22bb256c7ddccd3022df002ff86c9b5678643b /sys/kern/uipc_domain.c | |
parent | ba8d9388bd19ffc402d860c2376f96c7e618e193 (diff) | |
download | FreeBSD-src-f53b019e3b9c566c1558586c1ccda33019257a28.zip FreeBSD-src-f53b019e3b9c566c1558586c1ccda33019257a28.tar.gz |
This is a proposal-in-code for a substantial modification of the way
the high kernel calls into a protocol stack to perform requests on the
user's behalf. We replace the pr_usrreq() entry in struct protosw with a
pointer to a structure containing pointers to functions which implement
the various reuqests; each function is declared with the correct type and
number of arguments. (This is unlike the current scheme in which a quarter
of the requests take arguments of type other than (struct mbuf *) and the
difference is papered over with casts.) There are a few benefits to this
new scheme:
1) Arguments are passed with their correct types, and null-pointer dummies
are no longer necessary.
2) There should be slightly better caching effects from eliminating
the prximity to extraneous code and th switch in pr_usrreq().
3) It becomes much easier to change the types of the arguments to something
other than `struct mbuf *' (e.g.,pushing the work of sosend() into
the protocol as advocated by Van Jacobson).
There is one principal drawback: existing protocol stacks need to
be modified. This is alleviated by compatibility code in
uipc_socket2.c and uipc_domain.c which emulates the new interface
in terms of the old and vice versa.
This idea is not original to me. I read about what Jacobson did
in one of his papers and have tried to implement the first steps
towards something like that here. Much work remains to be done.
Diffstat (limited to 'sys/kern/uipc_domain.c')
-rw-r--r-- | sys/kern/uipc_domain.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index b64a44b..c989f94 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_domain.c 8.2 (Berkeley) 10/18/93 - * $Id: uipc_domain.c,v 1.11 1995/12/02 17:10:38 bde Exp $ + * $Id: uipc_domain.c,v 1.12 1995/12/16 02:13:50 bde Exp $ */ #include <sys/param.h> @@ -103,9 +103,17 @@ domaininit(dummy) for (dp = domains; dp; dp = dp->dom_next) { 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++){ +#ifdef PRU_OLDSTYLE + /* See comments in uipc_socket2.c. */ + if (pr->pr_usrreqs == 0) + pr->pr_usrreqs = &pru_oldstyle; + else if(pr->pr_usrreq == 0) + pr->pr_usrreq = pr_newstyle_usrreq; +#endif if (pr->pr_init) (*pr->pr_init)(); + } } if (max_linkhdr < 16) /* XXX */ |