|
|
1.1 ! root 1: .\" Copyright (c) 1986 Regents of the University of California. ! 2: .\" All rights reserved. The Berkeley software License Agreement ! 3: .\" specifies the terms and conditions for redistribution. ! 4: .\" ! 5: .\" @(#)mtio.4 6.1 (Berkeley) 11/24/86 ! 6: .\" ! 7: .TH MT 4 "November 24, 1986" ! 8: .UC 7 ! 9: .SH NAME ! 10: mt \- UNIX magtape interface ! 11: .SH DESCRIPTION ! 12: The files ! 13: .I "cy0s, ..., cy15s" ! 14: refer to the UNIX magtape drives, ! 15: which may be on the VERSABUS using the CIPHER tapemaster formatter ! 16: .IR cy (4), ! 17: The following description applies to any of the transport/controller pairs. ! 18: The files ! 19: .I "cy0s, ..., cy15s" ! 20: are read/written in 25ips, ! 21: The density (1600 bpi or 3200 bpi) is selected by a switch on the drive. ! 22: The files ! 23: .I "cy0s, ..., cy7s" ! 24: are rewound when closed. ! 25: The non-rewinding files are named ! 26: .I ncy[0-7] ! 27: respectively. ! 28: .PP ! 29: For compatibility, the ! 30: .I [n]cy*s ! 31: files are linked to appropriate ! 32: .I [n]mt* ! 33: files. ! 34: .PP ! 35: When a file open for writing is closed, two file-marks are written. ! 36: If the tape is not to be rewound ! 37: it is positioned with the head between the two ! 38: file-marks. ! 39: .PP ! 40: A standard tape consists of a ! 41: series of 1024 byte records terminated by two ! 42: file-marks. ! 43: To the extent possible, the system makes ! 44: it possible, if inefficient, to treat ! 45: the tape like any other file. ! 46: Seeks have their usual meaning and it is possible ! 47: to read or write a byte at a time. ! 48: .PP ! 49: The ! 50: .I mt ! 51: files discussed above are useful ! 52: when it is desired to access the tape in a way ! 53: compatible with ordinary files. ! 54: When foreign tapes are to be dealt with, and especially ! 55: when long records are to be read or written, the ! 56: `raw' interface is appropriate. ! 57: Writing in very small units is inadvisable, ! 58: however, because it tends to create monstrous record ! 59: gaps. The associated files are named ! 60: .I "rcy0s, ..., rcy15s," ! 61: but the same minor-device considerations as for the regular files still apply, ! 62: as well as the appropriate ! 63: .I r[n]mt* ! 64: links. ! 65: .PP ! 66: A number of other ioctl operations are available ! 67: on raw magnetic tape. ! 68: The following definitions are from <sys/mtio.h>: ! 69: .PP ! 70: .nf ! 71: /* ! 72: * Structures and definitions for mag tape io control commands ! 73: */ ! 74: ! 75: /* mag tape io control commands */ ! 76: #define MTIOCTOP (('m'<<8)|1) /* do a mag tape op */ ! 77: #define MTIOCGET (('m'<<8)|2) /* get mag tape status */ ! 78: ! 79: /* structure for MTIOCTOP - mag tape op command */ ! 80: struct mtop { ! 81: short mt_op; /* operations defined below */ ! 82: daddr_t mt_count; /* how many of them */ ! 83: }; ! 84: ! 85: /* operations */ ! 86: #define MTWEOF 0 /* write an end-of-file record */ ! 87: #define MTFSF 1 /* forward space file */ ! 88: #define MTBSF 2 /* backward space file */ ! 89: #define MTFSR 3 /* forward space record */ ! 90: #define MTBSR 4 /* backward space record */ ! 91: #define MTREW 5 /* rewind */ ! 92: #define MTOFFL 6 /* rewind and put the drive offline */ ! 93: #define MTNOP 7 /* no operation, sets status only */ ! 94: ! 95: /* structure for MTIOCGET - mag tape get status command */ ! 96: ! 97: struct mtget { ! 98: short mt_type; /* type of magtape device */ ! 99: /* the following two registers are grossly device dependent */ ! 100: short mt_dsreg; /* ``drive status'' register */ ! 101: short mt_erreg; /* ``error'' register */ ! 102: /* end device-dependent registers */ ! 103: short mt_resid; /* residual count */ ! 104: /* the following two are not yet implemented */ ! 105: daddr_t mt_fileno; /* file number of current position */ ! 106: daddr_t mt_blkno; /* block number of current position */ ! 107: /* end not yet implemented */ ! 108: }; ! 109: ! 110: /* ! 111: * Constants for mt_type byte ! 112: */ ! 113: #define MT_ISTS 01 ! 114: #define MT_ISHT 02 ! 115: #define MT_ISTM 03 ! 116: .fi ! 117: .ft R ! 118: .PP ! 119: Each ! 120: .I read ! 121: or ! 122: .I write ! 123: call reads or writes the next record on the tape. ! 124: In the write case the record has the same length as the ! 125: buffer given. ! 126: During a read, the record size is passed ! 127: back as the number of bytes read, provided it is no greater ! 128: than the buffer size; ! 129: if the record is long, an error is indicated. ! 130: In raw tape I/O seeks are ignored. ! 131: A zero byte count is returned when a tape mark is read, ! 132: but another read will fetch the first record of the ! 133: new tape file. ! 134: .SH FILES ! 135: /dev/mt?, ! 136: /dev/rmt? ! 137: .SH "SEE ALSO" ! 138: mt(1), tar(1), cy(4) ! 139: .SH BUGS
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.