tprintf
authorMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Fri, 29 Jun 1990 06:31:59 +0000 (22:31 -0800)
committerMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Fri, 29 Jun 1990 06:31:59 +0000 (22:31 -0800)
SCCS-vsn: sys/vax/uba/tmscp.c 7.13
SCCS-vsn: sys/vax/uba/ut.c 7.10
SCCS-vsn: sys/vax/uba/tm.c 7.12
SCCS-vsn: sys/vax/uba/ts.c 7.12

usr/src/sys/vax/uba/tm.c
usr/src/sys/vax/uba/tmscp.c
usr/src/sys/vax/uba/ts.c
usr/src/sys/vax/uba/ut.c

index ba807e5..16dca82 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tm.c        7.11 (Berkeley) %G%
+ *     @(#)tm.c        7.12 (Berkeley) %G%
  */
 
 #include "te.h"
  */
 
 #include "te.h"
@@ -23,8 +23,6 @@
 #include "buf.h"
 #include "conf.h"
 #include "user.h"
 #include "buf.h"
 #include "conf.h"
 #include "user.h"
-#include "proc.h"
-#include "file.h"
 #include "map.h"
 #include "vm.h"
 #include "ioctl.h"
 #include "map.h"
 #include "vm.h"
 #include "ioctl.h"
@@ -32,8 +30,8 @@
 #include "cmap.h"
 #include "uio.h"
 #include "kernel.h"
 #include "cmap.h"
 #include "uio.h"
 #include "kernel.h"
-#include "tty.h"
 #include "syslog.h"
 #include "syslog.h"
+#include "tprintf.h"
 
 #include "machine/pte.h"
 #include "../vax/cpu.h"
 
 #include "machine/pte.h"
 #include "../vax/cpu.h"
@@ -104,7 +102,7 @@ struct      te_softc {
        daddr_t sc_timo;        /* time until timeout expires */
        int     sc_blks;        /* number of I/O operations since open */
        int     sc_softerrs;    /* number of soft I/O errors since open */
        daddr_t sc_timo;        /* time until timeout expires */
        int     sc_blks;        /* number of I/O operations since open */
        int     sc_softerrs;    /* number of soft I/O errors since open */
-       caddr_t sc_ctty;        /* users controlling terminal (vnode) */
+       tpr_t   sc_tpr;         /* tprintf handle */
 } te_softc[NTE];
 #ifdef unneeded
 int    tmgapsdcnt;             /* DEBUG */
 } te_softc[NTE];
 #ifdef unneeded
 int    tmgapsdcnt;             /* DEBUG */
@@ -250,8 +248,7 @@ get:
        sc->sc_dens = dens;
        sc->sc_blks = 0;
        sc->sc_softerrs = 0;
        sc->sc_dens = dens;
        sc->sc_blks = 0;
        sc->sc_softerrs = 0;
-       sc->sc_ctty = (caddr_t)(u.u_procp->p_flag&SCTTY ? 
-                       u.u_procp->p_session->s_ttyvp : 0);
+       sc->sc_tpr = tprintf_open();
        s = splclock();
        if (sc->sc_tact == 0) {
                sc->sc_timo = INF;
        s = splclock();
        if (sc->sc_tact == 0) {
                sc->sc_timo = INF;
@@ -292,6 +289,7 @@ tmclose(dev, flag)
        if (sc->sc_blks > 100 && sc->sc_softerrs > sc->sc_blks / 100)
                log(LOG_INFO, "te%d: %d soft errors in %d blocks\n",
                    TEUNIT(dev), sc->sc_softerrs, sc->sc_blks);
        if (sc->sc_blks > 100 && sc->sc_softerrs > sc->sc_blks / 100)
                log(LOG_INFO, "te%d: %d soft errors in %d blocks\n",
                    TEUNIT(dev), sc->sc_softerrs, sc->sc_blks);
+       tprintf_close(sc->sc_tpr);
        sc->sc_openf = 0;
        return (0);
 }
        sc->sc_openf = 0;
        return (0);
 }
@@ -673,7 +671,7 @@ tmintr(tm11)
                /*
                 * Couldn't recover error
                 */
                /*
                 * Couldn't recover error
                 */
-               tprintf(sc->sc_ctty,
+               tprintf(sc->sc_tpr,
                    "te%d: hard error bn%d er=%b\n", minor(bp->b_dev)&03,
                    bp->b_blkno, sc->sc_erreg, TMER_BITS);
 #ifdef AVIV
                    "te%d: hard error bn%d er=%b\n", minor(bp->b_dev)&03,
                    bp->b_blkno, sc->sc_erreg, TMER_BITS);
 #ifdef AVIV
