Remove ttywflush from pppclose,
[unix-history] / sys / net / if_ppp.c
index 01b48ac..aaaa87a 100644 (file)
@@ -70,7 +70,7 @@
  */
 
 /*
  */
 
 /*
- *     $Id: if_ppp.c,v 1.4 1993/10/07 02:19:37 rgrimes Exp $
+ *     $Id: if_ppp.c,v 1.8 1994/03/02 20:28:53 guido Exp $
  *     From: if_ppp.c,v 1.22 1993/08/31 23:20:40 paulus Exp
  *     From: if_ppp.c,v 1.21 1993/08/29 11:22:37 paulus Exp
  *     From: if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp 
  *     From: if_ppp.c,v 1.22 1993/08/31 23:20:40 paulus Exp
  *     From: if_ppp.c,v 1.21 1993/08/29 11:22:37 paulus Exp
  *     From: if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp 
 #include "systm.h"
 #include "proc.h"
 #include "mbuf.h"
 #include "systm.h"
 #include "proc.h"
 #include "mbuf.h"
-#include "buf.h"
-#include "dkstat.h"
 #include "socket.h"
 #include "ioctl.h"
 #include "file.h"
 #include "tty.h"
 #include "kernel.h"
 #include "conf.h"
 #include "socket.h"
 #include "ioctl.h"
 #include "file.h"
 #include "tty.h"
 #include "kernel.h"
 #include "conf.h"
+#include "dkstat.h"
 
 #include "if.h"
 #include "if_types.h"
 
 #include "if.h"
 #include "if_types.h"
@@ -223,6 +222,8 @@ pppattach()
     }
 }
 
     }
 }
 
+TEXT_SET(pseudo_set, pppattach);
+
 /*
  * Line specific open routine.
  * Attach the given tty to the first available ppp unit.
 /*
  * Line specific open routine.
  * Attach the given tty to the first available ppp unit.
@@ -252,7 +253,7 @@ pppopen(dev, tp)
 
     sc->sc_flags = 0;
     sc->sc_ilen = 0;
 
     sc->sc_flags = 0;
     sc->sc_ilen = 0;
-    sc->sc_asyncmap = 0xffffffff;
+    sc->sc_asyncmap = ~0;
     sc->sc_rasyncmap = 0;
     sc->sc_mru = PPP_MRU;
 #ifdef VJC
     sc->sc_rasyncmap = 0;
     sc->sc_mru = PPP_MRU;
 #ifdef VJC
@@ -295,7 +296,6 @@ pppclose(tp, flag)
     struct mbuf *m;
     int s;
 
     struct mbuf *m;
     int s;
 
-    ttywflush(tp);
     s = splimp();              /* paranoid; splnet probably ok */
     tp->t_line = 0;
     sc = (struct ppp_softc *)tp->t_sc;
     s = splimp();              /* paranoid; splnet probably ok */
     tp->t_line = 0;
     sc = (struct ppp_softc *)tp->t_sc;
@@ -354,7 +354,7 @@ pppread(tp, uio, flag)
            splx(s);
            return (EWOULDBLOCK);
        }
            splx(s);
            return (EWOULDBLOCK);
        }
-       error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0);
+       error = ttysleep(tp, (caddr_t)tp->t_rawq, TTIPRI|PCATCH, ttyin, 0);
        if (error)
            return error;
     }
        if (error)
            return error;
     }
@@ -364,7 +364,7 @@ pppread(tp, uio, flag)
     }
 
     /* Pull place-holder byte out of canonical queue */
     }
 
     /* Pull place-holder byte out of canonical queue */
-    getc(&tp->t_canq);
+    getc(tp->t_canq);
 
     /* Get the packet from the input queue */
     IF_DEQUEUE(&sc->sc_inq, m0);
 
     /* Get the packet from the input queue */
     IF_DEQUEUE(&sc->sc_inq, m0);
@@ -714,9 +714,9 @@ pppstart(tp)
         * We are being called in lieu of ttstart and must do what
         * it would.
         */
         * We are being called in lieu of ttstart and must do what
         * it would.
         */
