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