diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-03-13 05:16:08 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-03-13 05:16:08 +0000 |
commit | e3d757bc3f713cfb0fd02364a640d8eded8aa678 (patch) | |
tree | a253ee7095b4cdd2435edd836073cd98f2da2306 /sys/net/if_sl.c | |
parent | 3009a93f30b228e393ecd20ef27763e69f8986cf (diff) |
allow configuring number of these in ukc
Diffstat (limited to 'sys/net/if_sl.c')
-rw-r--r-- | sys/net/if_sl.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index f8b4b9f6b95..c1ac7a7fa4a 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sl.c,v 1.9 1999/04/22 20:02:43 art Exp $ */ +/* $OpenBSD: if_sl.c,v 1.10 2001/03/13 05:16:06 mickey Exp $ */ /* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */ /* @@ -67,9 +67,6 @@ * interrupts and network activity; thus, splimp must be >= spltty. */ -#include "sl.h" -#if NSL > 0 - #include "bpfilter.h" #include <sys/param.h> @@ -181,7 +178,8 @@ Huh? SLMTU way too small. #define ABT_COUNT 3 /* count of escapes for abort */ #define ABT_WINDOW (ABT_COUNT*2+2) /* in seconds - time to count */ -struct sl_softc sl_softc[NSL]; +struct sl_softc *sl_softc; +int nsl; #define FRAME_END 0xc0 /* Frame End */ #define FRAME_ESCAPE 0xdb /* Frame Esc */ @@ -195,12 +193,18 @@ static struct mbuf *sl_btom __P((struct sl_softc *, int)); * Called from boot code to establish sl interfaces. */ void -slattach() +slattach(n) + int n; { register struct sl_softc *sc; register int i = 0; - - for (sc = sl_softc; i < NSL; sc++) { + + sl_softc = malloc(n * sizeof(struct sl_softc), M_DEVBUF, M_NOWAIT); + if (!sl_softc) + return; + nsl = n; + bzero(sl_softc, n * sizeof(struct sl_softc)); + for (sc = sl_softc; i < nsl; sc++) { sc->sc_unit = i; /* XXX */ sprintf(sc->sc_if.if_xname, "sl%d", i++); sc->sc_if.if_softc = sc; @@ -253,9 +257,7 @@ slopen(dev, tp) { struct proc *p = curproc; /* XXX */ register struct sl_softc *sc; - register int nsl; - int error; - int s; + int i, error, s; if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); @@ -263,7 +265,7 @@ slopen(dev, tp) if (tp->t_line == SLIPDISC) return (0); - for (nsl = NSL, sc = sl_softc; --nsl >= 0; sc++) + for (i = nsl, sc = sl_softc; i--; sc++) if (sc->sc_ttyp == NULL) { if (slinit(sc) == 0) return (ENOBUFS); @@ -910,4 +912,3 @@ slioctl(ifp, cmd, data) splx(s); return (error); } -#endif |