rmt(7)
_________________________________________________________________
rmt Special File
character special magnetic tape interface
_________________________________________________________________
DESCRIPTION
This character special device provides direct access to a file on
a tape on a magnetic tape drive, but in a slightly different
manner from mt. This device is typically used to read "foreign"
tapes because it can handle tape records and formats of all
types.
This device considers a magnetic tape to consist of one or more
tape records of varying lengths. End-of-file (EOF) markers on
the tape are considered to be tape records of length 0.
The position of the tape can be determined after each read or
write because each causes clearly specified tape movements.
The open system call performs the necessary device-dependent
checks to ensure that a tape is loaded and can be read or written
as requested. Only one open may be outstanding on a tape drive
at any one time; if an attempt is made to open a tape drive that
is already open, the error ENXIO is returned. The tape drive
must be online and in a ready state so that I/O requests can
proceed without operator intervention. If the tape cannot be
opened, the error EIO or ENXIO is returned, depending on the
reason the tape is not ready for use.
The close system call completes a set of operations on a tape.
If the tape device is a "rewind-on-close" device and if the last
operation was a write, the tape is rewound to the beginning-of-
tape (BOT) marker after writing two EOF markers. Otherwise, if
the last tape operation was an open or a read that did not read
an EOF marker, the tape is spaced forward and positioned after
the next EOF marker encountered. If the last tape operation was
a write, two EOF markers are written and the tape is left
positioned between the EOF markers just written, as described
under write below. If the last tape operation was a read that
read an EOF marker, the position of the tape is not changed by
close.
The read system call always reads the next physical tape record
and transfers the data into the caller's buffer regardless of the
current file pointer. If the physical tape record is larger than
the caller's buffer, the excess data is lost. If the physical
tape record is smaller than the caller's buffer, the remaining
section of the caller's buffer is unmodified. The number of
bytes actually transferred into the caller's buffer is returned.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
rmt(7)
The tape is always positioned after the tape record just read,
ready to read the next record. If an EOF marker is read, no data
is transferred, zero is returned as the number of bytes actually
transferred, and the tape is positioned after the EOF marker.
The write system call always writes one physical tape record at
the current position of the tape regardless of the current file
pointer. The size of the physical tape record is the size of the
caller's buffer. The tape is always positioned after the tape
record just written, ready to write the next record. Every write
operation invalidates all tape records that follow it with the
effect that a read of such a record will return an I/O error.
Following the write, two EOF markers are implicitly written (and
the tape positioned between them) if the next tape operation is
not another write.
The tape specific ioctl commands MTIOCTOP and MTIOCGET provide
tape utility operations and tape status information,
respectively. The commands and structures for these ioctls are
defined in <sys/mtio.h>.
A pointer to the structure mtop is the parameter that is passed
on the MTIOCTOP command:
struct mtop
{
short mt_op;
daddr_t mt_count;
};
The mt_op field specifies one of the operations listed below; the
mt_count field specifies the number of times to perform that
operation.
MTWEOF
Write EOF markers. The tape is left positioned after the
last EOF marker written. A maximum of 8 EOF markers may be
written at one time. If count is greater than 8, it is
treated as 8 and no error is returned.
MTFSF
Space forward files. The tape is spaced forward until the
specified number of EOF markers are encountered and is left
positioned after the last EOF marker.
MTBSF
Space backward files. The tape is spaced backward past the
specified number of EOF markers plus one, and then spaced
forward over the last EOF marker, leaving the tape
positioned after the EOF marker. If the BOT is encountered,
the tape is left at BOT. If the tape is already at BOT when
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
rmt(7)
a backspacing operation is initiated, an I/O error status is
returned and the tape is left at BOT.
MTFSR
Space forward records. If an EOF marker is encountered, the
operation terminates immediately and the tape is left
positioned after the EOF marker.
MTBSR
Space backward records. If an EOF marker is encountered,
the operation terminates immediately and the tape is left
positioned before the EOF marker. If the BOT is
encountered, the tape is left at BOT. If the tape is
already at BOT when a backspacing operation is initiated, an
I/O error status is returned and the tape is left at BOT.
MTREW
The tape is rewound to the BOT. The count is ignored for
this command.
MTOFFL
The tape is rewound and placed off-line. Not all models of
tape controllers support placing the tape unit off-line.
For such models this command is equivalent to MTREW and no
error is reported. The count is ignored for this command.
MTNOP
This command does nothing.
A pointer to the structure mtget is the parameter that is passed
on the MTIOCGET command:
struct mtget
{
short mt_model;
short mt_status1;
short mt_status2;
};
The mt_model field returns the Data General model number of the
tape drive, stored as a binary number. The mt_status1 field
contains the first 16-bit status word from the tape drive. For
mtb, mtc, and mtd class tape drives, this is the DIA status word.
For mtj class tape drives, this field is undefined. The
mt_status2 field contains the second 16-bit status word from the
tape drive. For mtb and mtd class tape drives, this is the DIC
status word. For mtj class tape drives, this is the unit status
word. For mtc class tape drives, this field is undefined.
Select always returns READY for both read and write operations.
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)
rmt(7)
FILES
/dev/rmt/* Tape device names for character special access
/usr/include/sys/mtio.h Ioctl definitions
SEE ALSO
mtb(7), mtj(7), intro(7).
DG/UX 4.00 Page 4
Licensed material--property of copyright holder(s)