Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mt(1)

ioctl(2)

read(2)

write(2)



  mtio(7)                             CLIX                             mtio(7)



  NAME

    mtio - Magnetic tape interface

  DESCRIPTION

    The special files in /dev/rmt refer to magnetic tape drives.  If a default
    autorewind tape device exists, it should be linked with /dev/rmt/0m.  If a
    default no-rewind tape device exists, it should be linked with
    /dev/rmt/0mn.  No-rewind tape devices typically end in n.

    Each write() operation to a tape creates a record with the requested size
    on the tape.  If end-of-tape (EOT) is encountered, no record is written
    and the returned value is 0.  If an attempt is made to perform a write()
    operation beyond EOT, the returned value is -1.  If the data reaches the
    tape, errno is set to ENOSPC.  Otherwise, errno is set to EIO.

    Each read() operation reads a record from the tape.  If the requested size
    is larger than the record, the returned value is the record size.  If the
    requested size is smaller than the record, the returned value is the
    requested size and the remaining data in the record is skipped.  If an
    end-of-file (EOF) mark is encountered, the returned value is 0 and the
    tape is positioned with the head beyond the EOF mark.  Two EOF marks
    encountered in sequence indicate EOT for read() operations.

    When a file open for writing is closed, two EOF marks are written and the
    tape is positioned with the head between them.  This way, if another file
    is written to tape, a single EOF mark separates them.  Otherwise, the
    double EOF mark indicates EOT for read() operations.

    When an autorewind tape device is closed, the tape is rewound to position
    the head at the beginning-of-tape (BOT).  When a no-rewind tape device is
    closed, the tape is not moved from its current position.

    Additional control over the tape device is possible through ioctl().
    Structures and request definitions are defined in <sys/mtio.h>.

    The MTIOCTOP request uses the mtop structure with members as shown below:

    short   mt_op;    /* operation as defined below */
    daddr_t mt_count; /* count argument */

    where mt_op is one of the following:

    MTWEOF    Write EOF mark.

    MTFSF     Forward skip file.

    MTBSF     Backward skip file.

    MTFSR     Forward skip record.



  2/94 - Intergraph Corporation                                              1






  mtio(7)                             CLIX                             mtio(7)



    MTBSR     Backward skip record.

    MTREW     Rewind tape (mt_count is ignored).

    MTOFFL    Unload and offline tape (mt_count is ignored).

    MTRETEN   Retension tape (mt_count is ignored).

    MTERASE   Erase entire tape (mt_count is ignored).

    MTDENS    Density select (mt_count indicates density).

    MTFSEOT   Forward skip to end-of-tape (mt_count is ignored).

    DDS       Digital Data Storage.

    To receive status information about a tape device, use MTIOCGET.  The
    MTIOCGET request uses the mtget structure with members as shown below:

    char type[60];  /* ASCII string for tape drive type */
    int  density;   /* QIC format, EXB format, DDS format, or density in BPI */
    int  recsize;   /* record size (0 indicates variable) */
    int  resid;     /* residual from previous operation */
    int  leftovers; /* size of controller cached data */
    int  flags;     /* for tape drive states */


    Values for density are defined as follows:

      Cartridge     Helical Scan   Half-inch Reel
      QIC Formats   EXB Formats    Densities (BPI)   4mm DDS formats
      ___________   ____________   _______________   ______________________
      11            8200           800               0 (Default)
      24            8205           1600              1 (DDS 1 uncompressed)
      120           8500           3200              2 (DDS 1 compressed)
      150           8505           6250              3 (DDS 2 uncompressed)
                                                     4 (DDS 2 compressed)

    Values for flags are defined as follows:

    MTWP   Write-protect flag.

    To reliably support multivolume capability on all tape devices, it is
    necessary to inquire about and recover any data that may be cached in the
    tape controller when EOT is encountered.  The MTIOCREC request uses the
    mtrec structure with members as shown below:

    char *rec_addr; /* recover buffer address */
    int  rec_count; /* byte count to recover */
    int  rec_op;    /* operation as defined below */




  2                                              Intergraph Corporation - 2/94






  mtio(7)                             CLIX                             mtio(7)



    where rec_op is one of the following:

    MTLEFTOVERS   Inquire about the size of cached data (rec_addr is ignored).

    MTRECOVER     Read back cached data.

    To inquire the size of cached data, use the MTLEFTOVERS command.  The
    rec_count member is filled-in by the driver.  To recover cached data, use
    MTRECOVER with rec_addr pointing to a buffer large enough to store the
    cached data.

  FILES

    /dev/rmt/0m    Default auto-rewind tape device.

    /dev/rmt/0mn   Default no-auto-rewind tape device.

  NOTES

    Not every ioctl() operation works with every tape drive.  Limitations are
    a function of the tape controller and driver.

  RELATED INFORMATION

    Commands:  mt(1)

    Functions:  ioctl(2), read(2), write(2)



























  2/94 - Intergraph Corporation                                              3




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026