Andreas Klemm's tape erase patches from 1.1.5.1
Submitted by: andreas
This commit is contained in:
parent
94a92413cd
commit
7366bf01ab
@ -21,7 +21,7 @@
|
||||
/*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*
|
||||
* $Id: scsi_tape.h,v 1.8 1993/11/18 05:02:57 rgrimes Exp $
|
||||
* $Id: scsi_tape.h,v 1.9 1994/09/28 20:16:42 se Exp $
|
||||
*/
|
||||
#ifndef SCSI_SCSI_TAPE_H
|
||||
#define SCSI_SCSI_TAPE_H 1
|
||||
@ -72,6 +72,23 @@ struct scsi_rewind
|
||||
u_char control;
|
||||
} rewind;
|
||||
|
||||
/*
|
||||
** Tape erase - AKL: Andreas Klemm <andreas@knobel.gun.de>
|
||||
*/
|
||||
struct scsi_erase
|
||||
{
|
||||
u_char op_code;
|
||||
u_char byte2;
|
||||
#define SE_LONG 0x01 /*
|
||||
** Archive Viper 2525 doesn't allow short
|
||||
** erase, other tapes possibly don't allow
|
||||
** that, too.
|
||||
*/
|
||||
#define SE_IMMED 0x02
|
||||
u_char unused[3];
|
||||
u_char control;
|
||||
} erase;
|
||||
|
||||
struct scsi_load
|
||||
{
|
||||
u_char op_code;
|
||||
@ -104,6 +121,7 @@ struct scsi_blk_limits
|
||||
#define WRITE_COMMAND_TAPE 0x0a
|
||||
#define WRITE_FILEMARKS 0x10
|
||||
#define SPACE 0x11
|
||||
#define ERASE 0x19 /* AKL */
|
||||
#define LOAD_UNLOAD 0x1b /* same as above */
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: st.c,v 1.20 1994/10/19 00:09:47 wollman Exp $
|
||||
* $Id: st.c,v 1.21 1994/10/23 21:27:59 wollman Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -153,6 +153,7 @@ static struct rogues gallery[] = /* ends with an all-null entry */
|
||||
|
||||
errval st_space __P((u_int32 unit, int32 number, u_int32 what, u_int32 flags));
|
||||
errval st_rewind __P((u_int32 unit, boolean immed, u_int32 flags));
|
||||
errval st_erase __P((u_int32 unit, boolean immed, u_int32 flags)); /* AKL */
|
||||
errval st_mode_sense __P((u_int32 unit, u_int32 flags));
|
||||
errval st_decide_mode __P((u_int32 unit, boolean first_read));
|
||||
errval st_rd_blk_lim __P((u_int32 unit, u_int32 flags));
|
||||
@ -1229,6 +1230,9 @@ stioctl(dev, cmd, arg, flag)
|
||||
case MTREW: /* rewind */
|
||||
errcode = st_rewind(unit, FALSE, flags);
|
||||
break;
|
||||
case MTERASE: /* erase - AKL */
|
||||
errcode = st_erase(unit, FALSE, flags);
|
||||
break;
|
||||
case MTOFFL: /* rewind and put the drive offline */
|
||||
st_unmount(unit, EJECT);
|
||||
break;
|
||||
@ -1795,6 +1799,47 @@ st_rewind(unit, immed, flags)
|
||||
flags));
|
||||
}
|
||||
|
||||
/*
|
||||
** Erase the device - AKL: Andreas Klemm <andreas@knobel.gun.de>
|
||||
*/
|
||||
errval
|
||||
st_erase(unit, immed, flags)
|
||||
u_int32 unit, flags;
|
||||
boolean immed;
|
||||
{
|
||||
struct scsi_erase scsi_cmd;
|
||||
struct st_data *st = st_data[unit];
|
||||
errval error;
|
||||
int32 nmarks;
|
||||
|
||||
error = st_chkeod(unit, FALSE, &nmarks, flags);
|
||||
if (error != ESUCCESS)
|
||||
return (error);
|
||||
/*
|
||||
** AKL: Archive Viper 2525 technical manual 5.7 (ERASE 19h):
|
||||
** tape has to be positioned to BOT first before erase command
|
||||
** is issued or command is rejected. So we rewind the tape first
|
||||
** and exit with an error, if the tape can't be rewinded.
|
||||
*/
|
||||
error = st_rewind(unit, FALSE, SCSI_SILENT);
|
||||
if (error != ESUCCESS)
|
||||
return (error);
|
||||
st->flags &= ~ST_PER_ACTION;
|
||||
bzero(&scsi_cmd, sizeof(scsi_cmd));
|
||||
scsi_cmd.op_code = ERASE;
|
||||
scsi_cmd.byte2 = SE_LONG; /* LONG_ERASE - AKL */
|
||||
scsi_cmd.byte2 += immed ? SE_IMMED : 0; /* immed bit is here the 2nd! */
|
||||
return (scsi_scsi_cmd(st->sc_link,
|
||||
(struct scsi_generic *) &scsi_cmd,
|
||||
sizeof(scsi_cmd),
|
||||
0,
|
||||
0,
|
||||
ST_RETRIES,
|
||||
immed ? 5000 : 300000, /* 5 sec or 5 min */
|
||||
NULL,
|
||||
flags));
|
||||
}
|
||||
|
||||
#ifdef NETBSD
|
||||
#define SIGNAL_SHORT_READ
|
||||
#else
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)mtio.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id$
|
||||
* $Id: mtio.h,v 1.3 1994/08/02 07:53:17 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MTIO_H_
|
||||
@ -72,6 +72,12 @@ struct mtop {
|
||||
/* and range from 0 to 0x17. Sets the value for the openned mode only */
|
||||
|
||||
#define MTSETDNSTY 11
|
||||
|
||||
/*
|
||||
** Tape erase function - AKL: Andreas Klemm <andreas@knobel.gun.de>
|
||||
*/
|
||||
#define MTERASE 12
|
||||
|
||||
#endif
|
||||
|
||||
/* structure for MTIOCGET - mag tape get status command */
|
||||
|
Loading…
Reference in New Issue
Block a user