index 997ce53..5a89f2f 100644 (file)
@@ -1,4 +1,4 @@
-/*     @(#)tmscp.c     7.12 (Berkeley) %G% */
+/*     @(#)tmscp.c     7.13 (Berkeley) %G% */
 
 #ifndef lint
 static char    *sccsid = "@(#)tmscp.c  1.24    (ULTRIX)        1/21/86";
 
 #ifndef lint
 static char    *sccsid = "@(#)tmscp.c  1.24    (ULTRIX)        1/21/86";
@@ -126,8 +126,6 @@ static      char    *sccsid = "@(#)tmscp.c  1.24    (ULTRIX)        1/21/86";
 #include "systm.h"
 #include "buf.h"
 #include "conf.h"
 #include "systm.h"
 #include "buf.h"
 #include "conf.h"
-#include "user.h"
-#include "proc.h"
 #include "file.h"
 #include "map.h"
 #include "vm.h"
 #include "file.h"
 #include "map.h"
 #include "vm.h"
@@ -136,6 +134,7 @@ static      char    *sccsid = "@(#)tmscp.c  1.24    (ULTRIX)        1/21/86";
 #include "mtio.h"
 #include "cmap.h"
 #include "uio.h"
 #include "mtio.h"
 #include "cmap.h"
 #include "uio.h"
+#include "tprintf.h"
 
 #include "../vax/pte.h"
 #include "../vax/cpu.h"
 
 #include "../vax/pte.h"
 #include "../vax/cpu.h"
@@ -191,7 +190,7 @@ struct tms_info {
        short           tms_fmtmenu;    /* the unit's format (density) menu */
        short           tms_unitflgs;   /* unit flag parameters */
        short           tms_format;     /* the unit's current format (density) */
        short           tms_fmtmenu;    /* the unit's format (density) menu */
        short           tms_unitflgs;   /* unit flag parameters */
        short           tms_format;     /* the unit's current format (density) */
-       caddr_t         tms_ctty;       /* user's controlling tty (vnode) */
+       tpr_t           tms_tpr;        /* tprintf handle */
 } tms_info[NTMS];
 struct uba_ctlr *tmscpminfo[NTMSCP];
 struct uba_device *tmsdinfo[NTMS];
 } tms_info[NTMS];
 struct uba_ctlr *tmscpminfo[NTMSCP];
 struct uba_device *tmsdinfo[NTMS];
@@ -704,8 +703,7 @@ tmscpopen(dev, flag)
                return (EBUSY);
        sc = &tmscp_softc[ui->ui_ctlr];
        tms->tms_openf = 1;
                return (EBUSY);
        sc = &tmscp_softc[ui->ui_ctlr];
        tms->tms_openf = 1;
-       tms->tms_ctty = (caddr_t)(u.u_procp->p_flag&SCTTY ?
-                       u.u_procp->p_session->s_ttyvp : 0);
+       tms->tms_tpr = tprintf_open();
        s = spl5();
        if (sc->sc_state != S_RUN)
                {
        s = spl5();
        if (sc->sc_state != S_RUN)
                {
@@ -836,6 +834,7 @@ tmscpclose(dev, flag)
 #                      endif
                        tmscpcommand(dev, TMS_CSE, 1);
                        }
 #                      endif
                        tmscpcommand(dev, TMS_CSE, 1);
                        }
+       tprintf_close(tms->tms_tpr);
        tms->tms_openf = 0;
        return (0);
 }
        tms->tms_openf = 0;
        return (0);
 }
