summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-08-12 08:27:15 +0000
committerglebius <glebius@FreeBSD.org>2005-08-12 08:27:15 +0000
commit4c2db6c3c4a9a4e20498d25b997ff34b7653a82d (patch)
treedba02bd62d4f7cad4b3bc4d475944cb1bd548132
parentbeb7869726b00748b42d42f24068c853d1982339 (diff)
downloadFreeBSD-src-4c2db6c3c4a9a4e20498d25b997ff34b7653a82d.zip
FreeBSD-src-4c2db6c3c4a9a4e20498d25b997ff34b7653a82d.tar.gz
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 MFC after: 1 week
-rw-r--r--sys/net/if_ppp.c16
-rw-r--r--sys/net/if_pppvar.h1
-rw-r--r--sys/net/ppp_tty.c14
3 files changed, 7 insertions, 24 deletions
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index 8050d81..877d94d 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -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);
/*
diff --git a/sys/net/if_pppvar.h b/sys/net/if_pppvar.h
index f103df5..12c308f 100644
--- a/sys/net/if_pppvar.h
+++ b/sys/net/if_pppvar.h
@@ -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 *);
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index cd45438..88a7318 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -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;
OpenPOWER on IntegriCloud