-       if (CCOUNT(&tp->t_outq) != 0 && tp->t_oproc != NULL) {
+       if (CCOUNT(tp->t_outq) != 0 && tp->t_oproc != NULL) {
            (*tp->t_oproc)(tp);
            (*tp->t_oproc)(tp);
-           if (CCOUNT(&tp->t_outq) > PPP_HIWAT)
+           if (CCOUNT(tp->t_outq) > PPP_HIWAT)
                return;
        }
        /*
                return;
        }
        /*
@@ -808,9 +808,9 @@ pppstart(tp)
             * will flush any accumulated garbage.  We do this whenever
             * the line may have been idle for some time.
             */
             * will flush any accumulated garbage.  We do this whenever
             * the line may have been idle for some time.
             */
-           if (CCOUNT(&tp->t_outq) == 0) {
+           if (CCOUNT(tp->t_outq) == 0) {
                ++sc->sc_bytessent;
                ++sc->sc_bytessent;
-               (void) putc(PPP_FLAG, &tp->t_outq);
+               (void) putc(PPP_FLAG, tp->t_outq);
            }
 
            /* Calculate the FCS for the first mbuf's worth. */
            }
 
            /* Calculate the FCS for the first mbuf's worth. */
@@ -833,7 +833,7 @@ pppstart(tp)
                if (n) {
 #ifndef        RB_LEN
                    /* NetBSD (0.9 or later), 4.3-Reno or similar. */
                if (n) {
 #ifndef        RB_LEN
                    /* NetBSD (0.9 or later), 4.3-Reno or similar. */
-                   ndone = n - b_to_q(start, n, &tp->t_outq);
+                   ndone = n - b_to_q(start, n, tp->t_outq);
 #else
 #ifdef NetBSD
                    /* NetBSD with 2-byte ring buffer entries */
 #else
 #ifdef NetBSD
                    /* NetBSD with 2-byte ring buffer entries */
@@ -842,12 +842,12 @@ pppstart(tp)
                    /* 386BSD, FreeBSD */
                    int cc, nleft;
                    for (nleft = n; nleft > 0; nleft -= cc) {
                    /* 386BSD, FreeBSD */
                    int cc, nleft;
                    for (nleft = n; nleft > 0; nleft -= cc) {
-                       if ((cc = RB_CONTIGPUT(&tp->t_out)) == 0)
+                       if ((cc = RB_CONTIGPUT(tp->t_out)) == 0)
                            break;
                        cc = min (cc, nleft);
                            break;
                        cc = min (cc, nleft);
-                       bcopy((char *)start + n - nleft, tp->t_out.rb_tl, cc);
-                       tp->t_out.rb_tl = RB_ROLLOVER(&tp->t_out,
-                                                     tp->t_out.rb_tl + cc);
+                       bcopy((char *)start + n - nleft, tp->t_out->rb_tl, cc);
+                       tp->t_out->rb_tl = RB_ROLLOVER(tp->t_out,
+                                                     tp->t_out->rb_tl + cc);
                    }
                    ndone = n - nleft;
 #endif /* NetBSD */
                    }
                    ndone = n - nleft;
 #endif /* NetBSD */
@@ -865,10 +865,10 @@ pppstart(tp)
                 * Put it out in a different form.
                 */
                if (len) {
                 * Put it out in a different form.
                 */
                if (len) {
-                   if (putc(PPP_ESCAPE, &tp->t_outq))
+                   if (putc(PPP_ESCAPE, tp->t_outq))
                        break;
                        break;
-                   if (putc(*start ^ PPP_TRANS, &tp->t_outq)) {
-                       (void) unputc(&tp->t_outq);
+                   if (putc(*start ^ PPP_TRANS, tp->t_outq)) {
+                       (void) unputc(tp->t_outq);
                        break;
                    }
                    sc->sc_bytessent += 2;
                        break;
                    }
                    sc->sc_bytessent += 2;
@@ -911,10 +911,10 @@ pppstart(tp)
                 * don't all fit, back out.
                 */
                for (q = endseq; q < p; ++q)
                 * don't all fit, back out.
                 */
                for (q = endseq; q < p; ++q)
-                   if (putc(*q, &tp->t_outq)) {
+                   if (putc(*q, tp->t_outq)) {
                        done = 0;
                        for (; q > endseq; --q)
                        done = 0;
                        for (; q > endseq; --q)
-                           unputc(&tp->t_outq);
+                           unputc(tp->t_outq);
                        break;
                    }
            }
                        break;
                    }
            }
@@ -1212,7 +1212,7 @@ pppinput(c, tp)
             * Some other protocol - place on input queue for read().
             * Put a placeholder byte in canq for ttselect()/ttnread().
             */
             * Some other protocol - place on input queue for read().
             * Put a placeholder byte in canq for ttselect()/ttnread().
             */
-           putc(0, &tp->t_canq);
+           putc(0, tp->t_canq);
            ttwakeup(tp);
            inq = &sc->sc_inq;
            break;
            ttwakeup(tp);
            inq = &sc->sc_inq;
            break;