


      MMMMTTTT((((7777))))                        ((((RRRRiiiiddddggggeeee))))                        MMMMTTTT((((7777))))



      NNNNAAAAMMMMEEEE
           mt - magnetic tape interface files

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           _M_t_0 through _m_t_3_1, and _r_m_t_0 through _r_m_t_3_1 refer to the
           magnetic tape drive in non-raw and raw modes, respectively.

           When opened for reading or writing, the tape is assumed to
           be positioned as desired.  When a file is closed, a double
           end-of-file (double tape mark) is written if the file was
           opened for writing.  If the file was normal-rewind, the tape
           is rewound.  If it is no-rewind and the file was open for
           writing, the tape is positioned before the second EOF is
           written.  If the file was no-rewind and opened read-only,
           the tape is positioned after the EOF following the data just
           read.  Once opened, reading is restricted to between the
           position when opened and the next EOF or the last write.
           The EOF is returned as a zero-length read.  By judiciously
           choosing mmmmtttt files, it is possible to read and write multi-
           file tapes.

           A standard tape consists of a series of 4096-byte records
           terminated by an EOF.  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 (although very
           inadvisable).

           The mmmmtttt files discussed above are useful when you wish 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
           rrrrmmmmtttt0000, ............, rrrrmmmmtttt33331111.  Each _r_e_a_d or _w_r_i_t_e call reads or writes
           the next record on the tape.  During a write, 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, up
           to the buffer size specified.  Seeks are ignored.  An EOF is
           returned as a zero-length read, with the tape positioned
           after the EOF, so that the next read will return the next
           record.

           Two ioctl operations are possible:  perform mag tape
           operation or read status from mag tape unit.  The following
           definitions of ioctl operations are from ssssyyyyssss////mmmmttttiiiioooo....hhhh:

           /* structure of IOCTL call for magnetic tape operations */

             ioctl (fildes, opcode, opstruct)
             int fildes             /* file descriptor of tape device */
             int opcode             /* MTIOCTOP: do mag tape operation */
                               /* MTIOCGET: read tape unit status */



      Page 1                                                   (9010-E)






      MMMMTTTT((((7777))))                        ((((RRRRiiiiddddggggeeee))))                        MMMMTTTT((((7777))))



             struct mtop *opstruct;      /* pointer to structure for */
                               /* operations except MTNOP */
                  or
             struct mtget *opstruct;     /* pointer to MTNOP structure only */

           /* structure for mag tape op command */

             struct   mtop{
             int      mt_op;             /* operations defined below */
             daddr_t  mt_count;          /* how many of them */
             };












































      Page 2                                                   (9010-E)






      MMMMTTTT((((7777))))                        ((((RRRRiiiiddddggggeeee))))                        MMMMTTTT((((7777))))



           /* IOCTL operations */

              #define   MTWEOF 0    /* write an end of file record */
              #define   MTFSF  1         /* forward space file */
              #define   MTBSF  2         /* backward space file */
              #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   MTHSPD 8         /* set high speed */
              #define   MTLSPD 9         /* set low speed */

           /* structure for mag tape get status command */

              struct   mtget{
              int      mt_type;               /* type of magtape device */
              int      mt_dsreg;         /* drive status register */
              int      mt_erreg;         /* error register */
              int      mt_resid;         /* residual count */
              daddr_t  mt_fileno;        /* file number of current position */
              daddr_t  mt_blkno;         /* block number of current position */
           };

           /*
            * bits of the drive status register
            *
            * 0-7                   - Drive Identification
            * 8-11                  - (undefined)
            * 12     BCO  =    - Byte Count Overflow
            * 13     TPE  =    - Tape Parity Error
            * 14     DMAE =    - DMA Error
            * 15     OUR  =    - Over/Under Run
            * 16     CIP       - Command In Progress
            * 17     FMK  =    - Filemark
            * 18     HER  =    - Hard Error
            * 19     CER  =    - Corrected Error
            * 20     IDENT=    - PE Identification
            * 21     P4/26          - Undefined Signal Connected To P4-26
            * 22     P3/44          - Undefined Signal Connected To P3-14
            * 23     HISP      - High Speed
            * 24     RWD       - Rewind
            * 25     EOT       - End Of Tape
            * 26     LPT       - Load Point
            * 27     FPT       - File Protect
            * 28     ONL       - On Line
            * 29     RDY       - Ready
            * 30     FBSY      - Formatter Ready
            * 31     DBSY      - Data Busy
            *
            *             = Cleared with next command. */




      Page 3                                                   (9010-E)






      MMMMTTTT((((7777))))                        ((((RRRRiiiiddddggggeeee))))                        MMMMTTTT((((7777))))



           /*
            * constants for mt_type byte */

              #define MT_ISTS  0x01 }
              #define MT_ISHT  0x02 }
              #define MT_ISTM  0x03 } for compatibility with 4.2 bsd
              #define MT_ISMT  0x04 } only; not available on Ridge
              #define MT_ISUT  0x05 }
              #define MT_ISCPC 0x06 }
              #define MT_ISAR  0x07 }
              #define MT_ISCY  0x08 /* Cipher streaming tape drive */



      DDDDEEEEVVVVIIIICCCCEEEE CCCCOOOODDDDEEEE
               64 device files per controller
               major device number: 9
               minor device number is calculated by:

             (unsigned character byte)
             bits  0   1  2  3 | 4  5  6  7
             ------------------|-----------
                   0   0  0  0 |          0 buffered (non-raw) device
            con-   0   0  0  1 |          1 raw device
            trol-  0   0  1  0 |       0    no rewind on close
            er #1  0   0  1  1 |       1    rewind on close
                   0   1  0  0 | 0  0       density 800 bpi
                   0   1  0  1 | 0  1       density 1600 bpi
                   0   1  1  0 | 1  0       density 3200 bpi
                   0   1  1  1 | 1  1       density 6250 bpi (not supported)
                   1   0  0  0 |          0 buffered (non-raw) device
                   1   0  0  1 |          1 raw device
            con-   1   0  1  0 |       0    no rewind on close
            trol-  1   0  1  1 |       1    rewind on close
            ler #2 1   1  0  0 | 0  0       density 800 bpi
                   1   1  0  1 | 0  1       density 1600 bpi
                   1   1  1  0 | 1  0       density 3200 bpi
                   1   1  1  1 | 1  1       density 6250 bpi (not supported)

















      Page 4                                                   (9010-E)






      MMMMTTTT((((7777))))                        ((((RRRRiiiiddddggggeeee))))                        MMMMTTTT((((7777))))



      FFFFIIIILLLLEEEESSSS
           /dev/mt??
           /dev/rmt??
           /usr/include/sys/mtio.h

               32 files for raw mode         32 files for non-raw mode
               ---------------------         -------------------------
           minor bytes  re-  unit          minor bytes  re-  unit
            no.  /inch wind   no.  name     no.  /inch wind   no.  name
           ----- ----- ----- ----- -----   ----- ----- ----- ----- -----
           5      1600   n     0   rmt0      4    1600   n     0    mt0
           7      1600   y     0   rmt1      6    1600   y     0    mt1
           9      3200   n     0   rmt16     8    3200   n     0    mt16
           11     3200   y     0   rmt17    10    3200   y     0    mt17
           21     1600   n     1   rmt2     20    1600   n     1    mt2
           23     1600   y     1   rmt3     22    1600   y     1    mt3
           25     3200   n     1   rmt18    24    3200   n     1    mt18
           27     3200   y     1   rmt19    26    3200   y     1    mt19
           37     1600   n     2   rmt4     36    1600   n     2    mt4
           39     1600   y     2   rmt5     48    1600   y     2    mt5
           41     3200   n     2   rmt20    40    3200   n     2    mt20
           43     3200   y     2   rmt21    42    3200   y     2    mt21
           53     1600   n     3   rmt6     52    1600   n     3    mt6
           55     1600   y     3   rmt7     54    1600   y     3    mt7
           57     3200   n     3   rmt22    56    3200   n     3    mt22
           59     3200   y     3   rmt23    58    3200   y     3    mt23
           69     1600   n     4   rmt8     68    1600   n     4    mt8
           71     1600   y     4   rmt9     70    1600   y     4    mt9
           73     3200   n     4   rmt24    72    3200   n     4    mt24
           75     3200   y     4   rmt25    74    3200   y     4    mt25
           85     1600   n     5   rmt10    84    1600   n     5    mt10
           87     1600   y     5   rmt11    86    1600   y     5    mt11
           89     3200   n     5   rmt26    88    3200   n     5    mt26
           91     3200   y     5   rmt27    90    3200   y     5    mt27
           101    1600   n     6   rmt12   100    1600   n     6    mt12
           103    1600   y     6   rmt13   102    1600   y     6    mt13
           105    3200   n     6   rmt28   104    3200   n     6    mt28
           107    3200   y     6   rmt29   106    3200   y     6    mt29
           117    1600   n     7   rmt14   116    1600   n     7    mt14
           119    1600   y     7   rmt15   118    1600   y     7    mt15
           121    3200   n     7   rmt30   120    3200   n     7    mt30
           123    3200   y     7   rmt31   122    3200   y     7    mt31













      Page 5                                                   (9010-E)



