tape(7) INTERACTIVE UNIX System tape(7)
NAME
tape - cartridge tape storage
DESCRIPTION
Cartridge tape devices and disks are supported by the High
Performance Disk Driver (see hpdd(7)). Magnetic tape car-
tridges provide for backup and exchange of data normally
stored on fixed disks. The tape driver supports the Archive
Viper series of Small Computer System Interface (SCSI) tape
drives, models 2125S, and 2150S. These drives must be
equipped with firmware EPROMs of at least revision 6 level
(for the 2125S) or revision 4 level (for the 2150S). The
firmware revision number is located on a sticker on the
EPROM, on the component side of the tape drive main printed
circuit board. The drive should be configured for an other-
wise unused SCSI ID number and should be jumpered for a
``Disconnect Size'' of no more than 16 KB. See the Archive
Viper Product Manual for more information.
The tape driver can read 60 MB QIC-24 tapes, and read or
write 125 MB QIC-120 or 150 MB QIC-150 (2150S drive only)
tapes. Note that only DC600XTD tapes are certified for 150
MB recording, and that DC600A tapes are certified for 125 MB
recording.
Cartridge tapes are treated as character devices. However,
they actually record fixed-size (512-byte) data blocks. If
a write call is made to the driver with a length that is not
a multiple of 512 bytes, the last block is automatically
padded with zeroes. A read call with a length that is not a
multiple of 512 bytes will result in data from the last
block being discarded by the driver. No attempt is made by
the driver to allocate large blocks of memory to insure
efficient streaming operation of the drive, although the
drives themselves contain 64KB buffers. The dd(1) command
can be used as a filter to provide buffering between a com-
mand and the driver, or the -C option of the cpio(1) command
can be used to allocate large tape buffers.
Device Names and Numbers
All devices handled by the tape driver have the same major
number (currently 41). Each tape drive has a span of 16
minor numbers associated with it. The interpretation of the
minor numbers for tape devices is described in the file
/usr/include/sys/gentape.h. Bits 4-7 (the high-order nibble
of the minor number) indicate the drive number. Thus, minor
devices 0-15 refer to the first drive, devices 16-31 refer
to the second drive, etc. For each drive, bit 3 should be
set if the tape should be rewound when it is closed. This
is set for the /dev/tape device and is the normal usage.
This type of device allows a single file to be written on a
tape. If bit 3 is not set, the tape will not be rewound
when closed. (See below for a complete description of tape
Rev. 1.2 Page 1
tape(7) INTERACTIVE UNIX System tape(7)
behavior on closing the device.) This is reset for the
/dev/ntape device and allows multiple files, separated by
file marks (described below) to exist on a single tape. Bit
2 of the minor number should be set if positioning opera-
tions (rewinding, seeking a file mark) should return immedi-
ately after the requests initiating them have been sent to
the drive. If this bit is not set, the driver will wait for
such operations to be completed before returning control to
user programs. Note that the open system call always waits
for any long-term operation that may be in progress to com-
plete before it attempts to open the drive. Bits 0 and 1
can indicate a tape density code, although this value is
ignored. The values are as follows:
0 <Default (see below)>
1 60 MB tape
2 120 MB tape
3 150 MB tape
The default value indicates that the drive should determine
the density based on the type of cartridge used.
File Marks and End-of-Medium
A special marker, known as a file mark or End of File (EOF)
is normally written at the end of each data file written to
the tape. If a file mark is detected in the middle of a
multi-block read operation, a short block count will be
returned. Subsequent read operations (or any read that
encounters a file mark prior to any data blocks) will return
EOF. If an attempt is made to perform a write operation
that gets closer than about 1 MB to the physical end of the
tape, all data for that command will be written to the tape.
Subsequent write operations will return End of Medium.
Tape Position on Close
When the tape device is closed, its position depends on
several factors: whether it is to be rewound (bit 3 in
minor device number), whether it was opened for a read or a
write, whether it is currently positioned at a file mark or
the End of Medium, and whether the last operation performed
was an ioctl (described below).
If the last operation performed on the drive was a standard
read or write (or simply open), the type of open done to the
drive is checked. If it was opened for write, a file mark
is written. If it was opened for read and a file mark was
not the last thing read, and the tape is not to be rewound
on closing, a Seek to End-of-File is initiated. If the last
operation performed on the drive was an ioctl call, no
further positioning or file mark writing is performed.
Finally, the tape is rewound if bit 3 of the minor device
number is set.
Rev. 1.2 Page 2
tape(7) INTERACTIVE UNIX System tape(7)
Ioctl Calls Supported
The following ioctl calls are defined in the file
/usr/include/sys/gentape.h . Unless stated otherwise, the
arg value of the ioctl call is ignored.
TC_SEOF
This call takes a count as an argument and seeks to the
argth file mark on the tape.
TC_REWIND
This call causes the tape to be rewound to the begin-
ning of tape point.
TC_WFM
This call takes a count as an argument and writes count
file marks onto the tape. This command also causes any
unwritten data in the drive's cache to be written to
the tape. An arg of 0 is valid and simply causes the
drive to flush its cache to tape.
TC_ERASE
This call causes the entire tape to be erased. This
command is only valid when the tape is at the ``begin-
ning of tape'' point.
TC_RETENSION
This call causes the tape to be shuttled from beginning
to end and back again, causing clean packing of the
tape against the hubs. New tapes should be retensioned
prior to use, as should tapes that have small portions
of their length used extensively.
TC_WAIT
This call will not return until a previously issued
long-term command (TC_SEOF, TC_REWIND, TC_ERASE, or
TC_RETENSION) has completed. This command only makes
sense when used on a tape device with bit 2 of the
minor device number (for immediate return on long-term
operations) set.
TC_GETPARMS
This call requires a pointer at struct tc_parms (see
the file /usr/include/sys/gentape.h) as an argument.
It will return with information about the drive and the
tape currently loaded in it. Note that this informa-
tion may not be meaningful until the drive has actually
attempted read or write operations to the tape.
Configuration
In order to use the tape device, it must be configured into
the kernel. To do this, the High Performance Disk Driver
configuration file (/etc/conf/pack.d/gendev/space.c) must
contain an external definition such as the following:
Rev. 1.2 Page 3
tape(7) INTERACTIVE UNIX System tape(7)
extern int tape_init();
and the line:
tape_init,
must appear in the initialization of the gdev_init_routines
table defined near the end of that file. The entry for
tape_init must appear prior to the NULL line in the initial-
ization. This instructs the High Performance Disk Driver to
invoke the initialization routine for tapes when the system
boots.
In addition, the file /etc/conf/pack.d/tape/space.c contains
a configuration definition for each tape-supporting con-
troller board permitted.
Note also that a driver module for a tape-supporting con-
troller board must also be enabled when the kernel is built,
so that this low-level module will be included.
FILES
/usr/include/sys/gentape.h
/etc/conf/pack.d/gendev/space.c
/etc/conf/pack.d/tape/space.c
/etc/conf/cf.d/mdevice
/dev/tape
/dev/ntape
SEE ALSO
cpio(1), dd(1), aha1540(7), athd(7), hpdd(7), tmc8x0(7).
ADDED VALUE
This entry, supplied by INTERACTIVE Systems Corporation, is
an extension of UNIX System V.
Rev. 1.2 Page 4