BSD 4_3_Reno release
[unix-history] / usr / src / share / man / man4 / man4.tahoe / mtio.4
CommitLineData
615bd8a3
KB
1.\" Copyright (c) 1986 The Regents of the University of California.
2.\" All rights reserved.
40a07efa 3.\"
1c15e888
C
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.
615bd8a3 17.\"
1c15e888 18.\" @(#)mtio.4 6.3 (Berkeley) 6/23/90
40a07efa 19.\"
1c15e888 20.TH MT 4 "June 23, 1990"
40a07efa
KM
21.UC 7
22.SH NAME
23mt \- UNIX magtape interface
24.SH DESCRIPTION
25The files
26.I "cy0s, ..., cy15s"
27refer to the UNIX magtape drives,
28which may be on the VERSABUS using the CIPHER tapemaster formatter
29.IR cy (4),
30The following description applies to any of the transport/controller pairs.
31The files
32.I "cy0s, ..., cy15s"
33are read/written in 25ips,
34The density (1600 bpi or 3200 bpi) is selected by a switch on the drive.
35The files
36.I "cy0s, ..., cy7s"
37are rewound when closed.
38The non-rewinding files are named
39.I ncy[0-7]
40respectively.
41.PP
42For compatibility, the
43.I [n]cy*s
44files are linked to appropriate
45.I [n]mt*
46files.
47.PP
48When a file open for writing is closed, two file-marks are written.
49If the tape is not to be rewound
50it is positioned with the head between the two
51file-marks.
52.PP
53A standard tape consists of a
54series of 1024 byte records terminated by two
55file-marks.
56To the extent possible, the system makes
57it possible, if inefficient, to treat
58the tape like any other file.
59Seeks have their usual meaning and it is possible
60to read or write a byte at a time.
61.PP
62The
63.I mt
64files discussed above are useful
65when it is desired to access the tape in a way
66compatible with ordinary files.
67When foreign tapes are to be dealt with, and especially
68when long records are to be read or written, the
69`raw' interface is appropriate.
70Writing in very small units is inadvisable,
71however, because it tends to create monstrous record
72gaps. The associated files are named
73.I "rcy0s, ..., rcy15s,"
74but the same minor-device considerations as for the regular files still apply,
75as well as the appropriate
76.I r[n]mt*
77links.
78.PP
79A number of other ioctl operations are available
80on raw magnetic tape.
81The 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 */
93struct 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
110struct 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
132Each
133.I read
134or
135.I write
136call reads or writes the next record on the tape.
137In the write case the record has the same length as the
138buffer given.
139During a read, the record size is passed
140back as the number of bytes read, provided it is no greater
141than the buffer size;
142if the record is long, an error is indicated.
143In raw tape I/O seeks are ignored.
144A zero byte count is returned when a tape mark is read,
145but another read will fetch the first record of the
146new tape file.
147.SH FILES
148/dev/mt?,
149/dev/rmt?
150.SH "SEE ALSO"
151mt(1), tar(1), cy(4)
152.SH BUGS