Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mt(4) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ioctlx, ioctl, gtty, stty

open, openx, creat

read, readv, readx

write, writex

tape



MT(4,F)                     AIX Technical Reference                     MT(4,F)



-------------------------------------------------------------------------------
mt



PURPOSE

Supports the IBM System/370 tape storage device driver.

# include <sys/devinfo.h>
# include <sys/b370/mt370.h>
# include <sys/b370/3480.h>

DESCRIPTION

Magnetic tapes are used primarily for backups, file archives, and other
off-line storage.  System/370 tapes are accessed though the raw interface only.

The particular magnetic tape interface used depends on the desired operating
characteristics.  The general form of the device name is /dev/rmt#xy, where:

#    is the device unit number

x    indicates rewind (r), no-rewind (n), or rewind-unload (u) after the last
     close of the device.  (f) indicates FORWARD-SPACE-FILE on open/rewind of
     the device.

y    indicates the tape density, high (h) or medium (m).

Hence, /dev/rmt0rh and /dev/rmt0rm refer to the same drive, but differ in the
density written.  The mt special file is unique to AIX/370.

When opened for reading or writing, the tape is assumed to be positioned as
desired.  When the tape opens and writes to a tape file, a single tape mark is
written if the file is no rewind on close, while a double tape mark is written
if the tape is to be rewound.  If the file is no rewind and opened read only,
the tape is positioned after the end of file (EOF) following the data just
read.  Once opened, reading is restricted to between the position when opened
and the next EOF.  By specifically choosing rmt files, it is possible to read
and write multiple-file tapes.

Each read or write call reads or writes the next record on the tape.  The
record written by write is the same length as the buffer given.  During a read,
record size is returned 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 before the EOF.

A number of IOCTL operations are available.  In addition to IOCTYPE and
IOCINFO, the following calls are defined:

The STIOCTOP command issues a tape command to the appropriate device a specific
number of times.  The communication uses the stop structure:



Processed November 7, 1990          MT(4,F)                                   1





MT(4,F)                     AIX Technical Reference                     MT(4,F)




     struct stop {
       short st_op;        /* tape operation */
       daddr_t st_count;   /* times to perform */
     };

The st_op operation is performed st_count times, except for commands where it
is not logical to do so (rewind, for example).

The operations available are:

    #define STWEOF  0  /* write an end-of-file record */
    #define STFSF   1  /* forward space file */
    #define STBSF   2  /* backward space file */
    #define STFSB   3  /* Forward space block */
    #define STBSB   4  /* Back space block */
    #define STREW   5  /* Rewind */
    #define STOFFL  6  /* Rewind and unload */
    #define STNOP   7  /* NOP */

The status of a tape drive can be determined by issuing the MTIOCGET type ioctl
system call.

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

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

    /*
     * Constants for mt_type byte
     */
    #define MT_ISTS            01
    #define MT_ISHT            02

The MTIOCLD command issues a tape "Load Display" command (for use by IBM 3480
tape drives).  The structure passed to the MTIOCLD command is:

  struct ldcmd
  {
         char ld_func;                  /* Function code */
         char ld_msg1[LDMAXMSGLN];      /* Message 1 */
         char ld_msg2[LDMAXMSGLN];      /* Message 2 */
  };

The message fields contain ASCII characters to be displayed as directed by the
function code.  Possible function codes are:



Processed November 7, 1990          MT(4,F)                                   2





MT(4,F)                     AIX Technical Reference                     MT(4,F)




LDMOTION     (Default)  Maintain the message in message fields 1 and 2 until
             the tape drive is in motion, or the message is updated.

LDREMOVE     Maintain the message in message field 1 until the tape cartridge
             is physically removed from the tape drive, or until the next
             unload/load cycle.

LDLOAD       Maintain the message in message field 1 until the drive is next
             loaded.

LDNOOP       Physically access a drive without changing the message display.
             This option can be used to test whether a control unit can
             physically communicate with a drive.

LDALL        Display the message in message field 1 until a tape cartridge is
             physically removed from the tape drive or until the drive is next
             loaded.  Display the message in message field 2 until the drive is
             next loaded.

LDSINGLE     (Default)  Only one of the two messages is displayed.  The one
             which is displayed is determined by the LDHIGH and LDLOW flags.

LDDOUBLE     Both messages are displayed, alternating them on the message
             display.

LDBLINK      The single message blinks.

LDNOBLINK    (Default)  The single message does not blink.

LDLOW        (Default)  The message in only message field 1 is displayed.

LDHIGH       The message in only message field 2 is displayed (8, 9, 10, and 11
             are used with LDSINGLE).

LDAUTOLD     An automatic load request is passed from the system to the
             automatic load controller.

LDNOAUTOLD   (Default)  No automatic load request is passed.

If an STIOCLD ioctl is to be issued and there is no tape ready in the drive,
use the O_NDELAY flag in the OPEN call.  This will cause the device driver to
bypass checking for drive ready, and allow only IOCTLs through the file
descriptor.

ERROR CONDITIONS

In addition to the errors listed in the "ioctlx, ioctl, gtty, stty," "open,
openx, creat," "read, readv, readx," and "write, writex," system calls to this
device can fail in the following circumstances:





Processed November 7, 1990          MT(4,F)                                   3





MT(4,F)                     AIX Technical Reference                     MT(4,F)



ENXIO     The tape device is not configured.

ENXIO     The tape is not attached to the virtual machine.

ENXIO     The tape is not loaded.

ENXIO     The tape is write-protected when trying to write.

EINVAL    The count is more than the architecture imposed maximum, or a read or
          write on a device open with O_NDELAY was attempted.

EIO       The I/O to the tape failed during the operation.

RELATED INFORMATION

In this book:  "ioctlx, ioctl, gtty, stty," "open, openx, creat," "read, readv,
readx," "write, writex," and "tape."

See "Hardware Requirements" in AIX/370 Planning Guide.




































Processed November 7, 1990          MT(4,F)                                   4



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