1tapes(1M)               System Administration Commands               tapes(1M)
2
3
4

NAME

6       tapes - creates /dev entries for tape drives attached to the system
7

SYNOPSIS

9       /usr/sbin/tapes [-r root_dir]
10
11

DESCRIPTION

13       devfsadm(1M)  is  now  the  preferred command for /dev and /devices and
14       should be used instead of tapes.
15
16
17       tapes creates symbolic links in the /dev/rmt directory  to  the  actual
18       tape  device  special  files  under  the /devices directory tree. tapes
19       searches the kernel device tree to see what tape devices  are  attached
20       to  the  system.  For each equipped tape drive, the following steps are
21       performed:
22
23           1.     The /dev/rmt directory is searched for  a  /dev/rmt/n  entry
24                  that  is a symbolic link to the /devices special node of the
25                  current tape drive. If one is  found,  this  determines  the
26                  logical controller number of the tape drive.
27
28           2.     The  rest  of  the special devices associated with the drive
29                  are checked, and incorrect symbolic links  are  removed  and
30                  necessary ones added.
31
32           3.     If  none  are  found,  a  new  logical  controller number is
33                  assigned (the lowest-unused number), and new symbolic  links
34                  are  created for all the special devices associated with the
35                  drive.
36
37
38       tapes does not remove links to  non-existent  devices;  these  must  be
39       removed by hand.
40
41
42       tapes  is  run  each  time a reconfiguration-boot is performed, or when
43       add_drv(1M) is executed.
44
45   Notice to Driver Writers
46       tapes(1M) considers all devices with the node type  DDI_NT_TAPE  to  be
47       tape  devices;  these devices must have their minor name created with a
48       specific format. The minor name encodes operational modes for the  tape
49       device  and consists of an ASCII string of the form [ l,m,h,c,u ][ b ][
50       n ].
51
52
53       The first character set is used to specify  the  tape  density  of  the
54       device,  and  are  named low (l), medium (m), high (h), compressed (c),
55       and ultra (u). These specifiers only express a relative density; it  is
56       up  to the driver to assign specific meanings as needed. For example, 9
57       track tape devices interpret these as actual  bits-per-inch  densities,
58       where l means 800 BPI, m means 1600 BPI , and h means 6250 BPI, whereas
59       4mm DAT tapes defines l as standard format, and m,  h, c and u as  com‐
60       pressed  format.  Drivers  may  choose to implement any or all of these
61       format types.
62
63
64       During normal tape operation (non-BSD behavior), once an EOF  mark  has
65       been reached, subsequent reads from the tape device return an error. An
66       explicit IOCTL must be issued to space over the  EOF  mark  before  the
67       next  file can be read. b instructs the device to observe BSD behavior,
68       where reading at EOF will cause the tape device to automatically  space
69       over the EOF mark and begin reading from the next file.
70
71
72       n  or  no-rewind-on-close  instructs  the  driver  to not rewind to the
73       beginning of tape when the device is closed. Normal behavior  for  tape
74       devices is to reposition to BOT when closing. See mtio(7I).
75
76
77       The  minor  number  for  tape devices should be created by encoding the
78       device's instance number using the tape macro MTMINOR and ORing in  the
79       proper  combination  of density, BSD behavior, and no-rewind flags. See
80       mtio(7I).
81
82
83       To prevent tapes from attempting to automatically generate links for  a
84       device, drivers must specify a private node type and refrain from using
85       the node type string DDI_NT_TAPE when callingddi_create_minor_node(9F).
86

OPTIONS

88       The following options are supported:
89
90       -r root_dir    Causes tapes to presume that the /dev/rmt directory tree
91                      is found under root_dir, not directly under /.
92
93

ERRORS

95       If  tapes  finds  entries  of a particular logical controller linked to
96       different physical controllers, it prints an error  message  and  exits
97       without  making  any  changes  to  the  /dev directory, since it cannot
98       determine which of the two alternative logical to physical mappings  is
99       correct.  The  links  should  be  manually  corrected or removed before
100       another reconfiguration boot is performed.
101

EXAMPLES

