From bc64d5dbedc7422613c4fe2474dfc227fd6339fb Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Mon, 8 Jan 1996 12:46:15 +0000 Subject: [PATCH] MTRETENS for the wt driver. This patch got lost with my previous commit. --- sys/i386/isa/wt.c | 44 ++++++++++++-------------------------------- sys/i386/isa/wtreg.h | 9 ++------- 2 files changed, 14 insertions(+), 39 deletions(-) diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index a1f2c7050492..08e49f942ce1 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -19,7 +19,7 @@ * the original CMU copyright notice. * * Version 1.3, Thu Nov 11 12:09:13 MSK 1993 - * $Id: wt.c,v 1.26 1995/12/10 13:39:27 phk Exp $ + * $Id: wt.c,v 1.27 1995/12/22 15:39:45 bde Exp $ * */ @@ -446,11 +446,9 @@ done: /* * Ioctl routine. Compatible with BSD ioctls. - * Direct QIC-02 commands ERASE and RETENSION added. - * There are three possible ioctls: + * There are two possible ioctls: * ioctl (int fd, MTIOCGET, struct mtget *buf) -- get status * ioctl (int fd, MTIOCTOP, struct mtop *buf) -- do BSD-like op - * ioctl (int fd, WTQICMD, int qicop) -- do QIC op */ int wtioctl (dev_t dev, int cmd, caddr_t arg, int flags, struct proc *p) { @@ -464,32 +462,6 @@ int wtioctl (dev_t dev, int cmd, caddr_t arg, int flags, struct proc *p) switch (cmd) { default: return (EINVAL); - case WTQICMD: /* direct QIC command */ - op = (int) *(void**)arg; - switch (op) { - default: - return (EINVAL); - case QIC_ERASE: /* erase the whole tape */ - if (! (t->flags & TPWRITE) || (t->flags & TPWP)) - return (EACCES); - if (error = wtwait (t, PCATCH, "wterase")) - return (error); - break; - case QIC_RETENS: /* retension the tape */ - if (error = wtwait (t, PCATCH, "wtretens")) - return (error); - break; - } - /* Both ERASE and RETENS operations work like REWIND. */ - /* Simulate the rewind operation here. */ - t->flags &= ~(TPRO | TPWO | TPVOL); - if (! wtcmd (t, op)) - return (EIO); - t->flags |= TPSTART | TPREW; - if (op == QIC_ERASE) - t->flags |= TPWANY; - wtclock (t); - return (0); case MTIOCIEOT: /* ignore EOT errors */ case MTIOCEEOT: /* enable EOT errors */ return (0); @@ -539,15 +511,23 @@ int wtioctl (dev_t dev, int cmd, caddr_t arg, int flags, struct proc *p) if (error = wtwritefm (t)) return (error); return (0); + case MTRETENS: /* re-tension tape */ + if (error = wtwait (t, PCATCH, "wtretens")) + return (error); + op = QIC_RETENS; + goto erase_retens; + case MTERASE: /* erase to EOM */ if (! (t->flags & TPWRITE) || (t->flags & TPWP)) return (EACCES); if (error = wtwait (t, PCATCH, "wterase")) return (error); - /* ERASE operations work like REWIND. */ + op = QIC_ERASE; + erase_retens: + /* ERASE and RETENS operations work like REWIND. */ /* Simulate the rewind operation here. */ t->flags &= ~(TPRO | TPWO | TPVOL); - if (! wtcmd (t, QIC_ERASE)) + if (! wtcmd (t, op)) return (EIO); t->flags |= TPSTART | TPREW; t->flags |= TPWANY; diff --git a/sys/i386/isa/wtreg.h b/sys/i386/isa/wtreg.h index cbc19ca6a69b..06f702141192 100644 --- a/sys/i386/isa/wtreg.h +++ b/sys/i386/isa/wtreg.h @@ -19,7 +19,7 @@ * the original CMU copyright notice. * * Version 1.3, Thu Nov 11 12:09:13 MSK 1993 - * $Id: wtreg.h,v 1.4 1993/12/13 18:38:44 alm Exp $ + * $Id: wtreg.h,v 1.5 1995/05/30 08:03:24 rgrimes Exp $ * */ @@ -50,14 +50,9 @@ * rights to redistribute these changes. */ -/* ioctl for direct QIC commands */ -#define WTQICMD _IO('W', 0) - -/* QIC-02 commands allowed for WTQICMD */ +/* internal QIC-02 commands */ #define QIC_ERASE 0x22 /* erase the tape */ #define QIC_RETENS 0x24 /* retension the tape */ - -/* internal QIC-02 commands */ #define QIC_RDDATA 0x80 /* read data */ #define QIC_READFM 0xa0 /* read file mark */ #define QIC_WRTDATA 0x40 /* write data */