Merge commit 'dc97a43d4a70c8773a619f11b95b07a787f6f5b7' into merges
[unleashed.git] / share / man / man8 / tapes.8
blobd0244475eb2503fd811ad30a6dbb569ed4e115e9
1 '\" te
2 .\" Copyright (c) 2002 Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH TAPES 8 "Nov 8, 2002"
7 .SH NAME
8 tapes \- creates /dev entries for tape drives attached to the system
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fB/usr/sbin/tapes\fR [\fB-r\fR \fIroot_dir\fR]
13 .fi
15 .SH DESCRIPTION
16 .sp
17 .LP
18 \fBdevfsadm\fR(8) is now the preferred command for \fB/dev\fR and
19 \fB/devices\fR and should be used instead of \fBtapes\fR.
20 .sp
21 .LP
22 \fBtapes\fR creates symbolic links in the \fB/dev/rmt\fR directory to the
23 actual tape device special files under the \fB/devices\fR directory tree.
24 \fBtapes\fR searches the kernel device tree to see what tape devices are
25 attached to the system. For each equipped tape drive, the following steps are
26 performed:
27 .RS +4
28 .TP
30 The \fB/dev/rmt\fR directory is searched for a \fB/dev/rmt/\fR\fIn\fR entry
31 that is a symbolic link to the \fB/devices\fR special node of the current tape
32 drive. If one is found, this determines the logical controller number of the
33 tape drive.
34 .RE
35 .RS +4
36 .TP
38 The rest of the special devices associated with the drive are checked, and
39 incorrect symbolic links are removed and necessary ones added.
40 .RE
41 .RS +4
42 .TP
44 If none are found, a new logical controller number is assigned (the
45 lowest-unused number), and new symbolic links are created for all the special
46 devices associated with the drive.
47 .RE
48 .sp
49 .LP
50 \fBtapes\fR does not remove links to non-existent devices; these must be
51 removed by hand.
52 .sp
53 .LP
54 \fBtapes\fR is run each time a reconfiguration-boot is performed, or when
55 \fBadd_drv\fR(8) is executed.
56 .SS "Notice to Driver Writers"
57 .sp
58 .LP
59 \fBtapes\fR(8) considers all devices with the node type \fBDDI_NT_TAPE\fR to
60 be tape devices; these devices must have their minor name created with a
61 specific format. The minor name encodes operational modes for the tape device
62 and consists of an \fBASCII\fR string of the form [
63 \fBl\fR,\fBm\fR,\fBh\fR,\fBc\fR,\fBu\fR ][ \fBb\fR ][ \fBn\fR ].
64 .sp
65 .LP
66 The first character set is used to specify the tape density of the device, and
67 are named low (\fBl\fR), medium (\fBm\fR), high (\fBh\fR), compressed
68 (\fBc\fR), and ultra (\fBu\fR). These specifiers only express a relative
69 density; it is up to the driver to assign specific meanings as needed. For
70 example, 9 track tape devices interpret these as actual bits-per-inch
71 densities, where \fBl\fR means 800 \fBBPI,\fR \fBm\fR means 1600 \fBBPI ,\fR
72 and \fBh\fR means 6250 \fBBPI,\fR whereas 4mm \fBDAT\fR tapes defines \fBl\fR
73 as standard format, and \fBm\fR, \fB h\fR, \fBc\fR and \fBu\fR as compressed
74 format. Drivers may choose to implement any or all of these format types.
75 .sp
76 .LP
77 During normal tape operation (non-\fBBSD\fR behavior), once an \fBEOF\fR mark
78 has been reached, subsequent reads from the tape device return an error. An
79 explicit IOCTL must be issued to space over the \fBEOF\fR mark before the next
80 file can be read. \fBb\fR instructs the device to observe \fBBSD\fR behavior,
81 where reading at \fBEOF\fR will cause the tape device to automatically space
82 over the \fBEOF\fR mark and begin reading from the next file.
83 .sp
84 .LP
85 \fBn\fR or no-rewind-on-close instructs the driver to not rewind to the
86 beginning of tape when the device is closed. Normal behavior for tape devices
87 is to reposition to BOT when closing. See \fBmtio\fR(7I).
88 .sp
89 .LP
90 The minor number for tape devices should be created by encoding the device's
91 instance number using the tape macro \fBMTMINOR\fR and ORing in the proper
92 combination of density, \fBBSD\fR behavior, and no-rewind flags. See
93 \fBmtio\fR(7I).
94 .sp
95 .LP
96 To prevent \fBtapes\fR from attempting to automatically generate links for a
97 device, drivers must specify a private node type and refrain from using the
98 node type string \fBDDI_NT_TAPE\fR when calling
99 \fBddi_create_minor_node\fR(9F).
100 .SH OPTIONS
103 The following options are supported:
105 .ne 2
107 \fB\fB-r\fR \fIroot_dir\fR\fR
109 .RS 15n
110 Causes \fBtapes\fR to presume that the \fB/dev/rmt\fR directory tree is found
111 under \fIroot_dir\fR, not directly under \fB/\fR.
114 .SH ERRORS
117 If \fBtapes\fR finds entries of a particular logical controller linked to
118 different physical controllers, it prints an error message and exits without
119 making any changes to the \fB/dev\fR directory, since it cannot determine which
120 of the two alternative logical to physical mappings is correct. The links
121 should be manually corrected or removed before another reconfiguration boot is
122 performed.
123 .SH EXAMPLES
125 \fBExample 1 \fRCreating Tape Device Nodes From Within the Driver's
126 \fBattach()\fR Function
129 This example demonstrates creating tape device nodes from within the
130 \fBxktape\fR driver's \fBattach\fR(9E) function.
133 .in +2
135 #include <sys/mtio.h>
136 struct tape_minor_info {
137     char *minor_name;
138     int   minor_mode;
141  * create all combinations of logical tapes
143 static struct tape_minor_info example_tape[] = {
144    {"",    0},                     /* default tape */
145    {"l",   MT_DENSITY1},
146    {"lb",  MT_DENSITY1 | MT_BSD},
147    {"lbn", MT_DENSITY1 | MT_BSD | MT_NOREWIND},
148    {"m",   MT_DENSITY2},
149    {"mb",  MT_DENSITY2 | MT_BSD},
150    {"mbn", MT_DENSITY2 | MT_BSD | MT_NOREWIND},
151    {"h",   MT_DENSITY3},
152    {"hb",  MT_DENSITY3 | MT_BSD},
153    {"hbn", MT_DENSITY3 | MT_BSD | MT_NOREWIND},
154    {"c",   MT_DENSITY4},
155    {"cb",  MT_DENSITY4 | MT_BSD},
156    {"cbn", MT_DENSITY4| MT_BSD | MT_NOREWIND},
157    {NULL,  0},
161 xktapeattach(dev_info_t *dip, ddi_attach_cmd_t cmd)
163    int instance;
164    struct tape_minor_info *mdp;
165       /* other stuff in attach... */
166    instance = ddi_get_instance(dip);
168    for (mdp = example_tape; mdp->minor_name != NULL; mdp++) {
169             ddi_create_minor_node(dip, mdp->minor_name, S_IFCHR,
170                  (MTMINOR(instance) | mdp->minor_mode), DDI_NT_TAPE, 0);
173 .in -2
177 Installing the \fBxktape\fR driver on a Sun Fire 4800, with the driver
178 controlling a \fBSCSI\fR tape (target 4 attached to an \fBisp\fR(7D) \fBSCSI
179 HBA)\fR and performing a reconfiguration-boot creates the following special
180 files in \fB/devices\fR.
183 .in +2
185 # ls -l /devices/ssm@0,0/pci@18,700000/pci@1/SUNW,isptwo@4
186 crw-rw-rw-   1 root sys   33,136 Aug 29 00:02  xktape@4,0:
187 crw-rw-rw-   1 root sys   33,200 Aug 29 00:02  xktape@4,0:b
188 crw-rw-rw-   1 root sys   33,204 Aug 29 00:02  xktape@4,0:bn
189 crw-rw-rw-   1 root sys   33,152 Aug 29 00:02  xktape@4,0:c
190 crw-rw-rw-   1 root sys   33,216 Aug 29 00:02  xktape@4,0:cb
191 crw-rw-rw-   1 root sys   33,220 Aug 29 00:02  xktape@4,0:cbn
192 crw-rw-rw-   1 root sys   33,156 Aug 29 00:02  xktape@4,0:cn
193 crw-rw-rw-   1 root sys   33,144 Aug 29 00:02  xktape@4,0:h
194 crw-rw-rw-   1 root sys   33,208 Aug 29 00:02  xktape@4,0:hb
195 crw-rw-rw-   1 root sys   33,212 Aug 29 00:02  xktape@4,0:hbn
196 crw-rw-rw-   1 root sys   33,148 Aug 29 00:02  xktape@4,0:hn
197 crw-rw-rw-   1 root sys   33,128 Aug 29 00:02  xktape@4,0:l
198 crw-rw-rw-   1 root sys   33,192 Aug 29 00:02  xktape@4,0:lb
199 crw-rw-rw-   1 root sys   33,196 Aug 29 00:02  xktape@4,0:lbn
200 crw-rw-rw-   1 root sys   33,132 Aug 29 00:02  xktape@4,0:ln
201 crw-rw-rw-   1 root sys   33,136 Aug 29 00:02  xktape@4,0:m
202 crw-rw-rw-   1 root sys   33,200 Aug 29 00:02  xktape@4,0:mb
203 crw-rw-rw-   1 root sys   33,204 Aug 29 00:02  xktape@4,0:mbn
204 crw-rw-rw-   1 root sys   33,140 Aug 29 00:02  xktape@4,0:mn
205 crw-rw-rw-   1 root sys   33,140 Aug 29 00:02  xktape@4,0:n
207 .in -2
211 \fB/dev/rmt\fR will contain the logical tape devices (symbolic links to tape
212 devices in \fB/devices\fR).
215 .in +2
217 # ls -l /dev/rmt
218 /dev/rmt/0    -> ../../devices/[....]/xktape@4,0:
219 /dev/rmt/0b   -> ../../devices/[....]/xktape@4,0:b
220 /dev/rmt/0bn  -> ../../devices/[....]/xktape@4,0:bn
221 /dev/rmt/0c   -> ../../devices/[....]/xktape@4,0:c
222 /dev/rmt/0cb  -> ../../devices/[....]/xktape@4,0:cb
223 /dev/rmt/0cbn -> ../../devices/[....]/xktape@4,0:cbn
224 /dev/rmt/0cn  -> ../../devices/[....]/xktape@4,0:cn
225 /dev/rmt/0h   -> ../../devices/[....]/xktape@4,0:h
226 /dev/rmt/0hb  -> ../../devices/[....]/xktape@4,0:hb
227 /dev/rmt/0hbn -> ../../devices/[....]/xktape@4,0:hbn
228 /dev/rmt/0hn  -> ../../devices/[....]/xktape@4,0:hn
229 /dev/rmt/0l   -> ../../devices/[....]/xktape@4,0:l
230 /dev/rmt/0lb  -> ../../devices/[....]/xktape@4,0:lb
231 /dev/rmt/0lbn -> ../../devices/[....]/xktape@4,0:lbn
232 /dev/rmt/0ln  -> ../../devices/[....]/xktape@4,0:ln
233 /dev/rmt/0m   -> ../../devices/[....]/xktape@4,0:m
234 /dev/rmt/0mb  -> ../../devices/[....]/xktape@4,0:mb
235 /dev/rmt/0mbn -> ../../devices/[....]/xktape@4,0:mbn
236 /dev/rmt/0mn  -> ../../devices/[....]/xktape@4,0:mn
237 /dev/rmt/0n   -> ../../devices/[....]/xktape@4,0:n
239 .in -2
241 .SH FILES
243 .ne 2
245 \fB\fB/dev/rmt/*\fR\fR
247 .RS 14n
248 logical tape devices
252 .ne 2
254 \fB\fB/devices/*\fR\fR
256 .RS 14n
257 tape device nodes
260 .SH SEE ALSO
263 \fBadd_drv\fR(8), \fBdevfsadm\fR(8), \fBattributes\fR(5), \fBisp\fR(7D),
264 \fBdevfs\fR(7FS), \fBmtio\fR(7I), \fBattach\fR(9E),
265 \fBddi_create_minor_node\fR(9F)
268 \fI\fR
269 .SH BUGS
272 \fBtapes\fR silently ignores malformed minor device names.