rmt(7) DG/UX 4.30 rmt(7)
NAME
rmt - character special magnetic tape interface
DESCRIPTION
This character special device provides direct access to a
file on a tape on a magnetic tape drive. The rmt interface
offers flexibility when reading "foreign" tapes because it
allows you to control the physical tape record (block) size.
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 EBUSY 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 one or two
EOF markers. The number of EOF markers written is variable
because some tape drives do not allow data (including EOF
markers) to be overwritten. In this case, only one EOF
marker is written.
When you issue close for a "no-rewind-on-close" tape device,
the tape is spaced forward and positioned after the next EOF
marker encountered if all of the following are true:
- you opened the device for read-only operation;
- the tape is not positioned immediately after an EOF
marker;
- the previous operation on this tape device was not one of
the MTIOCTOP ioctl commands (except for MTTEN, MTERA,
MTCACHE, and MTNOCACHE).
See the 88open Binary Compatibility Standard for more
information.
Licensed material--property of copyright holder(s) Page 1
rmt(7) DG/UX 4.30 rmt(7)
If the "no-rewind-on-close" tape device was opened for
read-write operation, and the last tape operation was a
write, one or two EOF markers are written, and the tape is
left positioned between the EOF markers (if two were
written) or after the EOF marker (if only one was 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. 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 unless the tape drive does not allow
data to be overwritten. In this case, a tape record can only
be written at BOT or appended after the End-of-Recorded-
Media (EORM). Attempting to write a record at any other
location on the tape will result in an ENXIO error. 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, one or two EOF markers are
implicitly written (and the tape positioned as described in
close) 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 ioctl
commands are defined in <sys/ioctl.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;
};
Licensed material--property of copyright holder(s) Page 2
rmt(7) DG/UX 4.30 rmt(7)
The mtop field specifies one of the operations listed
below; the mtcount 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.
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 (at the beginning
of the specified file). 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.
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.
MTEND
Move to end of media. A command to space to the end of
recorded media is issued to the tape device. The
implementation of this command is device-specific, and
Licensed material--property of copyright holder(s) Page 3
rmt(7) DG/UX 4.30 rmt(7)
is not supported by all tape devices. 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 mtmodel field returns the Data General model number of
the tape drive, stored as a binary number. The mtstatus1
field contains the first 16-bit status word from the tape
drive. For st class tape drives, this is the upper four
bits of the third byte of SCSI extended sense information.
The mtstatus2 field contains the second 16-bit status word
from the tape drive. For st class tape drives, this is the
SCSI sense key from the extended sense information.
Select always returns READY for both read and write
operations.
FILES
/dev/rmt/* Tape device names for character-
special access
/usr/include/sys/ioctl.h ioctl definitions
SEE ALSO
st(7), intro(7).
Licensed material--property of copyright holder(s) Page 4