mt(7)
_________________________________________________________________
mt Special File
block special magnetic tape interface
_________________________________________________________________
DESCRIPTION
This block special device provides direct access to a file on a
tape on a magnetic tape drive.
This device considers a magnetic tape to consist of one or more
files, each delimited by an end-of-file marker recorded on the
tape. Each file on the tape is considered to consist of one or
more tape records 2048 bytes long. (If any tape records are not
2048 bytes long, no errors are returned, but the data returned to
the user or written to the tape is undefined.) Opening the
device establishes the file at the current position of the tape
drive to be the file that is to be accessed. Other operations
(read, write, etc.) can access any portion of the file at random,
but may not access portions of the tape past the end-of-file
marker or preceeding the position of the tape when it was opened.
In this way the tape file closely resembles an ordinary disk
file.
The physical position of the tape within the tape file cannot be
determined while the tape is open. The system will perform tape
movements as necessary to get the data requested, but the user
must not depend upon a particular operation evoking a particular
tape movement.
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. The position of the tape at the
time of the open establishes the file that is to be accessed and
the location of "offset 0" within that file. 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
file. If the tape device is a "rewind-on-close" device, the tape
is rewound to the beginning-of-tape marker after ensuring that
two end-of-file markers are written after the last record
written, if any. Otherwise the tape is spaced forward and
positioned just after the end-of-file marker associated with the
current file, which, if this is a multi-file tape, will be at the
beginning of the next file on the tape.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
mt(7)
The read system call may read any portion of the tape file on any
byte boundary for any number of bytes, without regard for the
tape record boundaries. The file pointer associated with the
descriptor used in the read system call is used to determine the
location of the data to be read; hence the lseek system call
works as for an ordinary disk file. Read operations must start
between offset 0 and the logical end-of-file. Read operations
that start at or continue past the logical end-of-file will
return zeros for the data past end-of-file. Read operations that
start past the logical end-of-file will return the error ENXIO.
The write system call works in the same way as read, without
regard for block boundaries. However, every write operation
establishes a new logical end-of-file for the current file and
destroys every file following the current file on the tape. Two
physical end-of-file markers will be correctly placed after the
last data written when the tape is closed. Write operations must
begin between offset 0 and the logical end-of-file. Write
operations that start past the logical end-of-file will return
the error ENXIO. Attempting to write past the physical end-
of-tape marker will return the error ENOSPC.
There are no ioctl system calls specific to block special type
tapes. Other ioctl calls that apply to ordinary disk files also
apply to block special tapes.
Select always returns READY for both read and write operations.
FILES
/dev/mt/* Tape device names for block special access
SEE ALSO
mtb(7), mtj(7), lseek(2), intro(7).
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)