TAPE(HW) XENIX System V TAPE(HW)
Name
tape - Magnetic tape device.
Description
The tape device implements the interface with a tape drive.
QIC-02 cartridge tape drives are supported by the ct device
driver, QIC-40 and QIC-80 tape drives connected to the
floppy disk controller are supported with the ft device
driver, and Irwin tape drives connected to the floppy disk
controller are supported with the mc device driver.
Typically, the tar(C), cpio(C), dd(C), backup(ADM), or
restore(ADM) commands are used to access a tape drive.
A single tape drive with a raw (character, non-blocking)
interface is supported, except for the SCSI tape driver
which supports up to four devices. There are four standard
tape device types. Devices beginning with the ``r'' prefix,
(for ``raw device''), should be used for most normal tape
work, while devices with the ``n'' prefix, (``for no rewind
on hold''), should be used for storing and restoring
multiple files. Devices beginning with the ``x'' prefix are
control devices, which are used for sending ioctl(S)
commands to the tape subsystem.
Devices beginning with the ``e'' prefix (for ECC device)
support a 2/64 error recovery scheme. Thus two 512-byte
blocks out of every 64 blocks can be bad and the driver will
correct the errors. This software ECC support provides a
high degree of error recovery.
The ft and mc floppy tape drivers do not support the ``n''
or ``e'' device types. ECC encoding and decoding is
automatically used with the standard ``r'' device. On the
QIC-40, QIC-80 and Irwin 80MB drives, for every 29K written
to the tape, 3K of ECC data is written with it to provide
error recovery. On the Irwin 10, 20, 40 and 60MB drives,
for every 16K written to the tape, 2K of ECC data is
written.
QIC-40 and QIC-80 tapes must be formatted with the tape(C)
command before use, unless you use pre-formatted tapes.
Similarly, Irwin tapes must be first servo-written and then
formatted with tape(C) before use, unless you use pre-
formatted tapes. The new Irwin driver cannot write tapes
formatted under earlier releases, so preformmated tapes are
strongly recommended.
The following table summarizes the base naming conventions
for the tape drives supported:
ct0,1 QIC24 unit 0,1
ct2,3 QIC11 unit 0,1
Page 1 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
Stp0,1,2,3 SCSI tape unit 0,1,2,3
ft0 QIC-40 or QIC-80 floppy tape unit
mc0 Irwin floppy tape unit
ctmini default mini-cartridge device
mt0,1 reel to reel unit 0,1 1600 bpi
mt2,3 reel to reel unit 0,1 800 bpi
mt4,5 reel to reel unit 0,1 6250 bpi
The default tape device is stored in the file
/etc/default/tape, which is also used by tape(C).
/etc/default/tape should always contain the ``x'' (control)
device name of the default device, and is normally updated
by mkdev(ADM) tape. If the default device is an QIC-40,
QIC-80 or Irwin tape drive, the appropriate device from the
table above will be linked to the ctmini device node. QIC-
02 tape drives will always be accessed by the ct0,1 device
nodes as shown in the table. If a SCSI tape drive is
installed as the default device and there is no QIC-02 drive
installed, it will be linked to the ct0 device node. If
both SCSI and QIC-02 drives are installed, the SCSI device
node cannot be linked to the ct0 device node.
tape(C) describes the commands used to access tape drives.
Definition of ioctl commands
The following ioctl commands can be used with the various
tape device drivers supported under . The letters following
each description indicate which drivers support each ioctl
command:
A All drivers
C QIC-02 cartridge tape driver
S SCSI tape driver
F QIC-40 and QIC-80 mini-cartridge tape drivers
I Irwin mini-cartridge tape driver
MT_STATUS
Returns a device-independent structure holding the
status of the drive. The tape_info structure is
defined in /usr/include/sys/tape.h. (C,S,F)
MT_DSTATUS
Returns a device-dependent structure holding status
information of the drive. (C,S,F)
MT_RESET
Resets the driver software and the tape drive.
Interrupts tape commands in progress. (C,S,F)
MT_REPORT
Returns an integer code which determines the type of
Page 2 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
device which the driver controls. The type numbers are
defined in /usr/include/sys/tape.h. (C,S,F)
MT_RETEN
Winds the tape forward to EOT and then backward to BOT.
(C,S,F)
MT_REWIND
Rewinds the tape to BOT. (C,S,F)
MT_ERASE
Erases the data on the tape and retensions the
cartridge. (C,S,F)
MT_AMOUNT
Returns an integer count of the amount of the last data
transfer. (C,S,F)
MT_FORMAT
Formats the tape. Expects as an argument the number of
tracks to format, which must be an even number. If no
argument is provided, the default is 20 tracks for
QIC-40 drives, and 28 tracks for QIC-80 drives. (F)
MT_GETHDR
Expects as an argument a pointer to a struct ft_header
or struct ir_header and copies the header of the
current tape into it. (F)
MT_PUTHDR
Takes a pointer to a struct ft_header or struct
ir_header and writes it onto the tape. This command
should be used with caution. (F)
MT_GETNEWBB
Takes a pointer to a struct ft_newbbt or struct
ir_newbbt and copies in a list of bad blocks detected
on the last write operation. (F)
MT_PUTNEWBB
Takes a pointer to a struct ft_newbbt or struct
ir_newbbt, reads in the header from the tape, then
writes a new bad block onto the tape with the new bad
blocks from the provided bad block table. (F)
MT_GETVTBL
Takes a pointer to a struct ft_vtbl and copies in the
volume table from the tape. (F)
MT_PUTVTBL
Takes a pointer to a struct ft_vtbl and writes the
volume table onto the tape. This command should be
Page 3 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
used with caution. (F)
MT_RFM
Winds the tape forward to the next file mark. (C,S)
MT_WFM
Writes a file mark at the current location on the tape.
(C,S)
MT_LOAD
On devices which are capable of doing so, loads the
tape into the drive. (S)
MT_UNLOAD
On devices which are capable of doing so, unloads the
tape from the drive. (S)
Irwin-specific ioctl Interface
Device specific functions of the Irwin tape drive are
accessed via special commands passed to the Irwin driver
using the ioctl() interface. An Irwin driver interface
library is available. This library provides a system
independent interface to ioctl() via the entry point
mcioctl():
#include "mc.h"
int mcioctl(fh, cmd, arg)
int fh; /* File handle from open() */
int cmd; /* MCCTL_* command code */
void *arg; /* Additional argument pointer */
mcioctl(fh, MCCTL_NOP, NULL)
mcioctl(fh, MCCTL_VERSION, verbuf)
mcioctl(fh, MCCTL_CAPACITY, capp)
mcioctl(fh, MCCTL_LSEEK, lskbuf);
mcioctl(fh, MCCTL_REWIND)
mcioctl(fh, MCCTL_RETEN)
mcioctl(fh, MCCTL_REWIND_NW)
mcioctl(fh, MCCTL_RETEN_NW)
mcioctl(fh, MCCTL_GETDRVCFG, cfgbuf)
mcioctl(fh, MCCTL_GETCFG, cfgbuf)
mcioctl(fh, MCCTL_SETCFG, cfgbuf)
mcioctl(fh, MCCTL_GETTHDR, hdrbuf)
mcioctl(fh, MCCTL_PUTTHDR, hdrbuf)
mcioctl(fh, MCCTL_GETDLISTS, listbuf)
mcioctl(fh, MCCTL_FLUSH)
mcioctl(fh, MCCTL_FORMAT, fmtbuf)
mcioctl(fh, MCCTL_FMTSTAT, fmtbuf)
mcioctl(fh, MCCTL_ABORT)
mcioctl(fh, MCCTL_DEVSTAT, dstatp)
mcioctl(fh, MCCTL_GETERCTL, erctlp)
Page 4 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
mcioctl(fh, MCCTL_SETERCTL, erctlp)
mcioctl(fh, MCCTL_GETER, ierrp)
struct mcver *verbuf; /* version buffer */
long *capp; /* capacity in bytes */
struct mclseek *lskbuf; /* tape logical position descriptor */
struct mccfg *cfgbuf; /* configuration buffer */
char *hdrbuf; /* 1024 byte header buffer */
unsigned short * listbuf; /* 2048 byte defect list buffer */
struct mcfmt *fmtbuf; /* format control/status buffer */
unsigned short *dstatp; /* device status word */
unsigned short *erctlp; /* error control word */
unsigned short *ierrp; /* device specific error */
mcioctl() provides system independent ioctl interface to the
Irwin driver. This subroutine is essentially a pass-trough.
That is, arguments are passed through to ioctl(). If a
device specific error occurs (i.e., a non-system error) at
completion of the system ioctl() and the command is other
than MCCTL_NOP or MCCTL_VERSION, mcioctl() executes
ioctl(MCCTL_GETER) to retrieve the device specific error.
The following ioctl commands are available for the Irwin
driver:
MCCTL_NOP
No operation. The argument is ignored. A success
status is returned. This command may be used as an aid
in determining if a special file refers to the MC
driver.
MCCTL_VERSION
Gets driver version information. The argument is the
address of version information buffer (see struct mcver
in /usr/include/sys/mc.h) to which the driver writes.
MCCTL_CAPACITY
Gets a tape's capacity in bytes. The argument is the
address of a long integer.
MCCTL_REWIND
MCCTL_RETEN
MCCTL_REWIND_NW
MCCTL_RETEN_NW
These four commands physically position the tape at
high speed. MCCTL_RETEN and MCCTL_RETEN_NW run the
tape to the early warning hole first. All four
commands return the tape to the load-point hole.
MCCTL_REWIND_NW and MCCTL_RETEN_NW start a request but
don't wait for completion.
MCCTL_GETDRVCFG
MCCTL_GETCFG
Page 5 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
MCCTL_SETCFG
These three commands provide access to configuration
parameters for a particular a mini cartridge tape unit.
The structure of these parameters is struct mccfg
(defined in /usr/include/sys/mc.h) This structure has
driver, tape drive, and cartridge related fields. Both
MCCTL_GETDRVCFG and MCCTL_GETCFG copies the driver's
the MCCFG structure to the caller's buffer. When
MCCTL_GETDRVCFG is used, struct mccfg members with
driver and tape drive related fields are returned. No
error is given when a cartridge is absent. When
MCCTL_GETCFG is used successfully, all fields are
returned with valid data. An error is returned if no
cartridge is present. MCCTL_SETCFG allows the caller
to adjust certain fields in the driver's configuration.
MCCTL_GETTHDR
MCCTL_PUTTHDR
MCCTL_GETTHDR and MCCTL_PUTTHDR read and write the 1024
byte tape header in block 0. MCCTL_PUTTHDR assumes an
Irwin style header. The the following procedure is
used to write the header:
Tape block 0 is read to a buffer. The caller's 1024
byte header buffer is copied to the first, fifth,
and when space permits, the ninth and thirteenth
1024-byte sectors in the buffer. When the cartridge
format uses ECC (i.e., other than 110 cartridge
format), the header's ECC in use field is set. When
the cartridge format uses ECC, ECC is encoded. A
check sum is calculated for the buffer. The buffer
is written back to block 0. Block 0 is reread and
the cartridge state is redetermined. A new checksum
is calculated and compared against the original.
MCCTL_GETDLISTS
Returns lists used by the driver's flaw management.
The caller gives the address of a buffer which is at
least 2 KB in length. Four lists are copied to the
buffer. Each list is comprised of physical tape block
numbers stored as unsigned short integers and
terminated with the value 0xffff. The lists are
contiguous and given in the following order:
Primary Defect List (PDL)
Working Defect List (WDL)
Grown Defect List (GDL)
Relocation List (RL)
MCCTL_FLUSH
Flushes dirty buffers to tape. MCCTL_FLUSH forces
dirty buffers in the Irwin driver's cache to be written
to tape. The pointer argument is ignored. Control
returns when data is written. Buffers are
Page 6 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
automatically flushed upon a close() or when the device
is idle for a certain period (see mc_autoflush in
struct mccfg in /usr/include/sys/mc.h).
MCCTL_FORMAT
MCCTL_FMTSTAT
MCCTL_FORMAT starts a erase, servo-format-certify-
initialize header or re-certify operations. The
argument is the address of struct mcfmt (see
/usr/include/sys/mc.h). Formatting operations
performed depend upon the values in the structure's
fm_cmd and fm_option fields, and struct mccfg
mc_cartstate field. When an MCCTL_FORMAT command
completes successfully, MCCTL_FMTSTAT is used to
determine the progress (when a no-wait flag is set) or
results of formatting. Like MCCTL_FORMAT,
MCCTL_FMTSTAT also uses the struct mcfmt structure
(typically the same one passed to MCCTL_FORMAT).
MCCTL_ABORT
Used to interrupt and terminate operations started by
MCCTL_FORMAT. The pointer argument is ignored. Control
returns after formatting has terminated.
MCCTL_DEVSTAT
Returns a 16-bit device status word to an unsigned
short integer who's address is passed in the third
argument of ioctl(). This field is intended for use by
applications which use the tape drive interactively.
The status bits are defined in struct mclseek in
/usr/include/sys/mc.h.
MCCTL_GETERCTL
MCCTL_SETERCTL
MCCTL_GETERCTL and MCCTL_SETERCTL give application
access to the state of and control over certain error
mechanisms. The argument is the address of a 16-bit
error control variable which the Irwin driver writes
with current values for MCCTL_GETERCTL and reads for
MCCTL_SETERCTL. Certain flags may or may not have an
effect depending on the implementation. Bit values for
the error control variable are defined in
/usr/include/sys/mc.h.
MCCTL_GETER
Gets device specific error: IE_*. In general the value
0 is returned to indicate success or -1 to indicate an
error. When mcioctl() returns the value -1, an error
has occurred. The error condition may have been
detected in the operating system or in the driver. In
order to discriminate the origin the global _mcerrno
should be examined first (before errno). When non-
Page 7 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
zero, the error was returned by the driver. Values for
_mcerrno are defined in /usr/include/ierrno.h with an
IE_ prefix.
Irwin Drive and Cartridge Models
This section is concerned with Irwin tape drives and
cartridges supported.
Drive Models
Many Irwin mini cartridge drives have a three digit model
number. Each digit has a meaning. The high order digit
encodes the form factor and cabinetry:
1xx 5-1/4 inch drive (mounted in system cabinet).
2xx 3-1/2 inch drive (mounted in system cabinet).
3xx 5-1/4 inch drive in a metal cabinet w/ power supply.
4xx 3-1/2 inch drive in a plastic cabinet (no supply).
7xx 3-1/2 inch drive in a metal cabinet w/ power supply.
The middle digit gives the approximate capacity, in 10
Megabyte units for a standard capacity (not extra long)
tape:
x1x 10 Megabytes
x2x 20
x4x 40
x6x 60
x8x 80
The low digit encodes the drive's normal data transfer rate
(i.e., the floppy controller data clock rate).
xx0 250 Kilobits/Second
xx5 500 Kilobits/Second
xx7 1 Megabit/Second
In addition, a new 4-digit model numbering system is in use.
These model numbers are associated with drives which are
adaptable to different system hardware environments with
accessory hardware kits.
2020 3-1/2 inch, 20 Megabyte, 250 Kilobits/Second
2040 3-1/2 inch, 40 Megabyte, 500 Kilobits/Second
2080 3-1/2 inch, 80/120 Megabyte, 500 Kilobits/Second
2120 3-1/2 inch, 80/120 Megabyte, 1 Megabit/Second
Mini Cartridges
There are three primary physical mini cartridges types:
Page 8 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
DC1000 185 feet of 0.150 inch wide tape (same as TC-200)
DC2000 205 feet of 0.250 inch wide tape (same as TC-400)
DC2120 307.5 feet of 0.250 inch wide tape
The DC1000 cartridge is physically thinner than DC2000 and
DC2120 cartridges. The DC2000 and DC2120 have the same
physical form but the DC2120 has a longer tape. These
cartridges are distinguished by there labels. Each physical
cartridge type has at least two cartridge formats:
___________________________________________________________________________
| Mini (Irwin) Cartridge Format Parameters |
|_______|__________|________|________|______|________|____________|________|
| | AccuTrak| | | | | Sectors | |
| Cart- | Reorder | Cart- | Total | | Blocks| per | Dens- |
| ridge | Number | ridge | Tape | Trks| per | Block | ity |
| Format| see note| | Blocks| | Track | Data| ECC| (FTPI)|
|_______|__________|________|________|______|________|______|_____|________|
| 110 | 1000-10 | DC1000| 1264 | 8 | 158 | 8 | 0 | 6400 |
| 120 | 2000-20 | DC2000| 1190 | 14 | 85 | 16 | 2 | 6400 |
| 120XL | 2000-30 | DC2120| 1792 | 14 | 128 | 16 | 2 | 6400 |
| 125 | 1000-20 | DC1000| 1320 | 12 | 110 | 16 | 2 | 10000 |
| 145 | 2000-40 | DC2000| 2480 | 20 | 124 | 16 | 2 | 10000 |
| 145XL | 2000-60 | DC2120| 3720 | 20 | 186 | 16 | 2 | 10000 |
| 165 | 2000-64 | DC2000| 3936 | 24 | 164 | 16 | 2 | 13200 |
| 285 | 2000-80 | DC2000| 2752 | 32 | 86 | 29 | 3 | 11600 |
| 285XL | 2000-120| DC2120| 4160 | 32 | 130 | 29 | 3 | 11600 |
|_______|__________|________|________|______|________|______|_____|________|
Notes: The suffix part of the AccuTrak Reorder
Number is an approximate cartridge capacity
in Megabytes.
All formats use 1024 byte MFM encoded sectors.
Page 9 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
_______________________________________________________________
| Drive Read/Write Compatibility for Mini Cartridge Formats |
|______________________________________________________________|
| Drive Model (See Note) |
|_______|_____|______|_____|______|_____|______|______|________|
| | | 2020| | 2040| | | | |
| | | 720 | 725| 745 | | | | |
| | | 420 | 425| 445 | 765| 2080| 2120| |
| Cart- | 410| 320 | 325| 345 | 465| 785 | 787 | |
| ridge | 310| 220 | 225| 245 | 265| 485 | 487 | Cart- |
| Format| 110| 120 | 125| 145 | 165| 285 | 287 | ridge |
|_______|_____|______|_____|______|_____|______|______|________|
| 110 | rw | rw | r- | r- | r- | r- | r- | DC1000|
| 120 | -- | rw | -- | r- | r- | r- | r- | DC2000|
| 120XL | -- | rw | -- | r- | r- | r- | r- | DC2120|
| 125 | -- | -- | rw | rw | r- | r- | r- | DC1000|
| 145 | -- | -- | -- | rw | r- | r- | r- | DC2000|
| 145XL | -- | -- | -- | rw | r- | r- | r- | DC2120|
| 165 | -- | -- | -- | -- | rw | r- | r- | DC2000|
| 285 | -- | -- | -- | -- | -- | rw | rw | DC2000|
| 285XL | -- | -- | -- | -- | -- | rw | rw | DC2120|
|_______|_____|______|_____|______|_____|______|______|________|
Key:
r Drive reads cartridge format
w Drive writes cartridge format
- Incompatible: When a cartridge is formatted
but incompatible for reading or writing, the
driver reports that the cartridge is either
incompatible or erased.
Extra Long (XL) DC2120 Cartridge Compatibility
Extra long (i.e., DC2120) cartridges are incompatible with
the following drives as the drive will not physically
accommodate the cartridge: 110, 310, 410, 125, 225, 325,
425, and 725
Even though DC2120 cartridges are physically accepted in the
following drives, they may not be formattable:
120, 220, 320, 420, 720, 2020, 145, 245, 345, 445, 745, 2040
Drives manufactured previous to about 1989 don't recognize
the longer tape. However, the MC driver is able to read and
write preformated extra long tapes in these drives, but it
is unable to correctly format them. Formatting will start,
but terminate in error. To determine whether a drive
supports formatting of DC2120 cartridges, use the mcart
utility. If the command mcart drive reports a drive type
Page 10 (printed 2/7/91)
TAPE(HW) XENIX System V TAPE(HW)
with the suffix XL, formatting of DC2120 cartridges is
supported.
Files
/dev/rStp0 /dev/rct0 /dev/erct0 /dev/rmc1
/dev/nrStp0 /dev/nrct0 /dev/xct0 /dev/mcdaemon
/dev/xStp0 /dev/rct2 /dev/rctmini
/dev/rft0 /dev/nrct2 /dev/xctmini
/dev/xft0 /dev/xct0 /dev/rmc0
Include files:
/usr/include/sys/tape.h
/usr/include/sys/ct.h
/usr/include/sys/ft.h
/usr/include/sys/ir.h
/usr/include/sys/mc.h
/usr/include/sys/mcheader.h
Notes
After certain tape operations are executed, the system
returns a prompt before the tape controller has finished its
operation. If the user enters another tape command too
quickly, a ``device busy'' error is returned until the tape
device is finished with its previous operation.
Periodic tape cartridge retensioning and tape head cleaning
are necessary for continued error-free operation of the tape
subsystem. Use tape(C) to retension the tape.
See Also
backup(ADM), cpio(C), dd(C), format(C), tape(C), tar(C),
restore(ADM)
Page 11 (printed 2/7/91)