BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / hp300 / dev / st.c
index dcd4d11..2b44ff5 100644 (file)
@@ -7,11 +7,37 @@
  * the Systems Programming Group of the University of Utah Computer
  * Science Department.
  *
  * the Systems Programming Group of the University of Utah Computer
  * Science Department.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
  * from: Utah $Hdr: st.c 1.8 90/10/14$
  *
  *
  * from: Utah $Hdr: st.c 1.8 90/10/14$
  *
- *      @(#)st.c       7.2 (Berkeley) %G%
+ *      @(#)st.c       7.3 (Berkeley) 5/4/91
  */
 
 /*
  */
 
 /*
 #include "param.h"
 #include "systm.h"
 #include "buf.h"
 #include "param.h"
 #include "systm.h"
 #include "buf.h"
-#include "errno.h"
-#include "device.h"
 #include "scsireg.h"
 #include "file.h"
 #include "tty.h"
 #include "scsireg.h"
 #include "file.h"
 #include "tty.h"
-#include "user.h"
 #include "proc.h"
 #include "mtio.h"
 #include "ioctl.h"
 #include "proc.h"
 #include "mtio.h"
 #include "ioctl.h"
-#include "uio.h"
 #include "kernel.h"
 #include "kernel.h"
+#include "tprintf.h"
 
 
+#include "device.h"
 #include "stvar.h"
 
 #define ADD_DELAY
 #include "stvar.h"
 
 #define ADD_DELAY
@@ -98,7 +122,7 @@ struct       st_softc {
        short   sc_tapeid;      /* tape drive id */
        char    sc_datalen[32]; /* additional data length on some commands */
        short   sc_tticntdwn;   /* interrupts between TTi display updates */
        short   sc_tapeid;      /* tape drive id */
        char    sc_datalen[32]; /* additional data length on some commands */
        short   sc_tticntdwn;   /* interrupts between TTi display updates */
-       caddr_t sc_ctty;
+       tpr_t   sc_ctty;
        struct  buf *sc_bp;
        u_char  sc_cmd;
 } st_softc[NST];
        struct  buf *sc_bp;
        u_char  sc_cmd;
 } st_softc[NST];
@@ -350,9 +374,10 @@ failed:
        return(-1);
 }
 
        return(-1);
 }
 
-stopen(dev, flag)
+stopen(dev, flag, type, p)
        dev_t dev;
        dev_t dev;
-       int flag;
+       int flag, type;
+       struct proc *p;
 {
        register struct st_softc *sc = &st_softc[UNIT(dev)];
        register struct st_xsense *xsense;
 {
        register struct st_softc *sc = &st_softc[UNIT(dev)];
        register struct st_xsense *xsense;
@@ -601,8 +626,7 @@ retryselect:
                return(EACCES);
        }
 
                return(EACCES);
        }
 
-       sc->sc_ctty = (caddr_t)(u.u_procp->p_flag&SCTTY ? 
-                       u.u_procp->p_session->s_ttyvp : 0);
+       sc->sc_ctty = tprintf_open(p);
        /* save total number of blocks on tape */
        sc->sc_numblks = mode.md.numblk2 << 16 |
                         mode.md.numblk1 << 8 |
        /* save total number of blocks on tape */
        sc->sc_numblks = mode.md.numblk2 << 16 |
                         mode.md.numblk1 << 8 |
@@ -659,7 +683,7 @@ stclose(dev, flag)
        stxsense(sc->sc_dq.dq_ctlr, sc->sc_dq.dq_slave, sc->sc_punit, sc);
 
        sc->sc_flags &= ~(STF_OPEN|STF_WMODE|STF_WRTTN);
        stxsense(sc->sc_dq.dq_ctlr, sc->sc_dq.dq_slave, sc->sc_punit, sc);
 
        sc->sc_flags &= ~(STF_OPEN|STF_WMODE|STF_WRTTN);
-       sc->sc_ctty = NULL;
+       tprintf_close(sc->sc_ctty);
        return(0);      /* XXX */
 }
 
        return(0);      /* XXX */
 }