@@ -1043,7 +1042,7 @@ tmscpstart(um)
        tms = &tms_info[ui->ui_unit];
        if ((tmscpaddr->tmscpsa&TMSCP_ERR) || sc->sc_state != S_RUN)
                {
        tms = &tms_info[ui->ui_unit];
        if ((tmscpaddr->tmscpsa&TMSCP_ERR) || sc->sc_state != S_RUN)
                {
-               tprintf(tms->tms_ctty,
+               tprintf(tms->tms_tpr,
                    "tms%d: hard error bn%d\n",
                    minor(bp->b_dev)&03, bp->b_blkno);
                log(TMS_PRI, "tmscp%d: sa 0%o, state %d\n",um->um_ctlr,
                    "tms%d: hard error bn%d\n",
                    minor(bp->b_dev)&03, bp->b_blkno);
                log(TMS_PRI, "tmscp%d: sa 0%o, state %d\n",um->um_ctlr,
@@ -1414,11 +1413,11 @@ tmscprsp(um, tm, sc, i)
                else 
                        {
                        if (bp = dp->b_actf)
                else 
                        {
                        if (bp = dp->b_actf)
-                               tprintf(tms->tms_ctty,
+                               tprintf(tms->tms_tpr,
                                    "tms%d: hard error bn%d: OFFLINE\n",
                                    minor(bp->b_dev)&03, bp->b_blkno);
                        else
                                    "tms%d: hard error bn%d: OFFLINE\n",
                                    minor(bp->b_dev)&03, bp->b_blkno);
                        else
-                               tprintf(tms->tms_ctty,
+                               tprintf(tms->tms_tpr,
                                    "tms%d: hard error: OFFLINE\n",
                                    ui->ui_unit);
                        while (bp = dp->b_actf)
                                    "tms%d: hard error: OFFLINE\n",
                                    ui->ui_unit);
                        while (bp = dp->b_actf)
@@ -1550,7 +1549,7 @@ tmscprsp(um, tm, sc, i)
                                tms->tms_serex = 1;
                        if (st != M_ST_TAPEM)
                                {
                                tms->tms_serex = 1;
                        if (st != M_ST_TAPEM)
                                {
-                               tprintf(tms->tms_ctty,
+                               tprintf(tms->tms_tpr,
                                    "tms%d: hard error bn%d\n",
                                    minor(bp->b_dev)&03, bp->b_blkno);
                                errinfo(st);            /* produces more info */
                                    "tms%d: hard error bn%d\n",
                                    minor(bp->b_dev)&03, bp->b_blkno);
                                errinfo(st);            /* produces more info */
index 23d4e78..19ebe8f 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ts.c        7.11 (Berkeley) %G%
+ *     @(#)ts.c        7.12 (Berkeley) %G%
  */
 
 #include "ts.h"
  */
 
 #include "ts.h"
@@ -21,8 +21,6 @@
 #include "systm.h"
 #include "buf.h"
 #include "conf.h"
 #include "systm.h"
 #include "buf.h"
 #include "conf.h"
-#include "user.h"
-#include "proc.h"
 #include "file.h"
 #include "map.h"
 #include "vm.h"
 #include "file.h"
 #include "map.h"
 #include "vm.h"
@@ -30,8 +28,8 @@
 #include "mtio.h"
 #include "cmap.h"
 #include "uio.h"
 #include "mtio.h"
 #include "cmap.h"
 #include "uio.h"
-#include "tty.h"
 #include "syslog.h"
 #include "syslog.h"
+#include "tprintf.h"
 
 #include "machine/pte.h"
 #include "../vax/cpu.h"
 
 #include "machine/pte.h"
 #include "../vax/cpu.h"
@@ -96,7 +94,7 @@ struct        ts_softc {
        struct  ts_tsdata *sc_ubaddr; /* Unibus address of tsdata structure */
        u_short sc_uba;         /* Unibus addr of cmd pkt for tsdb */
        short   sc_density;     /* value |'ed into char_mode for TC13 density */
        struct  ts_tsdata *sc_ubaddr; /* Unibus address of tsdata structure */
        u_short sc_uba;         /* Unibus addr of cmd pkt for tsdb */
        short   sc_density;     /* value |'ed into char_mode for TC13 density */
-       caddr_t sc_ctty;        /* user's controlling tty (vnode) */
+       tpr_t   sc_tpr;         /* tprintf handle */
        int     sc_blks;        /* number of I/O operations since open */
        int     sc_softerrs;    /* number of soft I/O errors since open */
 } ts_softc[NTS];
        int     sc_blks;        /* number of I/O operations since open */
        int     sc_softerrs;    /* number of soft I/O errors since open */
 } ts_softc[NTS];
@@ -254,8 +252,7 @@ tsopen(dev, flag)
        sc->sc_lastiow = 0;
        sc->sc_blks = 0;
        sc->sc_softerrs = 0;
        sc->sc_lastiow = 0;
        sc->sc_blks = 0;
        sc->sc_softerrs = 0;
-       sc->sc_ctty = (caddr_t)(u.u_procp->p_flag&SCTTY ? 
-                       u.u_procp->p_session->s_ttyvp : 0);
+       sc->sc_tpr = tprintf_open();
        return (0);
 }
 
        return (0);
 }
 
@@ -289,6 +286,7 @@ tsclose(dev, flag)
        if (sc->sc_blks > 100 && sc->sc_softerrs > sc->sc_blks / 100)
                log(LOG_INFO, "ts%d: %d soft errors in %d blocks\n",
                    TSUNIT(dev), sc->sc_softerrs, sc->sc_blks);
        if (sc->sc_blks > 100 && sc->sc_softerrs > sc->sc_blks / 100)
                log(LOG_INFO, "ts%d: %d soft errors in %d blocks\n",
                    TSUNIT(dev), sc->sc_softerrs, sc->sc_blks);
+       tprintf_close(sc->sc_tpr);
        sc->sc_openf = 0;
        return (0);
 }
        sc->sc_openf = 0;
        return (0);
 }
@@ -670,29 +668,29 @@ tsintr(tsunit)
 
                case TS_REJECT:         /* function reject */
                        if (state == SIO && sc->sc_ts.t_sts.s_xs0 & TS_WLE)
 
                case TS_REJECT:         /* function reject */
                        if (state == SIO && sc->sc_ts.t_sts.s_xs0 & TS_WLE)
-                               tprintf(sc->sc_ctty, "ts%d: write locked\n",
+                               tprintf(sc->sc_tpr, "ts%d: write locked\n",
                                    tsunit);
                        if ((sc->sc_ts.t_sts.s_xs0 & TS_ONL) == 0)
                                    tsunit);
                        if ((sc->sc_ts.t_sts.s_xs0 & TS_ONL) == 0)
-                               tprintf(sc->sc_ctty, "ts%d: offline\n",
+                               tprintf(sc->sc_tpr, "ts%d: offline\n",
                                    tsunit);
                        break;
                }
                /*
                 * Couldn't recover error
                 */
                                    tsunit);
                        break;
                }
                /*
                 * Couldn't recover error
                 */
-               tprintf(sc->sc_ctty, "ts%d: hard error bn%d tssr=%b xs0=%b",
+               tprintf(sc->sc_tpr, "ts%d: hard error bn%d tssr=%b xs0=%b",
                    tsunit, bp->b_blkno, addr->tssr, TSSR_BITS,
                    sc->sc_ts.t_sts.s_xs0, TSXS0_BITS);
                if (sc->sc_ts.t_sts.s_xs1)
                    tsunit, bp->b_blkno, addr->tssr, TSSR_BITS,
                    sc->sc_ts.t_sts.s_xs0, TSXS0_BITS);
                if (sc->sc_ts.t_sts.s_xs1)
-                       tprintf(sc->sc_ctty, " xs1=%b", sc->sc_ts.t_sts.s_xs1,
+                       tprintf(sc->sc_tpr, " xs1=%b", sc->sc_ts.t_sts.s_xs1,
                            TSXS1_BITS);
                if (sc->sc_ts.t_sts.s_xs2)
                            TSXS1_BITS);
                if (sc->sc_ts.t_sts.s_xs2)
-                       tprintf(sc->sc_ctty, " xs2=%b", sc->sc_ts.t_sts.s_xs2,
+                       tprintf(sc->sc_tpr, " xs2=%b", sc->sc_ts.t_sts.s_xs2,
                            TSXS2_BITS);
                if (sc->sc_ts.t_sts.s_xs3)
                            TSXS2_BITS);
                if (sc->sc_ts.t_sts.s_xs3)
-                       tprintf(sc->sc_ctty, " xs3=%b", sc->sc_ts.t_sts.s_xs3,
+                       tprintf(sc->sc_tpr, " xs3=%b", sc->sc_ts.t_sts.s_xs3,
                            TSXS3_BITS);
                            TSXS3_BITS);
-               tprintf(sc->sc_ctty, "\n");
+               tprintf(sc->sc_tpr, "\n");
                bp->b_flags |= B_ERROR;
                goto opdone;
        }
                bp->b_flags |= B_ERROR;
                goto opdone;
        }