103       Example 1 Creating Tape Device Nodes From Within the Driver's  attach()
104       Function
105
106
107       This  example  demonstrates  creating tape device nodes from within the
108       xktape driver's attach(9E) function.
109
110
111         #include <sys/mtio.h>
112         struct tape_minor_info {
113             char *minor_name;
114             int   minor_mode;
115         };
116         /*
117          * create all combinations of logical tapes
118         */
119         static struct tape_minor_info example_tape[] = {
120            {"",    0},                     /* default tape */
121            {"l",   MT_DENSITY1},
122            {"lb",  MT_DENSITY1 | MT_BSD},
123            {"lbn", MT_DENSITY1 | MT_BSD | MT_NOREWIND},
124            {"m",   MT_DENSITY2},
125            {"mb",  MT_DENSITY2 | MT_BSD},
126            {"mbn", MT_DENSITY2 | MT_BSD | MT_NOREWIND},
127            {"h",   MT_DENSITY3},
128            {"hb",  MT_DENSITY3 | MT_BSD},
129            {"hbn", MT_DENSITY3 | MT_BSD | MT_NOREWIND},
130            {"c",   MT_DENSITY4},
131            {"cb",  MT_DENSITY4 | MT_BSD},
132            {"cbn", MT_DENSITY4| MT_BSD | MT_NOREWIND},
133            {NULL,  0},
134         };
135
136         int
137         xktapeattach(dev_info_t *dip, ddi_attach_cmd_t cmd)
138         {
139            int instance;
140            struct tape_minor_info *mdp;
141               /* other stuff in attach... */
142            instance = ddi_get_instance(dip);
143
144            for (mdp = example_tape; mdp->minor_name != NULL; mdp++) {
145                     ddi_create_minor_node(dip, mdp->minor_name, S_IFCHR,
146                          (MTMINOR(instance) | mdp->minor_mode), DDI_NT_TAPE, 0);
147          }
148
149
150
151       Installing the xktape driver on a Sun Fire 4800, with the  driver  con‐
152       trolling  a  SCSI  tape  (target 4 attached to an isp(7D) SCSI HBA) and
153       performing a reconfiguration-boot creates the following  special  files
154       in /devices.
155
156
157         # ls -l /devices/ssm@0,0/pci@18,700000/pci@1/SUNW,isptwo@4
158         crw-rw-rw-   1 root sys   33,136 Aug 29 00:02  xktape@4,0:
159         crw-rw-rw-   1 root sys   33,200 Aug 29 00:02  xktape@4,0:b
160         crw-rw-rw-   1 root sys   33,204 Aug 29 00:02  xktape@4,0:bn
161         crw-rw-rw-   1 root sys   33,152 Aug 29 00:02  xktape@4,0:c
162         crw-rw-rw-   1 root sys   33,216 Aug 29 00:02  xktape@4,0:cb
163         crw-rw-rw-   1 root sys   33,220 Aug 29 00:02  xktape@4,0:cbn
164         crw-rw-rw-   1 root sys   33,156 Aug 29 00:02  xktape@4,0:cn
165         crw-rw-rw-   1 root sys   33,144 Aug 29 00:02  xktape@4,0:h
166         crw-rw-rw-   1 root sys   33,208 Aug 29 00:02  xktape@4,0:hb
167         crw-rw-rw-   1 root sys   33,212 Aug 29 00:02  xktape@4,0:hbn
168         crw-rw-rw-   1 root sys   33,148 Aug 29 00:02  xktape@4,0:hn
169         crw-rw-rw-   1 root sys   33,128 Aug 29 00:02  xktape@4,0:l
170         crw-rw-rw-   1 root sys   33,192 Aug 29 00:02  xktape@4,0:lb
171         crw-rw-rw-   1 root sys   33,196 Aug 29 00:02  xktape@4,0:lbn
172         crw-rw-rw-   1 root sys   33,132 Aug 29 00:02  xktape@4,0:ln
173         crw-rw-rw-   1 root sys   33,136 Aug 29 00:02  xktape@4,0:m
174         crw-rw-rw-   1 root sys   33,200 Aug 29 00:02  xktape@4,0:mb
175         crw-rw-rw-   1 root sys   33,204 Aug 29 00:02  xktape@4,0:mbn
176         crw-rw-rw-   1 root sys   33,140 Aug 29 00:02  xktape@4,0:mn
177         crw-rw-rw-   1 root sys   33,140 Aug 29 00:02  xktape@4,0:n
178
179
180
181       /dev/rmt  will contain the logical tape devices (symbolic links to tape
182       devices in /devices).
183
184
185         # ls -l /dev/rmt
186         /dev/rmt/0    -> ../../devices/[....]/xktape@4,0:
187         /dev/rmt/0b   -> ../../devices/[....]/xktape@4,0:b
188         /dev/rmt/0bn  -> ../../devices/[....]/xktape@4,0:bn
189         /dev/rmt/0c   -> ../../devices/[....]/xktape@4,0:c
190         /dev/rmt/0cb  -> ../../devices/[....]/xktape@4,0:cb
191         /dev/rmt/0cbn -> ../../devices/[....]/xktape@4,0:cbn
192         /dev/rmt/0cn  -> ../../devices/[....]/xktape@4,0:cn
193         /dev/rmt/0h   -> ../../devices/[....]/xktape@4,0:h
194         /dev/rmt/0hb  -> ../../devices/[....]/xktape@4,0:hb
195         /dev/rmt/0hbn -> ../../devices/[....]/xktape@4,0:hbn
196         /dev/rmt/0hn  -> ../../devices/[....]/xktape@4,0:hn
197         /dev/rmt/0l   -> ../../devices/[....]/xktape@4,0:l
198         /dev/rmt/0lb  -> ../../devices/[....]/xktape@4,0:lb
199         /dev/rmt/0lbn -> ../../devices/[....]/xktape@4,0:lbn
200         /dev/rmt/0ln  -> ../../devices/[....]/xktape@4,0:ln
201         /dev/rmt/0m   -> ../../devices/[....]/xktape@4,0:m
202         /dev/rmt/0mb  -> ../../devices/[....]/xktape@4,0:mb
203         /dev/rmt/0mbn -> ../../devices/[....]/xktape@4,0:mbn
204         /dev/rmt/0mn  -> ../../devices/[....]/xktape@4,0:mn
205         /dev/rmt/0n   -> ../../devices/[....]/xktape@4,0:n
206
207

FILES

209       /dev/rmt/*    logical tape devices
210
211
212       /devices/*    tape device nodes
213
214

ATTRIBUTES

216       See attributes(5) for descriptions of the following attributes:
217
218
219
220
221       ┌─────────────────────────────┬─────────────────────────────┐
222       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
223       ├─────────────────────────────┼─────────────────────────────┤
224       │Availability                 │SUNWcsu                      │
225       └─────────────────────────────┴─────────────────────────────┘
226

SEE ALSO

228       add_drv(1M),   devfsadm(1M),   attributes(5),   isp(7D),    devfs(7FS),
229       mtio(7I), attach(9E), ddi_create_minor_node(9F)
230
231
232
233

BUGS

235       tapes silently ignores malformed minor device names.
236
237
238
239SunOS 5.11                        8 Nov 2002                         tapes(1M)
Impressum