


      MT(7)                      (Bull-SPS9)                      MT(7)



      NAME
           mt - magnetic tape interface files

      DESCRIPTION
           Mt0 through mt47, and rmt0 through rmt47 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 mt 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 mt 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
           rmt0, ..., rmt47.  Each read or write 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 a magnetic tape
           operation or read the status from the magnetic tape unit.
           The following definitions are from sys/mtio.h:

           /* IOCTL call for magnetic tape */

             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                                         (73 A2 02MTA REV1)






      MT(7)                      (Bull-SPS9)                      MT(7)



             struct mtop *opstruct;/* pointer to structure for MTIOCTOP */
                  or
             struct mtget *opstruct;/* pointer to structure for MTIOCGET */

           /* structure for MTIOCTOP - mag tape op command */

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













































      Page 2                                         (73 A2 02MTA REV1)






      MT(7)                      (Bull-SPS9)                      MT(7)



           /* constants for mt_op */

             #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, gets status only */
             #define MTHSPD   8    /* set high speed */
             #define MTLSPD   9    /* set low speed */

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

             struct  mtget{
             short   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 */
           };

           /* 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 Bull-SPS9
             #define MT_ISUT  0x05 }
             #define MT_ISCPC 0x06 }
             #define MT_ISAR  0x07 }
             #define MT_ISCY  0x08 /* Cipher streaming tape drive */





















      Page 3                                         (73 A2 02MTA REV1)






      MT(7)                      (Bull-SPS9)                      MT(7)



           /* 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 GCR    - GCR
                22 P3/44  - Undefined Signal Connected To P3-44
                23 HISP   - High Speed
                24 RWD    - Rewinding
                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.

           */



      DEVICE CODE
               128 device files per controller
               major device number: 9
               minor device number is calculated by:

               minor# = (((second_controller) ? 128 : 0) +
                         (((set_density)      ? (high_density ?   8 : 4 : 0) : 0) +
                         ((rewind_on_close)   ?   2 : 0) +
                         ((raw_device)        ?   1 : 0) +
                         (unit * 16));














      Page 4                                         (73 A2 02MTA REV1)






      MT(7)                      (Bull-SPS9)                      MT(7)



      FILES
           /dev/mt?*
           /dev/rmt?*
           /usr/include/sys/mtio.h

                                                        non-   non-
                   den-      rew-      raw    raw       raw    raw
             unit  sity      ind       minor  name      minor  name
             ---   -----     -----     -----  -----     -----  ----------
             0     manual    n         1      rmt32     0      mt32
                   manual    y         3      rmt33     2      mt33
                   low       n         5      rmt0      4      mt0
                   low       y         7      rmt1      6      mt1
                   high      n         9      rmt16     8      mt16
                   high      y         11     rmt17     10     mt17

             1     manual    n         17     rmt34     16     mt34
                   manual    y         18     rmt35     18     mt35
                   low       n         21     rmt2      20     mt2
                   low       y         23     rmt3      22     mt3
                   high      n         25     rmt18     24     mt18
                   high      y         27     rmt19     26     mt19

             2     manual    n         33     rmt36     32     mt36
                   manual    y         35     rmt37     34     mt37
                   low       n         37     rmt4      36     mt4
                   low       y         39     rmt5      48     mt5
                   high      n         41     rmt20     40     mt20
                   high      y         43     rmt21     42     mt21

             3     manual    n         49     rmt38     48     mt39
                   manual    y         51     rmt39     50     mt39
                   low       n         53     rmt6      52     mt6
                   low       y         55     rmt7      54     mt7
                   high      n         57     rmt22     56     mt22
                   high      y         59     rmt23     58     mt23

             4     manual    n         65     rmt40     64     mt40
                   manual    y         67     rmt41     66     mt41
                   low       n         69     rmt8      68     mt8
                   low       y         71     rmt9      70     mt9
                   high      n         73     rmt24     72     mt24
                   high      y         75     rmt25     74     mt25

             5     manual    n         81     rmt42     80     mt42
                   manual    y         83     rmt43     83     mt43
                   low       n         85     rmt10     84     mt10
                   low       y         87     rmt11     86     mt11
                   high      n         89     rmt26     88     mt26
                   high      y         91     rmt27     90     mt27





      Page 5                                         (73 A2 02MTA REV1)






      MT(7)                      (Bull-SPS9)                      MT(7)



             6     manual    n         97     rmt44     96     mt44
                   manual    y         99     rmt45     98     mt45
                   low       n         101    rmt12     100    mt12
                   low       y         103    rmt13     102    mt13
                   high      n         105    rmt28     104    mt28
                   high      y         107    rmt29     106    mt29

             7     manual    n         113    rmt46     112    mt46
                   manual    y         115    rmt47     114    mt47
                   low       n         117    rmt14     116    mt14
                   low       y         119    rmt15     118    mt15
                   high      n         121    rmt30     120    mt30
                   high      y         123    rmt31     122    mt31










































      Page 6                                         (73 A2 02MTA REV1)



