The /etc/rmt command accepts requests specific to the manipulation of magnetic tapes, performs the commands, then responds with a status indication. This protocol is provided by rmt commands on many UNIX systems, although UNIX systems may support more commands and may give more different error codes.
All responses are in ASCII and in one of two forms. Successful commands have responses of:
Anumber\n
number is an ASCII representation of a decimal number. Unsuccessful commands are responded to with:
Eerror-number\nerror-message\n
error-number is one of:
2 (ENOENT)
The tape device specified in an open request
did not have a valid syntax.
6 (ENXIO)
The tape device specified in an open request
does not exist.
5 (EIO)
An I/O error occurred when performing the
request.
25 (ENOTTY)
An invalid tape operation was specified in a
``perform special tape operation'' request.
error-message is a (UNIX-style) error string for the error specified by error-number.
The protocol is comprised of the following commands, which are sent as indicated - no spaces are supplied between the command and its arguments, or between its arguments, and \n indicates that a newline should be supplied:
Odevice\nmode\n
Open the specified device using the indicated
mode. device is a tape name of the form described
in na_tape(4) and mode is an ASCII representation
of a decimal number specifying how the tape is to
be opened:
Cdevice\n
Close the currently open device. The device
specified is ignored.
Lwhence\noffset\n
Performs no operation, and returns the value of
offset; UNIX-style lseek operations are ignored on
NetApp filer tape devices, just as they are on
tape devices on many UNIX systems.
Wcount\n
Write data onto the open device. If count exceeds
the maximum data buffer size (64 kilobytes), it is
truncated to that size. /etc/rmt then reads count
bytes from the connection, aborting if a premature
end-of-file is encountered. The response value is
the number of bytes written if the write succeeds,
or -1 if the write fails.
Rcount\n
Read count bytes of data from the open device. If
count exceeds the maximum data buffer size (64
kilobytes), it is truncated to that size.
/etc/rmt then attempts to read count bytes from
the tape and responds with Acount-read\n if the
read was successful; otherwise an error in the
standard format is returned. If the read was successful,
the data read is then sent.
Ioperation\ncount\n
Perform a special tape operation on the open device
using the specified parameters. The parameters
are interpreted as ASCII representations of
the decimal values. operation is one of:
Any other command causes /etc/rmt to close the connection.