1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-30 08:19:09 +00:00

Make networking domains drop-ins, through the magic of GNU ld. (Some day,

there may even be LKMs.)  Also, change the internal name of `unixdomain'
to `localdomain' since AF_LOCAL is now the preferred name of this family.
Declare netisr correctly and in the right place.
This commit is contained in:
Garrett Wollman 1995-05-11 00:13:26 +00:00
parent c904a246d2
commit 748e0b0acc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8426
18 changed files with 147 additions and 100 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.121 1995/04/18 23:55:26 rgrimes Exp $
* $Id: machdep.c,v 1.122 1995/04/22 03:58:46 wpaul Exp $
*/
#include "npx.h"
@ -184,10 +184,13 @@ vm_offset_t phys_avail[6];
int cpu_class;
void dumpsys __P((void));
void setup_netisrs __P((struct linker_set *)); /* XXX declare elsewhere */
vm_offset_t buffer_sva, buffer_eva;
vm_offset_t clean_sva, clean_eva;
vm_offset_t pager_sva, pager_eva;
extern int pager_map_size;
extern struct linker_set netisr_set;
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
@ -228,26 +231,13 @@ cpu_startup()
/*
* Quickly wire in netisrs.
*/
#define DONET(isr, n) do { netisrs[n] = isr; } while(0)
#ifdef INET
#if NETHER > 0
DONET(arpintr, NETISR_ARP);
#endif
DONET(ipintr, NETISR_IP);
#endif
#ifdef NS
DONET(nsintr, NETISR_NS);
#endif
#ifdef ISO
DONET(clnlintr, NETISR_ISO);
#endif
#ifdef CCITT
DONET(ccittintr, NETISR_CCITT);
#endif
setup_netisrs(&netisr_set);
/*
#ifdef ISDN
DONET(isdnintr, NETISR_ISDN);
#endif
#undef DONET
*/
/*
* Allocate space for system data structures.
@ -405,6 +395,18 @@ cpu_startup()
}
}
void
setup_netisrs(struct linker_set *ls)
{
int i;
const struct netisrtab *nit;
for(i = 0; ls->ls_items[i]; i++) {
nit = (const struct netisrtab *)ls->ls_items[i];
printf("setup_netisrs %d\n", nit->nit_num);
netisrs[nit->nit_num] = nit->nit_isr;
}
}
struct cpu_nameclass i386_cpus[] = {
{ "Intel 80286", CPUCLASS_286 }, /* CPU_286 */

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.121 1995/04/18 23:55:26 rgrimes Exp $
* $Id: machdep.c,v 1.122 1995/04/22 03:58:46 wpaul Exp $
*/
#include "npx.h"
@ -184,10 +184,13 @@ vm_offset_t phys_avail[6];
int cpu_class;
void dumpsys __P((void));
void setup_netisrs __P((struct linker_set *)); /* XXX declare elsewhere */
vm_offset_t buffer_sva, buffer_eva;
vm_offset_t clean_sva, clean_eva;
vm_offset_t pager_sva, pager_eva;
extern int pager_map_size;
extern struct linker_set netisr_set;
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
@ -228,26 +231,13 @@ cpu_startup()
/*
* Quickly wire in netisrs.
*/
#define DONET(isr, n) do { netisrs[n] = isr; } while(0)
#ifdef INET
#if NETHER > 0
DONET(arpintr, NETISR_ARP);
#endif
DONET(ipintr, NETISR_IP);
#endif
#ifdef NS
DONET(nsintr, NETISR_NS);
#endif
#ifdef ISO
DONET(clnlintr, NETISR_ISO);
#endif
#ifdef CCITT
DONET(ccittintr, NETISR_CCITT);
#endif
setup_netisrs(&netisr_set);
/*
#ifdef ISDN
DONET(isdnintr, NETISR_ISDN);
#endif
#undef DONET
*/
/*
* Allocate space for system data structures.
@ -405,6 +395,18 @@ cpu_startup()
}
}
void
setup_netisrs(struct linker_set *ls)
{
int i;
const struct netisrtab *nit;
for(i = 0; ls->ls_items[i]; i++) {
nit = (const struct netisrtab *)ls->ls_items[i];
printf("setup_netisrs %d\n", nit->nit_num);
netisrs[nit->nit_num] = nit->nit_isr;
}
}
struct cpu_nameclass i386_cpus[] = {
{ "Intel 80286", CPUCLASS_286 }, /* CPU_286 */

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: spl.h,v 1.5 1994/09/20 05:07:32 bde Exp $
* $Id: spl.h,v 1.6 1994/12/30 12:42:15 bde Exp $
*/
#ifndef _MACHINE_IPL_H_
@ -76,7 +76,6 @@ extern unsigned bio_imask; /* group of interrupts masked with splbio() */
extern unsigned cpl; /* current priority level mask */
extern volatile unsigned ipending; /* active interrupts masked by cpl */
extern unsigned net_imask; /* group of interrupts masked with splimp() */
extern volatile unsigned netisr;
extern unsigned stat_imask; /* interrupts masked with splstatclock() */
extern unsigned tty_imask; /* group of interrupts masked with spltty() */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_domain.c 8.2 (Berkeley) 10/18/93
* $Id: uipc_domain.c,v 1.3 1994/08/02 07:43:00 davidg Exp $
* $Id: uipc_domain.c,v 1.4 1995/01/05 19:51:43 se Exp $
*/
#include <sys/param.h>
@ -49,42 +49,38 @@
void pffasttimo __P((void *));
void pfslowtimo __P((void *));
struct domain *domains;
#define ADDDOMAIN(x) { \
extern struct domain __CONCAT(x,domain); \
__CONCAT(x,domain.dom_next) = domains; \
domains = &__CONCAT(x,domain); \
}
extern struct linker_set domain_set;
void
domaininit()
{
register struct domain *dp;
register struct domain *dp, **dpp;
register struct protosw *pr;
#undef unix
#ifndef lint
ADDDOMAIN(unix);
ADDDOMAIN(route);
#ifdef INET
ADDDOMAIN(inet);
#endif
#ifdef NS
ADDDOMAIN(ns);
#endif
#ifdef ISO
ADDDOMAIN(iso);
#endif
#ifdef CCITT
ADDDOMAIN(ccitt);
#endif
/*
* NB - local domain is always present.
*/
ADDDOMAIN(local);
for (dpp = (struct domain **)domain_set.ls_items; *dpp; dpp++) {
printf("domaininit %s\n", (**dpp).dom_name);
(**dpp).dom_next = domains;
domains = *dpp;
}
/* - not in our sources
#ifdef ISDN
ADDDOMAIN(isdn);
#endif
#include "imp.h"
#if NIMP > 0
ADDDOMAIN(imp);
#endif
#endif
*/
for (dp = domains; dp; dp = dp->dom_next) {
if (dp->dom_init)
@ -94,8 +90,8 @@ domaininit()
(*pr->pr_init)();
}
if (max_linkhdr < 16) /* XXX */
max_linkhdr = 16;
if (max_linkhdr < 16) /* XXX */
max_linkhdr = 16;
max_hdr = max_linkhdr + max_protohdr;
max_datalen = MHLEN - max_hdr;
timeout(pffasttimo, (void *)0, 1);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_proto.c 8.1 (Berkeley) 6/10/93
* $Id$
* $Id: uipc_proto.c,v 1.2 1994/08/02 07:43:04 davidg Exp $
*/
#include <sys/param.h>
@ -41,20 +41,20 @@
#include <sys/mbuf.h>
/*
* Definitions of protocols supported in the UNIX domain.
* Definitions of protocols supported in the LOCAL domain.
*/
int uipc_usrreq(), raw_usrreq();
void raw_init(),raw_input(),raw_ctlinput();
extern struct domain unixdomain; /* or at least forward */
extern struct domain localdomain; /* or at least forward */
struct protosw unixsw[] = {
{ SOCK_STREAM, &unixdomain, 0, PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
struct protosw localsw[] = {
{ SOCK_STREAM, &localdomain, 0, PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
0, 0, 0, 0,
uipc_usrreq,
0, 0, 0, 0,
},
{ SOCK_DGRAM, &unixdomain, 0, PR_ATOMIC|PR_ADDR|PR_RIGHTS,
{ SOCK_DGRAM, &localdomain, 0, PR_ATOMIC|PR_ADDR|PR_RIGHTS,
0, 0, 0, 0,
uipc_usrreq,
0, 0, 0, 0,
@ -68,6 +68,6 @@ struct protosw unixsw[] = {
int unp_externalize(), unp_dispose();
struct domain unixdomain =
{ AF_UNIX, "unix", 0, unp_externalize, unp_dispose,
unixsw, &unixsw[sizeof(unixsw)/sizeof(unixsw[0])] };
struct domain localdomain =
{ AF_LOCAL, "local", 0, unp_externalize, unp_dispose,
localsw, &localsw[sizeof(localsw)/sizeof(localsw[0])] };

View File

@ -30,8 +30,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94
* $Id: uipc_usrreq.c,v 1.6 1995/02/07 02:01:16 wollman Exp $
* From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94
* $Id: uipc_usrreq.c,v 1.7 1995/02/15 11:30:35 davidg Exp $
*/
#include <sys/param.h>
@ -59,7 +59,7 @@
* rethink name space problems
* need a proper out-of-band
*/
struct sockaddr sun_noname = { sizeof(sun_noname), AF_UNIX };
struct sockaddr sun_noname = { sizeof(sun_noname), AF_LOCAL };
ino_t unp_ino; /* prototype for fake inode numbers */
/*ARGSUSED*/
@ -696,7 +696,7 @@ unp_internalize(control, p)
}
int unp_defer, unp_gcing;
extern struct domain unixdomain;
extern struct domain localdomain;
void
unp_gc()
@ -729,7 +729,7 @@ unp_gc()
if (fp->f_type != DTYPE_SOCKET ||
(so = (struct socket *)fp->f_data) == 0)
continue;
if (so->so_proto->pr_domain != &unixdomain ||
if (so->so_proto->pr_domain != &localdomain ||
(so->so_proto->pr_flags&PR_RIGHTS) == 0)
continue;
#ifdef notdef

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)netisr.h 8.1 (Berkeley) 6/10/93
* $Id: netisr.h,v 1.4 1994/08/21 05:11:44 paul Exp $
* $Id: netisr.h,v 1.5 1995/01/05 19:51:47 se Exp $
*/
#ifndef _NET_NETISR_H_
@ -68,7 +68,19 @@
#ifndef LOCORE
#ifdef KERNEL
volatile unsigned int netisr; /* scheduling bits for network */
extern volatile unsigned int netisr; /* scheduling bits for network */
typedef void netisr_t(void);
struct netisrtab {
int nit_num;
netisr_t *nit_isr;
};
#define NETISR_SET(num, isr) \
static struct netisrtab mod_nit = { num, isr }; \
DATA_SET(netisr_set, mod_nit);
#endif
#endif

View File

@ -36,6 +36,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
@ -793,3 +794,4 @@ struct domain routedomain =
{ PF_ROUTE, "route", route_init, 0, 0,
routesw, &routesw[sizeof(routesw)/sizeof(routesw[0])] };
DOMAIN_SET(route);

View File

@ -36,10 +36,11 @@
* SUCH DAMAGE.
*
* @(#)ccitt_proto.c 8.1 (Berkeley) 6/10/93
* $Id$
* $Id: ccitt_proto.c,v 1.2 1994/08/02 07:46:54 davidg Exp $
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/domain.h>
@ -92,3 +93,5 @@ struct domain ccittdomain =
{ AF_CCITT, "ccitt", 0, 0, 0, ccittsw,
&ccittsw[sizeof(ccittsw)/sizeof(ccittsw[0])], 0,
rn_inithead, 32, sizeof (struct sockaddr_x25) };
DOMAIN_SET(ccitt);

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)pk_input.c 8.1 (Berkeley) 6/10/93
* $Id: pk_input.c,v 1.2 1994/08/02 07:47:35 davidg Exp $
* $Id: pk_input.c,v 1.3 1994/12/13 22:32:15 wollman Exp $
*/
#include <sys/param.h>
@ -69,7 +69,7 @@ struct pkcb_q pkcb_q = {&pkcb_q, &pkcb_q};
* employ boards that do all the stuff themselves, e.g. ADAX X.25 or TPS ISDN.)
*/
void
ccittintr ()
ccittintr (void)
{
extern struct ifqueue pkintrq;
extern struct ifqueue hdintrq;
@ -87,6 +87,8 @@ ccittintr ()
pkintr ();
}
NETISR_SET(NETISR_CCITT, ccittintr);
struct pkcb *
pk_newlink (ia, llnext)
struct x25_ifaddr *ia;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ether.c 8.1 (Berkeley) 6/10/93
* $Id: if_ether.c,v 1.14 1995/04/26 18:10:52 pst Exp $
* $Id: if_ether.c,v 1.15 1995/05/09 13:35:44 davidg Exp $
*/
/*
@ -54,6 +54,7 @@
#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>
#include <net/netisr.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@ -367,7 +368,7 @@ arpresolve(ac, rt, m, dst, desten, rt0)
* then the protocol-specific routine is called.
*/
void
arpintr()
arpintr(void)
{
register struct mbuf *m;
register struct arphdr *ar;
@ -396,6 +397,8 @@ arpintr()
}
}
NETISR_SET(NETISR_ARP, arpintr);
/*
* ARP for Internet protocols on 10 Mb/s Ethernet.
* Algorithm is that given in RFC 826.

View File

@ -30,11 +30,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_proto.c 8.1 (Berkeley) 6/10/93
* $Id: in_proto.c,v 1.12 1995/02/16 00:55:38 wollman Exp $
* From: @(#)in_proto.c 8.1 (Berkeley) 6/10/93
* $Id: in_proto.c,v 1.13 1995/04/09 01:29:20 davidg Exp $
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/domain.h>
@ -164,6 +165,8 @@ struct domain inetdomain =
in_inithead, 32, sizeof(struct sockaddr_in)
};
DOMAIN_SET(inet);
#include "imp.h"
#if NIMP > 0
extern struct domain impdomain;
@ -180,6 +183,9 @@ struct protosw impsw[] = {
struct domain impdomain =
{ AF_IMPLINK, "imp", 0, 0, 0,
impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] };
DOMAIN_SET(imp);
#endif
#if 0
@ -201,5 +207,7 @@ struct protosw hysw[] = {
struct domain hydomain =
{ AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] };
DOMAIN_SET(hy);
#endif
#endif

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
* $Id: ip_input.c,v 1.19 1995/03/16 18:22:28 wollman Exp $
* $Id: ip_input.c,v 1.20 1995/05/09 13:35:45 davidg Exp $
*/
#include <sys/param.h>
@ -51,6 +51,7 @@
#include <net/if.h>
#include <net/route.h>
#include <net/netisr.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@ -143,7 +144,7 @@ struct route ipforward_rt;
* try to reassemble. Process options. Pass to next level.
*/
void
ipintr()
ipintr(void)
{
register struct ip *ip;
register struct mbuf *m;
@ -432,6 +433,8 @@ ipintr()
goto next;
}
NETISR_SET(NETISR_IP, ipintr);
/*
* Take incoming datagram fragment and try to
* reassemble it into whole datagram. If a chain for

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)clnp_input.c 8.1 (Berkeley) 6/10/93
* $Id: clnp_input.c,v 1.3 1994/11/15 14:26:11 bde Exp $
* $Id: clnp_input.c,v 1.4 1995/03/16 18:15:20 bde Exp $
*/
/***********************************************************
@ -60,8 +60,8 @@ SOFTWARE.
/*
* ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
*/
/* $Header: /home/ncvs/src/sys/netiso/clnp_input.c,v 1.3 1994/11/15 14:26:11 bde Exp $ */
/* $Source: /home/ncvs/src/sys/netiso/clnp_input.c,v $ */
/* $Header: /a/ncvs/src/sys/netiso/clnp_input.c,v 1.4 1995/03/16 18:15:20 bde Exp $ */
/* $Source: /a/ncvs/src/sys/netiso/clnp_input.c,v $ */
#include <sys/param.h>
#include <sys/systm.h>
@ -153,7 +153,7 @@ clnp_init()
* NOTES:
*/
void
clnlintr()
clnlintr(void)
{
register struct mbuf *m; /* ptr to first mbuf of pkt */
register struct clnl_fixed *clnl; /* ptr to fixed part of clnl hdr */
@ -269,6 +269,8 @@ clnlintr()
goto next;
}
NETISR_SET(NETISR_ISO, clnlintr);
/*
* FUNCTION: clnp_input
*

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)iso_proto.c 8.1 (Berkeley) 6/10/93
* $Id$
* $Id: iso_proto.c,v 1.2 1994/08/02 07:50:42 davidg Exp $
*/
/***********************************************************
@ -60,7 +60,7 @@ SOFTWARE.
/*
* ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
*/
/* $Header: /home/ncvs/src/sys/netiso/iso_proto.c,v 1.1.1.1 1994/05/24 10:07:09 rgrimes Exp $
/* $Header: /home/ncvs/src/sys/netiso/iso_proto.c,v 1.2 1994/08/02 07:50:42 davidg Exp $
* $Source: /home/ncvs/src/sys/netiso/iso_proto.c,v $
*
* iso_proto.c : protocol switch tables in the ISO domain
@ -71,6 +71,7 @@ SOFTWARE.
#ifdef ISO
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/domain.h>
@ -195,4 +196,6 @@ struct domain isodomain = {
48, /* rtoffset */
sizeof(struct sockaddr_iso) /* maxkeylen */
};
DOMAIN_SET(iso);
#endif /* ISO */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ns_input.c 8.1 (Berkeley) 6/10/93
* $Id: ns_input.c,v 1.2 1994/08/02 07:51:49 davidg Exp $
* $Id: ns_input.c,v 1.3 1995/03/16 18:15:28 bde Exp $
*/
#include <sys/param.h>
@ -49,6 +49,7 @@
#include <net/if.h>
#include <net/route.h>
#include <net/raw_cb.h>
#include <net/netisr.h>
#include <netns/ns.h>
#include <netns/ns_if.h>
@ -101,7 +102,7 @@ ns_init()
int nsintr_getpck = 0;
int nsintr_swtch = 0;
void
nsintr()
nsintr(void)
{
register struct idp *idp;
register struct mbuf *m;
@ -236,6 +237,8 @@ nsintr()
goto next;
}
NETISR_SET(NETISR_NS, nsintr);
u_char nsctlerrmap[PRC_NCMDS] = {
ECONNABORTED, ECONNABORTED, 0, 0,
0, 0, EHOSTDOWN, EHOSTUNREACH,

View File

@ -30,11 +30,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ns_proto.c 8.1 (Berkeley) 6/10/93
* $Id$
* From: @(#)ns_proto.c 8.1 (Berkeley) 6/10/93
* $Id: ns_proto.c,v 1.2 1994/08/02 07:51:54 davidg Exp $
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/domain.h>
@ -95,3 +96,4 @@ struct domain nsdomain =
nssw, &nssw[sizeof(nssw)/sizeof(nssw[0])], 0,
rn_inithead, 16, sizeof(struct sockaddr_ns)};
DOMAIN_SET(ns);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)domain.h 8.1 (Berkeley) 6/2/93
* $Id: domain.h,v 1.2 1994/08/02 07:52:53 davidg Exp $
* $Id: domain.h,v 1.3 1994/08/21 04:41:41 paul Exp $
*/
#ifndef _SYS_DOMAIN_H_
@ -64,7 +64,12 @@ struct domain {
};
#ifdef KERNEL
struct domain *domains;
extern struct domain *domains;
#define DOMAIN_SET(name) \
extern struct domain name ## domain; \
DATA_SET(domain_set, name ## domain);
#endif
#endif