MFC:
Axe ppp_for_tty(). Use tty->t_lsc pointer to store sc. This also eliminates recursive use of ppp_softc_list_mtx. PR: kern/84686 Reviewed by: phk Approved by: re (kensmith)
This commit is contained in:
parent
ebca1aed62
commit
f367659d48
@ -160,22 +160,6 @@ static void pppdumpm(struct mbuf *m0);
|
||||
static int ppp_clone_create(struct if_clone *, int);
|
||||
static void ppp_clone_destroy(struct ifnet *);
|
||||
|
||||
struct ppp_softc *
|
||||
ppp_for_tty(struct tty *tp)
|
||||
{
|
||||
struct ppp_softc *sc;
|
||||
|
||||
PPP_LIST_LOCK();
|
||||
LIST_FOREACH(sc, &ppp_softc_list, sc_list) {
|
||||
if (sc->sc_devp == (void*)tp) {
|
||||
PPP_LIST_UNLOCK();
|
||||
return (sc);
|
||||
}
|
||||
}
|
||||
PPP_LIST_UNLOCK();
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
IFC_SIMPLE_DECLARE(ppp, 0);
|
||||
|
||||
/*
|
||||
|
@ -110,4 +110,3 @@ int pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
||||
void ppp_restart(struct ppp_softc *sc);
|
||||
void ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost);
|
||||
struct mbuf *ppp_dequeue(struct ppp_softc *sc);
|
||||
struct ppp_softc *ppp_for_tty(struct tty *);
|
||||
|
@ -212,6 +212,7 @@ pppopen(dev, tp)
|
||||
PPP2IFP(sc)->if_baudrate = tp->t_ospeed;
|
||||
|
||||
tp->t_hotchar = PPP_FLAG;
|
||||
tp->t_lsc = sc;
|
||||
ttyflush(tp, FREAD | FWRITE);
|
||||
|
||||
/*
|
||||
@ -240,14 +241,13 @@ pppclose(tp, flag)
|
||||
struct tty *tp;
|
||||
int flag;
|
||||
{
|
||||
register struct ppp_softc *sc;
|
||||
register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
|
||||
int s;
|
||||
|
||||
s = spltty();
|
||||
ttyflush(tp, FREAD | FWRITE);
|
||||
clist_free_cblocks(&tp->t_canq);
|
||||
clist_free_cblocks(&tp->t_outq);
|
||||
sc = ppp_for_tty(tp);
|
||||
if (sc != NULL) {
|
||||
pppasyncrelinq(sc);
|
||||
pppdealloc(sc);
|
||||
@ -309,7 +309,7 @@ pppread(tp, uio, flag)
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
register struct ppp_softc *sc = ppp_for_tty(tp);
|
||||
register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
|
||||
struct mbuf *m, *m0;
|
||||
register int s;
|
||||
int error = 0;
|
||||
@ -368,7 +368,7 @@ pppwrite(tp, uio, flag)
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
register struct ppp_softc *sc = ppp_for_tty(tp);
|
||||
register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
|
||||
struct mbuf *m;
|
||||
struct sockaddr dst;
|
||||
int error, s;
|
||||
@ -414,7 +414,7 @@ ppptioctl(tp, cmd, data, flag, td)
|
||||
int flag;
|
||||
struct thread *td;
|
||||
{
|
||||
struct ppp_softc *sc = ppp_for_tty(tp);
|
||||
struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
|
||||
int error, s;
|
||||
|
||||
if (sc == NULL || tp != (struct tty *) sc->sc_devp)
|
||||
@ -729,7 +729,7 @@ static int
|
||||
pppstart(tp)
|
||||
register struct tty *tp;
|
||||
{
|
||||
register struct ppp_softc *sc = ppp_for_tty(tp);
|
||||
register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
|
||||
|
||||
/*
|
||||
* Call output process whether or not there is any output.
|
||||
@ -815,7 +815,7 @@ pppinput(c, tp)
|
||||
struct mbuf *m;
|
||||
int ilen, s;
|
||||
|
||||
sc = ppp_for_tty(tp);
|
||||
sc = (struct ppp_softc *)tp->t_lsc;
|
||||
if (sc == NULL)
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user