4.3BSD-UWisc/man/cat4/mtio.4

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




MTIO(4)             UNIX Programmer's Manual              MTIO(4)



NAME
     mtio - UNIX magtape interface

DESCRIPTION
     The files _m_t_0, ..., _m_t_1_5 refer to the UNIX magtape drives,
     which may be on the MASSBUS using the TM03 formatter _h_t(4),
     or TM78 formatter, _m_t(4), or on the UNIBUS using either the
     TM11 or TS11 formatters _t_m(4), TU45 compatible formatters,
     _u_t(4), or _t_s(4).  The following description applies to any
     of the transport/controller pairs.  The files _m_t_0, ..., _m_t_7
     are 800bpi (or the transport's lowest density), _m_t_8, ...,
     _m_t_1_5 are 1600bpi (or the transport's second density), and
     _m_t_1_6, ..., _m_t_2_3 are 6250bpi (or the transport's third den-
     sity).  (But note that only 1600 bpi is available with the
     TS11.) The files _m_t_0, ..., _m_t_3, _m_t_8, ..., _m_t_1_1, and _m_t_1_6,
     ..., _m_t_1_9 are rewound when closed; the others 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.

     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 uses
     most of the tape in record gaps.

     The _m_t 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 are named _r_m_t_0, ...,
     _r_m_t_2_3, but the same minor-device considerations as for the
     regular files still apply.  A number of other ioctl opera-
     tions are available on raw magnetic tape.  The following
     definitions are from <_s_y_s/_m_t_i_o._h>:

     /*
      * Structures and definitions for mag tape io control commands
      */

     /* structure for MTIOCTOP - mag tape op command */
     struct    mtop {
          short     mt_op;         /* operations defined below */
          daddr_t   mt_count; /* how many of them */
     };

     /* operations */
     #define MTWEOF 0    /* write an end-of-file record */
     #define MTFSF  1    /* forward space file */
     #define MTBSF  2    /* backward space file */



Printed 12/27/86          May 16, 1986                          1






MTIO(4)             UNIX Programmer's Manual              MTIO(4)



     #define MTFSR  3    /* forward space record */
     #define MTBSR  4    /* backward space record */
     #define MTREW  5    /* rewind */
     #define MTOFFL 6    /* rewind and put the drive offline */
     #define MTNOP  7    /* no operation, sets status only */
     #define MTCACHE     8    /* enable controller cache */
     #define MTNOCACHE   9    /* disable controller cache */

     /* structure for MTIOCGET - mag tape get status command */

     struct    mtget     {
          short     mt_type;  /* type of magtape device */
     /* the following two registers are grossly device dependent */
          short     mt_dsreg; /* ``drive status'' register */
          short     mt_erreg; /* ``error'' register */
     /* end device-dependent registers */
          short     mt_resid; /* residual count */
     /* the following two are not yet implemented */
          daddr_t   mt_fileno;     /* file number of current position */
          daddr_t   mt_blkno; /* block number of current position */
     /* end not yet implemented */
     };

     /*
      * Constants for mt_type byte.  These are the same
      * for other controllers compatible with the types listed.
      */
     #define   MT_ISTS        0x01      /* TS-11 */
     #define   MT_ISHT        0x02      /* TM03 Massbus: TE16, TU45, TU77 */
     #define   MT_ISTM        0x03      /* TM11/TE10 Unibus */
     #define   MT_ISMT        0x04      /* TM78/TU78 Massbus */
     #define   MT_ISUT        0x05      /* SI TU-45 emulation on Unibus */
     #define   MT_ISCPC  0x06      /* SUN */
     #define   MT_ISAR        0x07      /* SUN */
     #define   MT_ISTMSCP     0x08      /* DEC TMSCP protocol (TU81, TK50) */

     /* mag tape io control commands */
     #define   MTIOCTOP  _IOW(m, 1, struct mtop)       /* do a mag tape op */
     #define   MTIOCGET  _IOR(m, 2, struct mtget) /* get tape status */
     #define MTIOCIEOT   _IO(m, 3)           /* ignore EOT error */
     #define MTIOCEEOT   _IO(m, 4)           /* enable EOT error */

     #ifndef KERNEL
     #define   DEFTAPE   "/dev/rmt12"
     #endif

     Each _r_e_a_d or _w_r_i_t_e 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 seeks are ignored.  A



Printed 12/27/86          May 16, 1986                          2






MTIO(4)             UNIX Programmer's Manual              MTIO(4)



     zero byte count is returned when a tape mark is read, but
     another read will fetch the first record of the new tape
     file.

FILES
     /dev/mt?
     /dev/rmt?

SEE ALSO
     mt(1), tar(1), tp(1), ht(4), tm(4), ts(4), mt(4), ut(4)

BUGS
     The status should be returned in a device independent for-
     mat.

     The special file naming should be redone in a more con-
     sistent and understandable manner.






































Printed 12/27/86          May 16, 1986                          3