index e4a2620..9b99f68 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ut.c        7.9 (Berkeley) %G%
+ *     @(#)ut.c        7.10 (Berkeley) %G%
  */
 
 #include "tj.h"
  */
 
 #include "tj.h"
 #include "buf.h"
 #include "conf.h"
 #include "file.h"
 #include "buf.h"
 #include "conf.h"
 #include "file.h"
-#include "user.h"
-#include "proc.h"
 #include "map.h"
 #include "ioctl.h"
 #include "mtio.h"
 #include "cmap.h"
 #include "uio.h"
 #include "kernel.h"
 #include "map.h"
 #include "ioctl.h"
 #include "mtio.h"
 #include "cmap.h"
 #include "uio.h"
 #include "kernel.h"
-#include "tty.h"
 #include "syslog.h"
 #include "syslog.h"
+#include "tprintf.h"
 
 #include "machine/pte.h"
 #include "../vax/cpu.h"
 
 #include "machine/pte.h"
 #include "../vax/cpu.h"
@@ -74,7 +72,7 @@ struct        tj_softc {
        u_short sc_dens;        /* sticky selected density */
        daddr_t sc_timo;        /* time until timeout expires */
        short   sc_tact;        /* timeout is active flag */
        u_short sc_dens;        /* sticky selected density */
        daddr_t sc_timo;        /* time until timeout expires */
        short   sc_tact;        /* timeout is active flag */
-       caddr_t sc_ctty;        /* user's controlling tty (vnode) */
+       tpr_t   sc_tpr;         /* tprintf handle */
        int     sc_blks;        /* number of I/O operations since open */
        int     sc_softerrs;    /* number of soft I/O errors since open */
 } tj_softc[NTJ];
        int     sc_blks;        /* number of I/O operations since open */
        int     sc_softerrs;    /* number of soft I/O errors since open */
 } tj_softc[NTJ];
