MTRETENS for the wt driver. This patch got lost with

my previous commit.
This commit is contained in:
Joerg Wunsch 1996-01-08 12:46:15 +00:00
parent 8348d96afc
commit bc64d5dbed
2 changed files with 14 additions and 39 deletions

View File

@ -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 @@ int wtclose (dev_t dev, int flags, int fmt, struct proc *p)
/*
* 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;

View File

@ -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 */