122 lines
3.6 KiB
HTML
122 lines
3.6 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>mtio(4)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>mtio(4)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
mtio - magnetic tape commands
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>#include</STRONG> <STRONG><sys/types.h></STRONG>
|
|
<STRONG>#include</STRONG> <STRONG><sys/mtio.h></STRONG>
|
|
<STRONG>#include</STRONG> <STRONG><sys/ioctl.h></STRONG>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
The magnetic tape devices described in <STRONG><A HREF="../man4/sd.4.html">sd(4)</A></STRONG> may be sent commands or
|
|
queried for their status using the following ioctl calls:
|
|
|
|
<STRONG>ioctl</STRONG>(<EM>fd</EM>, <STRONG>MTIOCTOP</STRONG>, &<STRONG>struct</STRONG> <STRONG>mtop</STRONG>)
|
|
<STRONG>ioctl</STRONG>(<EM>fd</EM>, <STRONG>MTIOCGET</STRONG>, &<STRONG>struct</STRONG> <STRONG>mtget</STRONG>)
|
|
|
|
The struct mtop, struct mtget and associated definitions are defined in
|
|
<sys/mtio.h> as follows:
|
|
|
|
/* Tape operations: ioctl(fd, MTIOCTOP, &struct mtop) */
|
|
|
|
struct mtop {
|
|
short mt_op; /* Operation (MTWEOF, etc.) */
|
|
int mt_count; /* Repeat count. */
|
|
};
|
|
|
|
#define MTWEOF 0 /* Write End-Of-File Marker */
|
|
#define MTFSF 1 /* Forward Space File mark */
|
|
#define MTBSF 2 /* Backward Space File mark */
|
|
#define MTFSR 3 /* Forward Space Record */
|
|
#define MTBSR 4 /* Backward Space Record */
|
|
#define MTREW 5 /* Rewind tape */
|
|
#define MTOFFL 6 /* Rewind and take Offline */
|
|
#define MTNOP 7 /* No-Operation, set status only */
|
|
#define MTRETEN 8 /* Retension (completely wind and rewind) */
|
|
#define MTERASE 9 /* Erase the tape and rewind */
|
|
#define MTEOM 10 /* Position at End-Of-Media */
|
|
#define MTMODE 11 /* Select tape density */
|
|
#define MTBLKZ 12 /* Select tape block size */
|
|
|
|
/* Tape status: ioctl(fd, MTIOCGET, &struct mtget) */
|
|
|
|
struct mtget {
|
|
short mt_type; /* Type of tape device. */
|
|
|
|
/* Device dependent "registers". */
|
|
short mt_dsreg; /* Drive status register. */
|
|
short mt_erreg; /* Error register. */
|
|
|
|
/* Misc info. */
|
|
off_t mt_resid; /* Residual count. */
|
|
off_t mt_fileno; /* Current File Number. */
|
|
off_t mt_blkno; /* Current Block Number within file. */
|
|
off_t mt_blksize; /* Current block size. */
|
|
};
|
|
|
|
|
|
See <STRONG><A HREF="../man1/mt.1.html">mt(1)</A></STRONG> for a detailed description on what each operation does. The
|
|
mt_type field is always zero, there is no use for it yet. Mt_dsreg is 0
|
|
(OK), 1 (Error), or 2 (EOF encountered.) Mt_erreg holds the SCSI sense
|
|
key of the last operation. Mt_blksize is the current tape block size in
|
|
bytes, zero if the block size is variable.
|
|
|
|
Note that one can issue these commands on a file descriptor that is in
|
|
use to read or write data, something that <STRONG>mt</STRONG> can't do. So you can add
|
|
eof markers in the middle of an output stream, or get the status of a
|
|
device before a rewind-on-close tape rewinds.
|
|
|
|
The driver will automatically add an end of file marker to a tape that is
|
|
written to if you execute a space command. If you write eof markers
|
|
yourself then the driver will not add one extra on close.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man1/mt.1.html">mt(1)</A></STRONG>, <STRONG><A HREF="../man4/sd.4.html">sd(4)</A></STRONG>.
|
|
|
|
|
|
</PRE>
|
|
<H2>AUTHOR</H2><PRE>
|
|
Kees J. Bot (kjb@cs.vu.nl)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|