V8/usr/man/man4/mt.4

Compare this file to the similar file:
Show the results in this format:

.TH MT 4 
.SH NAME
mt \- magtape interface
.SH SYNOPSIS
.B #include <sys/mtio.h>
.SH DESCRIPTION
The files
.IR mt \(**
refer to magnetic tape drives.
Filenames beginning with
.I mt
are rewound when closed;
those beginning with
.I nmt
are not.
When a file open for writing is closed, two end-of-files are written.
If the tape is not to be rewound,
it is positioned with the head between the two
tapemarks.
.PP
The remainder of the filename
is made up of
the tape drive unit number,
and one of
.B lmh
indicating a density of 800,
1600,
or
6250 bpi.
Hence
.I mt0l
is unit 0 at 800 bpi,
.I mt2h
is unit 2 at 6250.
.PP
A standard tape consists of a
series of 1024 byte records terminated by an
end-of-file.
To the extent possible, the system makes
it possible, if inefficient, to treat
the tape like any other file.
Seeks have their usual meaning and it is possible
to read or write a byte at a time.
Writing in very small units is inadvisable,
however, because it tends to create monstrous record
gaps.
.PP
The
.I mt
files discussed above are useful
when it is desired to access the tape in a way
compatible with ordinary files.
When foreign tapes are to be dealt with, and especially
when long records are to be read or written, the
`raw' interface is appropriate.
The associated files
have names beginning with
.I rmt
or
.IR nrmt .
.PP
Each
.I read
or
.I write
call reads or writes the next record on the tape.
In the write case the record has the same length as the
buffer given.
During a read, the record size is passed
back as the number of bytes read, provided it is no greater
than the buffer size;
if the record is long, an error is indicated.
In raw tape I/O, the buffer must begin on a word boundary
and the count must be even.
Seeks are ignored.
A zero byte count is returned when a tape mark is read,
but another read will fetch the first record of the
new tape file.
.PP
.IR Ioctl (2)
calls perform special operations.
The major operations are
.TP "\w'MTIOCEEOT  'u"
MTIOCTOP
do a mag tape operation from the following list, expressed in the
structure
.RS
.LP
.nf
struct	mtop	{
	short	mt_op;		/* operation */
	daddr_t	mt_count;	/* repeat count */
};
.fi
.TP .7i
MTWEO
write an end-of-file record
.PD 0
.TP
MTFS
forward space file
.TP
MTBSF
backward space file
.TP
MTFSR
forward space record
.TP
MTBSR
backward space record
.TP
MTREW
rewind
.TP
MTOFFL
rewind and put the drive offline
.TP
MTNOP
no operation, sets status only
.PD
.RE
.TP
MTIOCGET
get mag tape status; see <sys/mtio.h> for details
.PD 0
.TP
MTIOCIEOT
ignore EOT error
.TP
MTIOCEEOT
enable EOT error
.PD
.SH FILES
/dev/mt?,
/dev/rmt?
.SH "SEE ALSO"
tape(1)
.SH BUGS
If any non-data error is encountered, it refuses to do anything
more until closed.
.PP
In raw I/O, there should be a way
to perform forward and backward record and file spacing and
to write an EOF mark.
.PP
Files with names like
.I rmt2
may exist as well;
their meaning is non-obvious,
and their use is discouraged.