@@ -179,8 +177,7 @@ get:
        sc->sc_blks = 0;
        sc->sc_softerrs = 0;
        sc->sc_dens = dens;
        sc->sc_blks = 0;
        sc->sc_softerrs = 0;
        sc->sc_dens = dens;
-       sc->sc_ctty = (caddr_t)(u.u_procp->p_flag&SCTTY ? 
-                       u.u_procp->p_session->s_ttyvp : 0);
+       sc->sc_tpr = tprintf_open();
        /*
         * For 6250 bpi take exclusive use of the UNIBUS.
         */
        /*
         * For 6250 bpi take exclusive use of the UNIBUS.
         */
@@ -211,6 +208,7 @@ utclose(dev, flag)
        if (sc->sc_blks > 100 && sc->sc_softerrs > sc->sc_blks / 100)
                log(LOG_INFO, "tj%d: %d soft errors in %d blocks\n",
                    TJUNIT(dev), sc->sc_softerrs, sc->sc_blks);
        if (sc->sc_blks > 100 && sc->sc_softerrs > sc->sc_blks / 100)
                log(LOG_INFO, "tj%d: %d soft errors in %d blocks\n",
                    TJUNIT(dev), sc->sc_softerrs, sc->sc_blks);
+       tprintf_close(sc->sc_tpr);
        sc->sc_openf = 0;
        return (0);
 }
        sc->sc_openf = 0;
        return (0);
 }
@@ -525,7 +523,7 @@ utintr(ut11)
                 */
                if (sc->sc_erreg & UTER_COR && (bp->b_flags & B_READ) &&
                    (addr->uttc & UTTC_DEN) != UT_NRZI) {
                 */
                if (sc->sc_erreg & UTER_COR && (bp->b_flags & B_READ) &&
                    (addr->uttc & UTTC_DEN) != UT_NRZI) {
-                       tprintf(sc->sc_ctty,
+                       tprintf(sc->sc_tpr,
                          "ut%d: soft error bn%d cs1=%b er=%b cs2=%b ds=%b\n",
                          tjunit, bp->b_blkno, cs1, UT_BITS, sc->sc_erreg,
                          UTER_BITS, cs2, UTCS2_BITS, sc->sc_dsreg, UTDS_BITS);
                          "ut%d: soft error bn%d cs1=%b er=%b cs2=%b ds=%b\n",
                          tjunit, bp->b_blkno, cs1, UT_BITS, sc->sc_erreg,
                          UTER_BITS, cs2, UTCS2_BITS, sc->sc_dsreg, UTDS_BITS);
@@ -567,7 +565,7 @@ utintr(ut11)
                /*
                 * Couldn't recover error.
                 */
                /*
                 * Couldn't recover error.
                 */
-               tprintf(sc->sc_ctty,
+               tprintf(sc->sc_tpr,
                        "ut%d: hard error bn%d cs1=%b er=%b cs2=%b ds=%b\n",
                        tjunit, bp->b_blkno, cs1, UT_BITS, sc->sc_erreg,
                        UTER_BITS, cs2, UTCS2_BITS, sc->sc_dsreg, UTDS_BITS);
                        "ut%d: hard error bn%d cs1=%b er=%b cs2=%b ds=%b\n",
                        tjunit, bp->b_blkno, cs1, UT_BITS, sc->sc_erreg,
                        UTER_BITS, cs2, UTCS2_BITS, sc->sc_dsreg, UTDS_BITS);