]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/MAKEDEV
Add a comment as to where stdarg.h applies.
[FreeBSD/FreeBSD.git] / etc / MAKEDEV
1 #!/bin/sh -
2 #
3 # Copyright (c) 1990 The Regents of the University of California.
4 # All rights reserved.
5 #
6 # Written and contributed by W. Jolitz 12/90
7 #
8 # Redistribution and use in source and binary forms are permitted provided
9 # that: (1) source distributions retain this entire copyright notice and
10 # comment, and (2) distributions including binaries display the following
11 # acknowledgement:  ``This product includes software developed by the
12 # University of California, Berkeley and its contributors'' in the
13 # documentation or other materials provided with the distribution and in
14 # all advertising materials mentioning features or use of this software.
15 # Neither the name of the University nor the names of its contributors may
16 # be used to endorse or promote products derived from this software without
17 # specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 #
22 #       @(#)MAKEDEV     5.2 (Berkeley) 6/22/90
23 # $FreeBSD$
24 #
25 # Device "make" file.  Valid arguments:
26 #       all     makes all known devices, standard number of units (or close)
27 #       std     standard devices
28 #       jail    suitable for a jail(8)
29 #       local   configuration specific devices
30 #       mach-4  mach4&lites+devices for Mach's XFree86 distribution
31 #       (see http://www.cs.hut.fi/lites.html for more info on LITES)
32 #
33 # Tapes:
34 #       wt*     QIC-interfaced (e.g. not SCSI) 3M cartridge tape
35 #       sa*     SCSI Sequential Access Devices
36 #
37 # Disks:
38 #       acd*    ATAPI CD-ROM disks
39 #       amrd*   AMI MegaRAID
40 #       cd*     SCSI CD-ROM disks
41 #       da*     SCSI Direct Access Devices
42 #       fd*     floppy disk drives (3 1/2", 5 1/4")
43 #       fla*    M-Systems DiskOnChip
44 #       idad*   Compaq Smart-2 RAID arrays
45 #       matcd*  Matsushita (Panasonic) CD-ROM disks
46 #       mcd*    Mitsumi CD-ROM disks
47 #       md*     Memory (or malloc) disk
48 #       mlx*    Mylex DAC960 RAID controllers
49 #       mlxd*   Mylex DAC960 RAID disk volumes
50 #       scd*    Sony CD-ROM disks
51 #       vn*     vnode disks
52 #       wd*     "Winchester" disk drives (ST506,IDE,ESDI,RLL,...)
53 #       wfd*    IDE floppy disk drives (LS-120)
54 #
55 # Console ports:
56 #       vty*    virtual console devices for syscons/pcvt/codrv
57 #
58 # Pointing devices:
59 #       mse*    Logitech and ATI Inport bus mouse
60 #       psm*    PS/2 mouse
61 #       sysmouse Mousesystems mouse emulator for syscons
62 #
63 # Time devices:
64 #       refclock-*  serial ports used by xntpd parse refclocks
65 #
66 # Terminal ports:
67 #       tty*    general purpose serial ports
68 #       cua*    dialout serial ports
69 #       ttyA*   Specialix SI/XIO dialin ports ('*' = number of devices)
70 #       cuaA*   Specialix SI/XIO dialout ports
71 #       ttyD*   Digiboard - 16 dialin ports
72 #       cuaD*   Digiboard - 16 dialout ports
73 #       ttyR*   Rocketport dialin ports
74 #       cuaR*   Rocketport dialout ports
75 #
76 # Pseudo terminals:
77 #       pty*    set of 32 master and slave pseudo terminals
78 #       vty*    virtual terminals using syscons/pcvt/codrv console
79 #
80 # Parallel port:
81 #       lpt*    Printer
82 #       ppi*    Parallel port i/o
83 #       pps*    Pulse per second timing interface
84 #       pcfclock*  Parallel time sync interface
85 #
86 # I2C and SMBus:
87 #       iic*    I2C devices
88 #       smb*    SMBUS devices
89 #
90 # USB devices:
91 #       usb*    USB bus control device
92 #       uhid*   Human Interface Device (HID)
93 #       ums*    mouse
94 #       ulpt*   printer
95 #       ugen*   generic USB device
96 #       urio*   Diamond Rio 500
97 #       usio*   USB serial devices
98 #
99 # SCSI devices (other than CD-ROM, tape and disk):
100 #       ch*     SCSI Media-Changer (juke box) driver
101 #       worm*   WORM driver
102 #       pt*     Processor Type (HP scanner, as one example)
103 #       pass*   CAM Passthrough device
104 #       ses*    SES (SCSI Environmental Services) and
105 #               SAF-TE (Scsi Accessable Fault-Tolerant Enclosures) device
106 #
107 # PC-CARD (previously called PCMCIA) support
108 #       card*   PC-CARD slots
109 #
110 # ISDN devices:
111 #       i4b     isdnd call control device
112 #       i4bctl  debugging control device
113 #       i4btrc* trace data interface(s), one per passive card
114 #       i4btel* telephony interface(s)
115 #       i4bteld* telephony dialout interface(s)
116 #       i4brbch* raw b channel access device(s)
117 #
118 # Special purpose devices:
119 #       apm     Advanced Power Management BIOS
120 #       apmctl  APM BIOS control device
121 #       bpf*    packet filter
122 #       speaker pc speaker
123 #       tw*     xten power controller
124 #       snd*    various sound cards
125 #       pcaudio PCM audio driver
126 #       socksys iBCS2 socket system driver
127 #       vat     VAT compatibility audio driver (requires snd*)
128 #       gsc     Genius GS-4500 hand scanner
129 #       joy     pc joystick
130 #       tun*    Tunneling IP device
131 #       tap*    Ethernet Tunneling device
132 #       snp*    tty snoop devices
133 #       spigot  Video Spigot video acquisition card
134 #       ctx*    Cortex-I video acquisition card
135 #       meteor* Matrox Meteor video acquisition card (pci)
136 #       bktr*   Bt848 based video acquisition card (pci)
137 #       labpc*  National Instrument's Lab-PC and LAB-PC+
138 #       perfmon CPU performance-monitoring counters
139 #       pci     PCI configuration-space access from user mode
140 #       ipl     ipfilter control devices (ipl, ipnat, ipstate, ipauth)
141 #       kbd     keyboard devices
142 #       3dfx*   3dfx voodoo device for glide (tdfx), links 3dfx to 3dfx#
143 #       agpgart AGP interface
144 #
145
146 if [ -n "$MAKEDEVPATH" ]; then
147         PATH="$MAKEDEVPATH"
148 else
149         PATH=/sbin:/bin
150 fi
151 umask 77
152
153 # Usage: die exitcode msg
154 die() {
155         echo $2
156         exit $1
157 }
158
159 # Convert integer to partition name
160 dkitop() {
161         local p
162
163         case $1 in
164         0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;; 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
165         *) p="?";;
166         esac
167         echo $p
168 }
169
170 # Convert integer to slice name
171 dkitos() {
172         local s
173
174         case $1 in
175         0) s="";;
176         1) s="";;
177         *) s=s$(($1-1));;
178         esac
179         echo $s
180 }
181
182 # Convert disk (type, unit, slice, partition) to minor number
183 dkminor()
184 {
185         echo $(($1 << 25 | ($2 / 32) << 21 | ($2 % 32) << 3 | $3 << 16 | $4))
186 }
187
188 # Override mknod(2) to add extra handling to it.
189 mknod() {
190         rm -f "$1" || exit 1
191         case $# in
192         4) /sbin/mknod "$@" root:wheel || die 2 "/sbin/mknod $@ failed";;
193         5) /sbin/mknod "$@"            || die 2 "/sbin/mknod $@ failed";;
194         *) die 2 "bad node: mknod $@";;
195         esac
196 }
197
198 # Convert tape (ctrl, unit, mode, access) to minor number
199 saminor()
200 {
201         echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
202 }
203
204 # Convert the last character of a tty name to a minor number.
205 ttyminor()
206 {
207         case $unit in
208         [0-9]) m=$unit;;
209         a) m=10;; b) m=11;; c) m=12;; d) m=13;; e) m=14;; f) m=15;; g) m=16;;
210         h) m=17;; i) m=18;; j) m=19;; k) m=20;; l) m=21;; m) m=22;; n) m=23;;
211         o) m=24;; p) m=25;; q) m=26;; r) m=27;; s) m=28;; t) m=29;; u) m=30;;
212         v) m=31;;
213         *) m="?";;
214         esac
215         echo $m
216 }
217
218 # Raw partition for disks
219 dkrawpart=2
220
221 # Compatibility slice for disks
222 dkcompatslice=0
223
224 # Raw slice for disks
225 dkrawslice=1
226
227 # Standard umasks
228 disk_umask=037                  # allow group operator to read disks
229 tape_umask=017                  # allow group operator to read/write tapes
230
231 for i in $*; do
232 case $i in
233
234 all)
235         sh MAKEDEV std                                  # standard
236         sh MAKEDEV fd0 fd1                              # bdev, floppy disk
237         sh MAKEDEV da0 da1 da2 da3                      # bdev, SCSI disk
238         sh MAKEDEV ad0 ad1 ad2 ad3                      # bdev, ATA disk
239         sh MAKEDEV acd0 afd0 ast0                       # bdev, ATAPI devices
240         sh MAKEDEV wd0 wd1 wd2 wd3                      # bdev, OLD disk
241         sh MAKEDEV wcd0 wfd0 wst0                       # bdev, OLD ATAPI devs
242         sh MAKEDEV vn0                                  # bdev, virtual disk
243         sh MAKEDEV cd0 matcd0 mcd0 scd0                 # bdev, cdrom
244         sh MAKEDEV sa0 wt0                              # bdev, tape
245         sh MAKEDEV vty12                                # cdev, virtual tty
246         sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3              # cdev, serial tty
247         sh MAKEDEV pty0                                 # cdev, pseudo tty
248         sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3              # cdev, serial tty
249         sh MAKEDEV kbd0 kbd1                            # cdev, keyboard
250         sh MAKEDEV mse0 psm0 sysmouse                   # cdev, mouse
251         sh MAKEDEV pcaudio speaker                      # cdev, noise
252         sh MAKEDEV lpt0 lpt1 lpt2                       # cdev, printer
253         sh MAKEDEV ppi0 ppi1 ppi2                       # cdev, parallel port
254         sh MAKEDEV iic0 iic1                            # cdev, I2C device
255         sh MAKEDEV smb0 smb1                            # cdev, SMBus device
256         sh MAKEDEV usb usb0 uhid0 ums0 ulpt0 ugen0      # cdev, USB devices
257         sh MAKEDEV urio0                                # cdev, USB devices too
258         sh MAKEDEV bpf0 bpf1 bpf2 bpf3                  # cdev, network
259         sh MAKEDEV ipl tun0 tun1 tun2 tun3              # cdev, network
260         sh MAKEDEV tap0 tap1 tap2 tap3                  # cdev, network
261         sh MAKEDEV ch0 perfmon tw0                      # cdev, miscellaneous
262         sh MAKEDEV apm apmctl card0 card1 card2 card3   # cdev, laptop
263         sh MAKEDEV pass4 xpt2                           # cdev, CAM
264         sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1           # cdev, ISDN
265         sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1    # cdev, ISDN
266         sh MAKEDEV i4brbch0 i4brbch1                    # cdev, ISDN
267         sh MAKEDEV agpgart                              # cdev, AGP
268         ;;
269
270 # a much restricted set of the above, to save precious i-nodes on the
271 # fixit floppy
272 fixit)
273         sh MAKEDEV std                                  # standard
274         sh MAKEDEV fd0                                  # bdev, floppy disk
275         sh MAKEDEV da0                                  # bdev, SCSI disk
276         sh MAKEDEV ad0                                  # bdev, ATA disk
277         sh MAKEDEV acd0 afd0 ast0                       # bdev, ATAPI devices
278         sh MAKEDEV wd0                                  # bdev, OLD disk
279         sh MAKEDEV wcd0 wfd0 wst0                       # bdev, OLD ATAPI devs
280         sh MAKEDEV vn0                                  # bdev, virtual disk
281         sh MAKEDEV cd0                                  # bdev, cdrom
282         sh MAKEDEV sa0                                  # bdev, tape
283         sh MAKEDEV vty2                                 # cdev, virtual tty
284         sh MAKEDEV cuaa0                                # cdev, serial tty
285         sh MAKEDEV pty0                                 # cdev, pseudo tty
286         sh MAKEDEV ttyd0                                # cdev, serial tty
287         sh MAKEDEV kbd0                                 # cdev, keyboard
288         sh MAKEDEV mse0 psm0 sysmouse                   # cdev, mouse
289         sh MAKEDEV lpt0                                 # cdev, printer
290         sh MAKEDEV ppi0                                 # cdev, parallel port
291         sh MAKEDEV iic0                                 # cdev, I2C device
292         sh MAKEDEV smb0                                 # cdev, SMBus device
293         sh MAKEDEV ums0                                 # cdev, USB devices
294         sh MAKEDEV tun0                                 # cdev, network
295         sh MAKEDEV tap0                                 # cdev, network
296         sh MAKEDEV ch0                                  # cdev, miscellaneous
297         sh MAKEDEV apm apmctl card0                     # cdev, laptop
298         sh MAKEDEV pass1 xpt1                           # cdev, CAM
299         sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1           # cdev, ISDN
300         sh MAKEDEV i4btel0 i4bteld0                     # cdev, ISDN
301         sh MAKEDEV i4brbch0                             # cdev, ISDN
302         rm -f fd/[1-9]?
303         ;;
304
305 std)
306         mknod console   c 0 0;                  chmod 600 console
307         mknod kmem      c 2 1 root:kmem;        chmod 640 kmem
308         mknod mem       c 2 0 root:kmem;        chmod 640 mem
309         mknod null      c 2 2;                  chmod 666 null
310         mknod random    c 2 3;                  chmod 644 random
311         ln -f random urandom
312         mknod zero      c 2 12;                 chmod 666 zero
313         mknod io        c 2 14;                 chmod 600 io
314         mknod tty       c 1 0;                  chmod 666 tty
315         mknod klog      c 7 0;                  chmod 600 klog
316         mknod pci       c 78 0;                 chmod 644 pci
317         mkdir -p fd
318         (cd fd && i=0 &&
319                 while [ $i -lt 64 ]; do
320                         mknod $i c 22 $i
321                         i=$(($i + 1))
322                 done
323         )
324         chmod 555 fd
325         chmod 666 fd/*
326         ln -sf fd/0 stdin
327         ln -sf fd/1 stdout
328         ln -sf fd/2 stderr
329         ;;
330
331 jail)
332         sh MAKEDEV std pty0
333         rm mem kmem pci io klog console         # for security
334         ln -sf null mem                 # for libkvm (ab)users
335         ln -sf null kmem                # --//--
336         ln -sf null console
337         ;;
338
339 mach-4)
340         mknod iopl c 22 0
341         mknod kbd c 23 0
342         mknod mouse c 24 0
343         mknod time c 25 0
344         mknod timezone c 26 0
345         ;;
346
347 # Create device files for new Archive/Wangtek QIC-02 tape driver (vak)
348 wt*)
349         umask $tape_umask
350         u=`expr $i : '..\(.*\)'`
351         if [ -z "${u}" ]; then u=0; fi
352         # default density, 512b blocks
353         mknod rwt${u}   c 10 `expr  0 + $u` root:operator
354         mknod nrwt${u}  c 10 `expr  4 + $u` root:operator
355         # default density, 1024b blocks
356 #       mknod rWt${u}   c 10 `expr 64 + $u` root:operator
357 #       mknod nrWt${u}  c 10 `expr 68 + $u` root:operator
358         mknod rwt${u}b  c 10 `expr 16 + $u` root:operator       # 60 megabytes
359         mknod nrwt${u}b c 10 `expr 20 + $u` root:operator
360         mknod rwt${u}c  c 10 `expr 24 + $u` root:operator       # 120 megabytes
361         mknod nrwt${u}c c 10 `expr 28 + $u` root:operator
362         mknod rwt${u}d  c 10 `expr 32 + $u` root:operator       # 150 megabytes
363         mknod nrwt${u}d c 10 `expr 36 + $u` root:operator
364 #       mknod rwt${u}e  c 10 `expr 40 + $u` root:operator       # 300 megabytes?
365 #       mknod nrwt${u}e c 10 `expr 44 + $u` root:operator
366 #       mknod rwt${u}f  c 10 `expr 48 + $u` root:operator       # 600 megabytes?
367 #       mknod nrwt${u}f c 10 `expr 52 + $u` root:operator
368         umask 77
369         ;;
370
371 # Individual slices.
372 ad*s*|afd*s*|amrd*s*|da*s*|fla*s*|idad*s*|md*s*|mlxd*s*|twed*s*|vn*s*|wd*s*|wfd*s*)
373         umask $disk_umask
374         case $i in
375         ad*s*) name=ad; chr=116;;
376         afd*s*) name=afd; chr=118;;
377         amrd*s*) name=amrd; chr=133;;
378         da*s*) name=da;  chr=13;;
379         fla*s*) name=fla; chr=102;;
380         idad*s*) name=idad; chr=109;;
381         md*s*) name=md;  chr=95;;
382         mlxd*s*) name=mlxd; chr=131;;
383         twed*s*) name=twed; chr=147;;
384         vn*s*) name=vn; chr=43;;
385         wd*s*) name=wd;  chr=3;;
386         wfd*s*) name=wfd; chr=87;;
387         esac
388         case $i in
389         amrd*s*|idad*s*|mlxd*s*|twed*s*)
390                 unit=`expr $i : '....\([0-9]*\)s'`
391                 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
392                 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
393                 ;;
394         afd*s*|fla*s*|wfd*s*)
395                 unit=`expr $i : '...\([0-9]*\)s'`
396                 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
397                 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
398                 ;;
399         *)
400                 unit=`expr $i : '..\([0-9]*\)s'`
401                 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
402                 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
403                 ;;
404         esac
405         case $unit in
406         [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
407                 case $slice in
408                 [0-9]|[1-2][0-9]|30)
409                         oldslice=$slice
410                         slice=$(($slice+1))
411                         slicename=`dkitos $slice`
412                         minor=`dkminor 0 $unit $slice $dkrawpart`
413                         mknod  $name$unit$slicename c $chr $minor root:operator
414                         ln -f $name$unit$slicename r$name$unit$slicename
415                         case $part in
416                         [a-h])
417                                 case $oldslice in
418                                 0) slice=$oldslice ;;
419                                 esac
420                                 for part in 0 1 2 3 4 5 6 7
421                                 do
422                                         minor=`dkminor 0 $unit $slice $part`
423                                         partname=`dkitop $part`
424                                         mknod  $name$unit$slicename$partname \
425                                               c $chr $minor root:operator
426                                         ln -f $name$unit$slicename$partname \
427                                              r$name$unit$slicename$partname
428                                 done
429                                 ;;
430                         "")
431                                 ;;
432                         *)
433                                 echo bad partition for disk in: $i
434                                 ;;
435                         esac
436                         ;;
437                 *)
438                         echo bad slice for disk in: $i
439                         ;;
440                 esac
441                 ;;
442         *)
443                 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
444                 ;;
445         esac
446         umask 77
447         ;;
448
449 fd*)
450         umask $disk_umask
451         unit=`expr $i : '..\(.*\)'`
452         name=fd; chr=9
453         case $unit in
454         0|1|2|3)
455                 mknod ${name}${unit}   c $chr `expr $unit '*' 64` root:operator
456                 ln -f ${name}${unit} r${name}${unit}
457                 # Fake BSD partitions
458                 for i in a b c d e f g h
459                 do
460                         ln -f ${name}${unit} ${name}${unit}$i
461                         ln -f r${name}${unit} r${name}${unit}$i
462                 done
463                 # User-readable and programmer-readable name sets
464
465                 mknod ${name}${unit}.1720  c $chr `expr $unit '*' 64 + 1` \
466                     root:operator
467                 ln -f ${name}${unit}.1720 r${name}${unit}.1720
468                 # ln -f ${name}${unit}.1720 ${name}${unit}135hs21
469                 # ln -f r${name}${unit}.1720 r${name}${unit}135hs21
470
471                 mknod ${name}${unit}.1480  c $chr `expr $unit '*' 64 + 2` \
472                     root:operator
473                 ln -f ${name}${unit}.1480 r${name}${unit}.1480
474                 # ln -f ${name}${unit}.1480 ${name}${unit}135hs18
475                 # ln -f r${name}${unit}.1480 r${name}${unit}135hs18
476                 # ln -f ${name}${unit}.1480 ${name}${unit}96hs18
477                 # ln -f r${name}${unit}.1480 r${name}${unit}96hs18
478
479                 mknod ${name}${unit}.1440  c $chr `expr $unit '*' 64 + 3` \
480                     root:operator
481                 ln -f ${name}${unit}.1440 r${name}${unit}.1440
482                 # ln -f ${name}${unit}.1440 ${name}${unit}135
483                 # ln -f r${name}${unit}.1440 r${name}${unit}135
484                 # ln -f ${name}${unit}.1440 ${name}${unit}135ds18
485                 # ln -f r${name}${unit}.1440 r${name}${unit}135ds18
486                 # ln -f ${name}${unit}.1440 ${name}${unit}96ds18
487                 # ln -f r${name}${unit}.1440 r${name}${unit}96ds18
488
489                 mknod ${name}${unit}.1200  c $chr `expr $unit '*' 64 + 4` \
490                     root:operator
491                 ln -f ${name}${unit}.1200 r${name}${unit}.1200
492                 # ln -f ${name}${unit}.1200 ${name}${unit}96
493                 # ln -f r${name}${unit}.1200 r${name}${unit}96
494                 # ln -f ${name}${unit}.1200 ${name}${unit}96ds15
495                 # ln -f r${name}${unit}.1200 r${name}${unit}96ds15
496                 # ln -f ${name}${unit}.1200 ${name}${unit}135ds15
497                 # ln -f r${name}${unit}.1200 r${name}${unit}135ds15
498
499                 mknod ${name}${unit}.820  c $chr `expr $unit '*' 64 + 5` \
500                     root:operator
501                 ln -f ${name}${unit}.820 r${name}${unit}.820
502                 # ln -f ${name}${unit}.820 ${name}${unit}96hs10
503                 # ln -f r${name}${unit}.820 r${name}${unit}96hs10
504                 # ln -f ${name}${unit}.820 ${name}${unit}135hs10
505                 # ln -f r${name}${unit}.820 r${name}${unit}135hs10
506
507                 mknod ${name}${unit}.800  c $chr `expr $unit '*' 64 + 6` \
508                     root:operator
509                 ln -f ${name}${unit}.800 r${name}${unit}.800
510                 # ln -f ${name}${unit}.800 ${name}${unit}96ds10
511                 # ln -f r${name}${unit}.800 r${name}${unit}96ds10
512                 # ln -f ${name}${unit}.800 ${name}${unit}135ds10
513                 # ln -f r${name}${unit}.800 r${name}${unit}135ds10
514
515                 mknod ${name}${unit}.720  c $chr `expr $unit '*' 64 + 7` \
516                     root:operator
517                 ln -f ${name}${unit}.720 r${name}${unit}.720
518                 # ln -f ${name}${unit}.720 ${name}${unit}96ds9
519                 # ln -f r${name}${unit}.720 r${name}${unit}96ds9
520                 # ln -f ${name}${unit}.720 ${name}${unit}135ds9
521                 # ln -f r${name}${unit}.720 r${name}${unit}135ds9
522
523                 mknod ${name}${unit}.360  c $chr `expr $unit '*' 64 + 8` \
524                     root:operator
525                 ln -f ${name}${unit}.360 r${name}${unit}.360
526                 # ln -f ${name}${unit}.360 ${name}${unit}48
527                 # ln -f r${name}${unit}.360 r${name}${unit}48
528                 # ln -f ${name}${unit}.360 ${name}${unit}48ds9
529                 # ln -f r${name}${unit}.360 r${name}${unit}48ds9
530
531                 mknod ${name}${unit}.640  c $chr `expr $unit '*' 64 + 9` \
532                     root:operator
533                 ln -f ${name}${unit}.640 r${name}${unit}.640
534                 # ln -f ${name}${unit}.640 ${name}${unit}96ds8
535                 # ln -f r${name}${unit}.640 r${name}${unit}96ds8
536                 # ln -f ${name}${unit}.640 ${name}${unit}135ds8
537                 # ln -f r${name}${unit}.640 r${name}${unit}135ds8
538
539                 mknod ${name}${unit}.1232  c $chr `expr $unit '*' 64 + 10` \
540                     root:operator
541                 ln -f ${name}${unit}.1232 r${name}${unit}.1232
542                 # ln -f ${name}${unit}.1232 ${name}${unit}96ds8
543                 # ln -f r${name}${unit}.1232 r${name}${unit}96ds8
544                 # ln -f ${name}${unit}.1232 ${name}${unit}135ds8
545                 # ln -f r${name}${unit}.1232 r${name}${unit}135ds8
546                 ;;
547         *)
548                 echo bad unit for disk in: $i
549                 ;;
550         esac
551         umask 77
552         ;;
553
554 ad*|afd*|amrd*|da*|fla*|idad*|md*|mlxd*|twed*|vn*|wd*|wfd*)
555         umask $disk_umask
556         case $i in
557         ad*) name=ad; chr=116;;
558         afd*) name=afd; chr=118;;
559         amrd*) name=amrd; chr=133;;
560         da*) name=da;  chr=13;;
561         fla*) name=fla; chr=102;;
562         idad*) name=idad; chr=109;;
563         md*) name=md; chr=95;;
564         mlxd*) name=mlxd; chr=131;;
565         twed*) name=twed; chr=147;;
566         vn*) name=vn; chr=43;;
567         wd*) name=wd;  chr=3;;
568         wfd*) name=wfd; chr=87;;
569         esac
570         case $i in
571         amrd*|idad*|mlxd*|twed*)
572                 unit=`expr $i : '....\(.*\)'`
573                 ;;
574         afd*|fla*|wfd*)
575                 unit=`expr $i : '...\(.*\)'`
576                 ;;
577         *)
578                 unit=`expr $i : '..\(.*\)'`
579                 ;;
580         esac
581         case $unit in
582         [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
583                 for slicepartname in s0h s1 s2 s3 s4
584                 do
585                         sh MAKEDEV $name$unit$slicepartname
586                 done
587                 ;;
588         *)
589                 echo bad unit for disk in: $i
590                 ;;
591         esac
592         umask 77
593         ;;
594
595 ccd*)
596         umask $disk_umask
597         name=ccd
598         chr=74
599         unit=`expr $i : '...\(.*\)'`
600         case $unit in
601         [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
602                 for part in 0 1 2 3 4 5 6 7
603                 do
604                         minor=`dkminor 0 $unit 0 $part`
605                         partname=`dkitop $part`
606                         mknod  $name$unit$partname c $chr $minor root:operator
607                         ln -f $name$unit$partname r$name$unit$partname
608                 done
609                 ;;
610         *)
611                 echo bad unit for disk in: $i
612                 ;;
613         esac
614         umask 77
615         ;;
616
617 # SCSI processor type driver
618 pt[0-9]*)
619         chr=61
620         name=pt
621         unit=`expr $i : 'pt\([0-9][0-9]*\)'`
622         if [ -z "${unit}" ]; then
623                 unit=0
624         fi
625         unit=`expr $unit + 1 - 1`
626         mknod ${name}${unit} c $chr $unit
627         ;;
628
629 # SCSI SES/SAF-TE type driver
630 ses[0-9]*)
631         chr=110
632         name=ses
633         unit=`expr $i : 'ses\([0-9][0-9]*\)'`
634         if [ -z "${unit}" ]; then
635                 unit=0
636         fi
637         unit=`expr $unit + 1 - 1`
638         mknod ${name}${unit} c $chr $unit
639         ;;
640 # SCSI target mode sample driver
641 targ[0-9]*)
642         chr=65
643         name=targ
644         unit=`expr $i : 'targ\([0-9][0-9]*\)'`
645         if [ -z "${unit}" ]; then
646                 unit=0
647         fi
648         unit=`expr $unit + 1 - 1`
649         mknod ${name}${unit} c $chr $unit
650         mknod ${name}.ctl c $chr 0xffff00ff
651         ;;
652
653 # CAM transport layer device
654 xpt*)
655         # This major number is temporary
656         chr=104
657         name=xpt
658         units=`expr $i : 'xpt\(.*\)'`
659         if [ -z "${units}" ]; then
660                 units=1
661         fi
662         i=0
663         while [ $i -lt $units ]; do
664                 dname=$name$i
665                 rm -rf $dname r$dname
666                 mknod $dname c $chr $i root:operator
667                 i=$(($i + 1))
668         done    
669         ;;
670
671 # CAM passthrough device
672 pass*)
673         # This major number is temporary
674         chr=31
675         name=pass
676         units=`expr $i : 'pass\(.*\)'`
677         if [ -z "${units}" ]; then
678                 units=1
679         fi
680         i=0
681         while [ $i -lt $units ]; do
682                 dname=$name$i
683                 rm -rf $dname r$dname
684                 mknod $dname c $chr $i root:operator
685                 i=$(($i + 1))
686         done    
687         ;;
688 pty*)
689         class=`expr $i : 'pty\(.*\)'`
690         case $class in
691         0) offset=0 name=p;;
692         1) offset=32 name=q;;
693         2) offset=64 name=r;;
694         3) offset=96 name=s;;
695 # Note that xterm (at least) only look at p-s.
696         4) offset=128 name=P;;
697         5) offset=160 name=Q;;
698         6) offset=192 name=R;;
699         7) offset=224 name=S;;
700         # This still leaves [tuTU].
701         *) echo bad unit for pty in: $i;;
702         esac
703         umask 0
704         case $class in
705         0|1|2|3|4|5|6|7)
706                 i=0
707                 while [ $i -lt 32 ]; do
708 #                       This was an awk substr() before.
709                         c=$(echo 0123456789abcdefghijklmnopqrstuv |
710                             dd bs=1 skip=$i count=1 2>/dev/null)
711                         mknod tty$name$c c 5 $(($offset + $i))
712                         mknod pty$name$c c 6 $(($offset + $i))
713                         i=$(($i + 1))
714                 done
715                 ;;
716         esac
717         umask 77
718         ;;
719
720 sa*)
721         umask $tape_umask
722         unit=`expr $i : '..\(.*\)'`
723         chr=14
724
725         case $unit in
726         [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
727                 mknod sa${unit}.ctl c $chr `saminor 1 ${unit} 0 0`
728                 ln -f sa${unit}.ctl rsa${unit}.ctl
729                 for m in 0 1 2 3
730                 do
731                         mknod sa${unit}.${m} c $chr \
732                             `saminor 0 ${unit} ${m} 0`  root:operator
733                         ln -f sa${unit}.${m} rsa${unit}.${m}
734                         mknod nsa${unit}.${m} c $chr \
735                             `saminor 0 ${unit} ${m} 1` root:operator
736                         ln -f nsa${unit}.${m} nrsa${unit}.${m}
737                         mknod esa${unit}.${m} c $chr \
738                             `saminor 0 ${unit} ${m} 2` root:operator
739                         ln -f esa${unit}.${m} ersa${unit}.${m}
740                 done
741                 ln -f sa${unit}.0 sa${unit}
742                 ln -f sa${unit}.0 rsa${unit}.0
743                 ln -f sa${unit}.0 rsa${unit}
744                 ln -f nsa${unit}.0 nsa${unit}
745                 ln -f nsa${unit}.0 nrsa${unit}.0
746                 ln -f nsa${unit}.0 nrsa${unit}
747                 ln -f esa${unit}.0 esa${unit}
748                 ln -f esa${unit}.0 ersa${unit}.0
749                 ln -f esa${unit}.0 ersa${unit}
750                 ;;
751         *)
752                 echo bad unit for tape in: $i
753                 ;;
754         esac
755         umask 77
756         ;;
757
758 ch*)
759         umask 37
760         unit=`expr $i : '..\(.*\)'`
761         case $i in
762         ch*) name=ch;  chr=17;;
763         esac
764         case $unit in
765         0|1|2|3|4|5|6)
766                 mknod ${name}${unit}    c $chr $unit root:operator
767                 ;;
768         *)
769                 echo bad unit for media changer in: $i
770                 ;;
771         esac
772         umask 77
773         ;;
774
775 ast*)
776         umask 2 ;
777         unit=`expr $i : '...\(.*\)'`
778         chr=119
779         case $unit in
780         0|1|2|3)
781                 mknod rast${unit} c $chr `expr $unit '*' 8 + 0` root:operator
782                 chmod 640 rast${unit}
783                 mknod nrast${unit} c $chr `expr $unit '*' 8 + 1` root:operator
784                 chmod 640 nrast${unit}
785                 ;;
786         *)
787                 echo bad unit for tape in: $i
788                 ;;
789         esac
790         umask 77
791         ;;
792
793 acd*|cd*|mcd*|scd*)
794         umask $disk_umask
795         case $i in
796         acd*) units=`expr $i : '...\(.*\)'`; name=acd; chr=117;;
797         cd*) units=`expr $i : '..\(.*\)'`; name=cd; chr=15;;
798         mcd*) units=`expr $i : '...\(.*\)'`; name=mcd; chr=29;;
799         scd*) units=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
800         esac
801         if [ -z "${units}" -o "${units}" -le 0 ]; then
802                 units=1
803         fi
804         if [ "${units}" -le 31 ]; then
805                 i=0
806                 while [ $i -le $units ]; do
807                         dname=$name$i
808                         rm -rf ${dname}* r${dname}*
809                         mknod ${dname}a c $chr $(($i * 8)) root:operator
810                         mknod ${dname}c c $chr $(($i * 8 + 2)) root:operator
811                         ln -f ${dname}a r${dname}a
812                         ln -f ${dname}c r${dname}c
813                         i=$(($i + 1))
814                 done
815         else
816                 echo "$i is invalid -- can't have more than 32 cd devices"
817         fi
818         umask 77
819         ;;
820
821 matcd*)
822         umask 2
823         case $i in
824         matcd*) unit=`expr $i : '.....\(.*\)'`; name=matcd; chr=46;;
825         esac
826         case $unit in
827         0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15)
828                 mknod ${name}${unit}a   c $chr `expr $unit '*' 8 + 0` \
829                     root:operator
830                 mknod ${name}${unit}c   c $chr `expr $unit '*' 8 + 2` \
831                     root:operator
832                 ln -f ${name}${unit}a r${name}${unit}a
833                 ln -f ${name}${unit}c r${name}${unit}c
834                 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
835
836                 mknod ${name}${unit}la  c $chr `expr $unit '*' 8 + 128` \
837                     root:operator
838                 mknod ${name}${unit}lc  c $chr `expr $unit '*' 8 + 130` \
839                     root:operator
840                 ln -f ${name}${unit}la r${name}${unit}la
841                 ln -f ${name}${unit}lc r${name}${unit}lc
842                 chmod 640 ${name}${unit}l[a-h] r${name}${unit}l[a-h]
843                 ;;
844         *)
845                 echo bad unit for disk in: $i
846                 ;;
847         esac
848         umask 77
849         ;;
850
851 wcd*)
852         umask 2 ;
853         unit=`expr $i : '...\(.*\)'`
854         chr=69
855         case $unit in
856         0|1|2|3|4|5|6|7)
857                 mknod wcd${unit}a  c $chr `expr $unit '*' 8 + 0` root:operator
858                 mknod wcd${unit}c  c $chr `expr $unit '*' 8 + 2` root:operator
859                 ln -f wcd${unit}a rwcd${unit}a
860                 ln -f wcd${unit}c rwcd${unit}c
861                 chmod 640 wcd${unit}[a-h] rwcd${unit}[a-h]
862                 ;;
863         *)
864                 echo bad unit for disk in: $i
865                 ;;
866         esac
867         umask 77
868         ;;
869
870 wst*)
871         umask 2 ;
872         unit=`expr $i : '...\(.*\)'`
873         chr=90
874         case $unit in
875         0|1|2|3)
876                 mknod rwst${unit} c $chr `expr $unit '*' 8 + 0` root:operator
877                 chmod 640 rwst${unit}
878                 ;;
879         esac
880         umask 77
881         ;;
882
883 iic*)
884         unit=`expr $i : 'iic\(.*\)'`
885         mknod iic$unit c 105 $unit
886         ;;
887
888 smb*)
889         unit=`expr $i : 'smb\(.*\)'`
890         mknod smb$unit c 106 $unit
891         ;;
892
893 pcfclock*)
894         unit=`expr $i : 'pcfclock\(.*\)'`
895         mknod pcfclock$unit c 140 $unit
896         ;;
897
898 ppi*)
899         unit=`expr $i : 'ppi\(.*\)'`
900         mknod ppi$unit c 82 $unit
901         ;;
902
903 pps*)
904         unit=`expr $i : 'pps\(.*\)'`
905         mknod pps$unit c 89 $unit
906         ;;
907
908 usb)
909         mknod usb$unit c 108 255 root:operator
910         chmod 0660 usb$unit
911         ;;
912
913 usb*)
914         unit=`expr $i : 'usb\(.*\)'`
915         mknod usb$unit c 108 $unit root:operator
916         chmod 0660 usb$unit
917         ;;
918
919 uhid*)
920         unit=`expr $i : 'uhid\(.*\)'`
921         mknod uhid$unit c 122 $unit
922         ;;
923
924 ums*)
925         unit=`expr $i : 'ums\(.*\)'`
926         mknod ums$unit c 111 $unit
927         ;;
928
929 ulpt*)
930         unit=`expr $i : 'ulpt\(.*\)'`
931         minor=$unit
932         mknod ulpt$unit c 113 $minor
933         minor=`expr $unit + 64`
934         mknod unlpt$unit c 113 $minor           # and the 'no prime' version
935         ;;
936
937 ugen*)
938         unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
939         endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
940         if [ -z "${unit}" ]; then
941                 echo $i - Invalid unit number
942         fi
943         if [ -z "${endpoint}" ]; then           # ugen0 & ugen0.1 - ugen0.15
944                 mknod ugen$unit c 114 $(($unit * 16))
945                 i=1
946                 while [ $i -lt 16 ]; do
947                         mknod ugen$unit.$i c 114 $(($unit * 16 + $i))
948                         i=$(($i + 1))
949                 done
950         else
951                 minor=$(($unit * 16 + $endpoint))
952                 mknod ugen$unit.$endpoint c 114 $minor
953         fi
954         ;;
955
956 urio*)
957         unit=`expr $i : 'urio\(.*\)'`
958         mknod urio$unit c 143 $unit
959         ;;
960
961 usio*)
962         unit=`expr $i : 'usio\(.*\)'`
963         minor=$(($minor + 128))
964         mknod usio$unit c 138 $minor
965         ;;
966
967 lpt*)
968         unit=`expr $i : 'lpt\(.*\)'`
969         mknod lpt$unit c 16 $unit
970         mknod lpctl$unit c 16 `expr $unit + 128`
971         ;;
972
973 tw*)
974         unit=`expr $i : 'tw\(.*\)'`
975         mknod tw$unit c 19 $unit root:operator
976         ;;
977
978 # Use this to create virtual consoles for syscons, pcvt or codrv
979 # ttyv0-b
980 # use as MAKEDEV vtyNN to create NN entries
981 vty*)
982         chr=12
983         units=`expr $i : 'vty\(.*\)'`
984         i=0
985         while [ $i -lt $units ]; do
986                 mknod ttyv$(printf %01x $i) c $chr $i
987                 i=$(($i + 1))
988         done
989         ln -fs ttyv0 vga        # XXX X still needs this pccons relic
990         ;;
991
992 bpf*)
993         nbpf=`expr $i : 'bpf\(.*\)$'`
994         unit=0
995         while [ $unit -le $nbpf ]; do
996                 mknod bpf$unit c 23 $unit
997                 unit=$(($unit + 1))
998         done
999         ;;
1000
1001 speaker)
1002         mknod speaker c 26 0
1003         ;;
1004
1005 cuaa?|cua?)
1006         umask 7
1007         unit=`expr $i : 'cua.*\(.\)$'`
1008         m=`ttyminor $unit`
1009         mknod cuaa$unit c 28 `expr $m + 128` uucp:dialer
1010         mknod cuaia$unit c 28 `expr $m + 32 + 128` uucp:dialer
1011         mknod cuala$unit c 28 `expr $m + 64 + 128` uucp:dialer
1012         umask 77
1013         ;;
1014
1015 tty0?|ttyd?|tty?)
1016         unit=`expr $i : 'tty.*\(.\)$'`
1017         m=`ttyminor $unit`
1018         mknod ttyd$unit c 28 $m
1019         mknod ttyid$unit c 28 `expr $m + 32`
1020         mknod ttyld$unit c 28 `expr $m + 64`
1021         ;;
1022
1023 cuac?)
1024         umask 7
1025         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1026                   g h i j k l m n o p q r s t u v"
1027         major=48
1028         card=`expr $i : 'cua.*\(.\)$'`
1029         for unit in $portlist
1030         do
1031                 minor=`ttyminor $unit`
1032                 minor=`expr $card \* 65536 + $minor`
1033                 name=$card$unit
1034                 mknod cuac$name c $major `expr $minor + 128` uucp:dialer
1035                 mknod cuaic$name c $major `expr $minor + 32 + 128` uucp:dialer
1036                 mknod cualc$name c $major `expr $minor + 64 + 128` uucp:dialer
1037         done
1038         umask 77
1039         ;;
1040
1041 ttyc?)
1042         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1043                   g h i j k l m n o p q r s t u v"
1044         major=48
1045         card=`expr $i : 'tty.*\(.\)$'`
1046         for unit in $portlist
1047         do
1048                 minor=`ttyminor $unit`
1049                 minor=`expr $card \* 65536 + $minor`
1050                 name=$card$unit
1051                 mknod ttyc$name c $major $minor
1052                 mknod ttyic$name c $major `expr $minor + 32`
1053                 mknod ttylc$name c $major `expr $minor + 64`
1054         done
1055         ;;
1056
1057 # RISCom8 'rc' driver entries
1058
1059 cuam?)
1060         umask 7
1061         unit=`expr $i : 'cua.*\(.\)$'`
1062         m=`ttyminor $unit`
1063         mknod cuam$unit c 63 `expr $m + 128` uucp:dialer
1064         umask 77
1065         ;;
1066
1067 ttym?)
1068         unit=`expr $i : 'tty.*\(.\)$'`
1069         m=`ttyminor $unit`
1070         mknod ttym$unit c 63 $m
1071         ;;
1072
1073 # Specialix SI/XIO.
1074 # Note: these are 'base 1' to match the numbers on the panels, and to match
1075 #       the manual that comes with the system.
1076 ttyA*)
1077         major=68
1078         nports=`expr $i : 'ttyA\(.*\)$'`
1079         port=1
1080         while [ $port -le $nports ]; do
1081                 minor=$(expr $port - 1)
1082                 name=$(printf %02d $port)
1083                 mknod ttyA$name c $major $minor
1084                 mknod ttyiA$name c $major `expr $minor + 65536`
1085                 mknod ttylA$name c $major `expr $minor + 131072`
1086                 port=$(($port + 1))
1087         done
1088         # For the user-mode control program, 'sicontrol'
1089         mknod si_control c 68 262144
1090         ;;
1091
1092 cuaA*)
1093         umask 7
1094         major=68
1095         nports=`expr $i : 'cuaA\(.*\)$'`
1096         port=1
1097         while [ $port -le $nports ]; do
1098                 minor=$(expr $port - 1)
1099                 name=$(printf %02d $port)
1100                 mknod cuaA$name c $major `expr $minor + 128` uucp:dialer
1101                 mknod cuaiA$name c $major `expr $minor + 128 + 65536` \
1102                     uucp:dialer
1103                 mknod cualA$name c $major `expr $minor + 128 + 131072` \
1104                     uucp:dialer
1105                 port=$(($port + 1))
1106         done
1107         umask 77
1108         ;;
1109
1110 # Digiboard PC/?? 16 port card.
1111 # The current scheme of minor numbering is:
1112 #
1113 #       unused{14} CARD{2} major{8} CALLOUT{1} LOCK{1} INIT{1} PORT{5}
1114 #
1115 #   CARD bitfield in future versions may be extended to 3 bits.
1116 #
1117 # See dgb(4)
1118 #
1119 ttyD?)
1120         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1121         major=58
1122         card=`expr $i : 'tty.*\(.\)$'`
1123         for unit in $portlist
1124         do
1125                 minor=`ttyminor $unit`
1126                 minor=`expr $card \* 65536 + $minor`
1127                 name=$card$unit
1128                 mknod ttyD$name c $major $minor
1129                 mknod ttyiD$name c $major `expr $minor + 32`
1130                 mknod ttylD$name c $major `expr $minor + 64`
1131         done
1132         ;;
1133
1134 cuaD?)
1135         umask 7
1136         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1137         major=58
1138         card=`expr $i : 'cua.*\(.\)$'`
1139         for unit in $portlist
1140         do
1141                 minor=`ttyminor $unit`
1142                 minor=`expr $card \* 65536 + $minor`
1143                 name=$card$unit
1144                 mknod cuaD$name c $major `expr $minor + 128` uucp:dialer
1145                 mknod cuaiD$name c $major `expr $minor + 32 + 128` uucp:dialer
1146                 mknod cualD$name c $major `expr $minor + 64 + 128` uucp:dialer
1147         done
1148         umask 77
1149         ;;
1150
1151 ttyM*)
1152         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1153         modulelist="a b c d"
1154         major=101
1155         card=`expr $i : 'tty.*\(.\)$'`
1156         for unit in $modulelist
1157         do
1158                 moduleminor=`ttyminor $unit`
1159                 moduleminor=`expr $moduleminor % 10 \* 16`
1160                 modulename=$unit
1161
1162                 for unit in $portlist
1163                 do
1164                         minor=`ttyminor $unit`
1165                         minor=`expr $card \* 65536 + $minor + $moduleminor`
1166                         name=$card$modulename$unit
1167                         rm -f tty*M$name
1168                         mknod ttyM$name c $major $minor
1169                         mknod ttyiM$name c $major `expr $minor + 64`
1170                         mknod ttylM$name c $major `expr $minor + 128`
1171                 done
1172         done
1173         ;;
1174
1175 cuaM?)
1176         umask 7
1177         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1178         modulelist="a b c d"
1179         major=101
1180         card=`expr $i : 'cua.*\(.\)$'`
1181         for unit in $modulelist
1182         do
1183                 moduleminor=`ttyminor $unit`
1184                 moduleminor=`expr $moduleminor % 10 \* 16`
1185                 modulename=$unit
1186
1187                 for unit in $portlist
1188                 do
1189                         minor=`ttyminor $unit`
1190                         minor=`expr $card \* 65536 + $minor + $moduleminor`
1191                         name=$card$modulename$unit
1192                         rm -f cua*M$name
1193                         mknod cuaM$name c $major `expr $minor + 262144` \
1194                             uucp:dialer
1195                         mknod cuaiM$name c $major `expr $minor + 64 + 262144` \
1196                             uucp:dialer
1197                         mknod cualM$name c $major `expr $minor + 128 + 262144` \
1198                             uucp:dialer
1199                 done
1200         done
1201         umask 77
1202         ;;
1203
1204 ttyR?)
1205         major=81
1206         BOARD=1; Rnum=0
1207         MINOR=$(($BOARD * 65536))
1208         controllers=$(
1209                 dmesg | while read first rest; do
1210                         case "$first" in
1211                         RocketPort[0-4])
1212                                 echo "$first"
1213                                 ;;
1214                         esac
1215                 done
1216         )
1217         rm -f /dev/ttyR* /dev/ttyiR* /dev/ttylR*
1218         for i in $controllers; do
1219            ndevices=$(
1220                 dmesg | while read first bar ports rest; do
1221                         case "$first" in
1222                         $i*)
1223                                 echo "$ports"
1224                                 ;;
1225                         esac
1226                 done
1227            )
1228            echo -n "Creating $ndevices devices for $i: "
1229            dev=0
1230            while [ $dev -lt $ndevices ]; do
1231                    mknod /dev/ttyR$Rnum c $major $MINOR
1232                    mknod /dev/ttyiR$Rnum c $major $(($MINOR + 32))
1233                    mknod /dev/ttylR$Rnum c $major $(($MINOR + 64))
1234                    Rnum=$(($Rnum + 1))
1235                    MINOR=$(($MINOR + 1))
1236                    dev=$(($dev + 1))
1237            done
1238                 BOARD=$(($BOARD + 1))
1239                 MINOR=$(($BOARD * 65536))
1240            echo " "
1241         done
1242         ;;
1243
1244 cuaR?)
1245         major=81
1246         BOARD=1; Rnum=0
1247         MINOR=$(($BOARD * 65536))
1248         controllers=$(
1249                 dmesg | while read first rest; do
1250                         case "$first" in
1251                         RocketPort[0-4])
1252                                 echo "$first"
1253                                 ;;
1254                         esac
1255                 done
1256         )
1257         rm -f /dev/cuaR* /dev/cuaiR* /dev/cualR*
1258         for i in $controllers; do
1259            ndevices=$(
1260                 dmesg | while read first bar ports rest; do
1261                         case "$first" in
1262                         $i*)
1263                                 echo "$ports"
1264                                 ;;
1265                         esac
1266                 done
1267            )
1268            echo -n "Creating $ndevices devices for $i: "
1269            dev=0
1270            while [ $dev -lt $ndevices ]; do
1271                    mknod /dev/cuaR$Rnum c  $major $(($MINOR + 128)) uucp:dialer
1272                    mknod /dev/cuaiR$Rnum c $major $(($MINOR + 128 + 32)) \
1273                        uucp:dialer
1274                    mknod /dev/cualR$Rnum c $major $(($MINOR + 128 + 64)) \
1275                        uucp:dialer
1276                    Rnum=$(($Rnum + 1))
1277                    MINOR=$(($MINOR + 1))
1278                    dev=$(($dev + 1))
1279            done
1280                 BOARD=$(($BOARD + 1))
1281                 MINOR=$(($BOARD * 65536))
1282            echo " "
1283         done
1284         ;;
1285
1286 mse*)
1287         unit=`expr $i : 'mse\(.*\)'`
1288         chr=27
1289         mknod mse$unit c $chr `expr $unit '*' 2 + 1`    # non-blocking for X11
1290         ;;
1291
1292 psm*)
1293         unit=`expr $i : 'psm\(.*\)'`
1294         chr=21
1295         mknod psm$unit c $chr `expr $unit '*' 2 + 1`    # non-blocking for X11
1296         ;;
1297
1298 mouse*)
1299         name=`expr $i : 'mouse\(.*\)'`
1300         if [ ! -c $name ]; then
1301                 $0 $name                        # make the appropriate device
1302         fi
1303         ln -fs $name mouse
1304         ;;
1305
1306 pcaudio)
1307         mknod pcaudio c 24 0
1308         mknod pcaudioctl c 24 128
1309         ;;
1310
1311 socksys)
1312         mknod socksys c 41 0
1313         mknod spx c 41 1
1314         ln -fs socksys nfsd
1315         chmod 666 socksys nfsd spx
1316         ;;
1317
1318 snd*)
1319 #
1320 # changes from Linux voxware
1321 # minor         Linux                   FreeBSD
1322 # 8             sequencer2 (aka music0) music0
1323 # 17            patmgr0                 sequencer1
1324 # 33            patmgr1                 sequencer2
1325 #
1326
1327         unit=`expr $i : 'snd\(.*\)'`
1328         chr=30
1329
1330         # XXX write this less verbosely, like std
1331         snd_security_hole=0     # XXX
1332         umask $snd_security_hole
1333
1334         ln -fs mixer$unit mixer
1335         ln -fs sequencer$unit sequencer
1336         ln -fs dsp$unit dsp
1337         ln -fs audio$unit audio
1338         ln -fs dspW$unit dspW
1339         ln -fs music$unit music
1340         ln -fs pss$unit pss
1341
1342         mknod mixer$unit        c $chr `expr $unit '*' 16 + 0`
1343         mknod sequencer$unit    c $chr `expr $unit '*' 16 + 1`
1344         mknod midi$unit         c $chr `expr $unit '*' 16 + 2`
1345         mknod dsp$unit          c $chr `expr $unit '*' 16 + 3`
1346         mknod audio$unit        c $chr `expr $unit '*' 16 + 4`
1347         mknod dspW$unit         c $chr `expr $unit '*' 16 + 5`
1348         mknod sndstat           c $chr 6
1349                                 # minor number 7 is unused
1350         mknod music$unit        c $chr `expr $unit '*' 16 + 8`
1351         mknod pss$unit          c $chr `expr $unit '*' 16 + 9`
1352                                 # minor number 10 is unused
1353         mknod midistat          c $chr 11
1354                                 # minor numbers 12-15 are unused
1355         umask 77
1356         ;;
1357
1358 vat)
1359         mknod vatio c 25 128
1360         chmod 660 vatio
1361         ;;
1362
1363 gsc*)
1364         unit=`expr $i : 'gsc\(.*\)'`
1365         mknod gsc${unit} c 47 $unit
1366         mknod gsc${unit}p c 47 $(($unit + 8))
1367         mknod gsc${unit}d c 47 $(($unit + 32))
1368         mknod gsc${unit}pd c 47 $(($unit + 40))
1369         chmod 666 gsc${unit}*
1370         ;;
1371
1372 apm)
1373         mknod apm c 39 0 root:operator
1374         chmod 664 apm
1375         ;;
1376
1377 apmctl)
1378         mknod apmctl c 39 8 root:operator
1379         chmod 660 apmctl
1380         ;;
1381
1382 card*)
1383         unit=`expr $i : 'card\(.*\)'`
1384         chr=50
1385         mknod card$unit c $chr $unit
1386         chmod 644 card$unit
1387         ;;
1388
1389 ttyx?|ttyy?|ttyz?)
1390         case $i in
1391         *0) unit=0;;    *1) unit=1;;    *2) unit=2;;    *3) unit=3;;
1392         *4) unit=4;;    *5) unit=5;;    *6) unit=6;;    *7) unit=7;;
1393         *8) unit=8;;    *9) unit=9;;    *a) unit=10;;   *b) unit=11;;
1394         *c) unit=12;;   *d) unit=13;;   *e) unit=14;;   *f) unit=15;;
1395         esac
1396         case $i in
1397         ttyy?)  unit=`expr $unit \+ 16`;;
1398         ttyz?)  unit=`expr $unit \+ 32`;;
1399         esac
1400         mknod $i c 42 $unit
1401         ;;
1402
1403 cronyx)
1404         mknod cronyx c 42 63
1405         ;;
1406
1407 joy)
1408         mknod joy0 c 51 0 root:operator
1409         mknod joy1 c 51 1 root:operator
1410         chmod 640  joy0 joy1
1411         ;;
1412
1413 spigot)
1414         mknod spigot c 11 0
1415         chmod 444 spigot
1416         ;;
1417
1418 ctx?)
1419         unit=`expr $i : 'ctx\(.*\)'`
1420         mknod ctx$unit c 40 $unit
1421         chmod 444 ctx$unit
1422         ;;
1423
1424 meteor?)
1425         unit=`expr $i : 'meteor\(.*\)'`
1426         mknod meteor$unit c 67 $unit
1427         chmod 444 meteor$unit
1428         ;;
1429
1430 bktr?)
1431         unit=`expr $i : 'bktr\(.*\)'`
1432         mknod bktr$unit c 92 $unit
1433         mknod tuner$unit c 92 $((16 + $unit ))
1434         mknod vbi$unit c 92 $((32 + $unit ))
1435         chmod 444 bktr$unit tuner$unit vbi$unit
1436         ;;
1437
1438 tun*)
1439         ntun=`expr $i : 'tun\(.*\)$'`
1440         unit=0
1441         while [ $unit -le $ntun ]; do
1442                 mknod tun$unit c 52 $unit uucp:dialer
1443                 unit=$(($unit + 1))
1444         done
1445         ;;
1446
1447 tap*)
1448         ntap=`expr $i : 'tap\(.*\)$'`
1449         unit=0
1450         while [ $unit -le $ntap ]; do
1451                 mknod tap$unit c 149 $unit root:network
1452                 unit=$(($unit + 1))
1453         done
1454         ;;
1455
1456 sysmouse)
1457         mknod sysmouse c 12 128
1458         mknod consolectl c 12 255
1459         ;;
1460
1461 snp?)
1462         unit=`expr $i : 'snp\(.*\)'`
1463         mknod snp$unit c 53 $unit
1464         ;;
1465
1466 # dufault@hda.com: If I do much more work on other A-D boards
1467 # then eventually we'll have a "ad" and "dio" interface and some of these
1468 # "labpcaio" ones will be gone.
1469 # labpcaio: D-A and A-D.
1470 # labpcdio: Digital in and Digital out.
1471 #
1472 labpc*)
1473         umask 7
1474         case $i in
1475         labpcaio*)
1476                 name=labpcaio
1477                 unit=`expr $i : 'labpcaio\(.*\)'`
1478                 all="0 1 2 3 4 5 6 7"
1479                 offset=0
1480                 ;;
1481         labpcdio*)
1482                 name=labpcdio
1483                 unit=`expr $i : 'labpcdio\(.*\)'`
1484                 all="0 1 2 3"
1485                 offset=8
1486                 ;;
1487         *)
1488                 die 3 "Don't know LabPC type $i"
1489                 ;;
1490         esac
1491         if [ -z "${unit}" ]; then
1492                 unit=all
1493         fi
1494         case $unit in
1495                 0|1|2|3|4|5|6|7)
1496                                 mknod $name$unit c 66 `expr $offset + $unit `
1497                 ;;
1498                 all)
1499                         for i in $all
1500                         do
1501                                 mknod $name$i c 66 `expr $offset + $i `
1502                         done
1503                         ;;
1504                 *)
1505                         echo "No such LabPC unit: $unit"
1506                         ;;
1507         esac
1508         umask 77
1509         ;;
1510
1511 perfmon)
1512         mknod perfmon c 2 32 root:kmem
1513         chmod 640 perfmon
1514         ;;
1515
1516 ipl)
1517         mknod ipl c 79 0
1518         mknod ipnat c 79 1
1519         mknod ipstate c 79 2
1520         mknod ipauth c 79 3
1521         ;;
1522
1523 kbd*)
1524         unit=`expr $i : 'kbd\(.*\)'`
1525         chr=112
1526         mknod kbd$unit c $chr $unit
1527         ;;
1528
1529 i4b)
1530         mknod i4b c 60 0
1531         ;;
1532
1533 i4bctl)
1534         mknod i4bctl c 55 0
1535         ;;
1536
1537 i4brbch*)
1538         unit=`expr $i : 'i4brbch\(.*\)'`
1539         mknod i4brbch$unit c 57 $unit
1540         ;;
1541
1542 i4bteld*)
1543         offset=64
1544         unit=`expr $i : 'i4bteld\(.*\)'`
1545         mknod i4bteld$unit c 56 `expr $offset + $unit `
1546         ;;
1547
1548 i4btel*)
1549         unit=`expr $i : 'i4btel\(.*\)'`
1550         mknod i4btel$unit c 56 $unit
1551         ;;
1552
1553 i4btrc*)
1554         unit=`expr $i : 'i4btrc\(.*\)'`
1555         mknod i4btrc$unit c 59 $unit
1556         ;;
1557
1558 mlx*)
1559         unit=`expr $i : 'mlx\(.*\)'`
1560         mknod mlx$unit c 130 $unit
1561         ;;
1562
1563 3dfx*)
1564         unit=`expr $i : '3dfx\(.*\)'`
1565         mknod 3dfx$unit c 107 $unit
1566         ln -sf 3dfx$unit 3dfx
1567         ;;
1568
1569 agpgart)
1570         mknod agpgart c 148 0
1571         ;;
1572
1573 twe*)
1574         unit=`expr $i : 'twe\(.*\)'`
1575         mknod twe$unit c 146 $unit
1576         ;;
1577
1578 local)
1579         umask 0                 # XXX should be elsewhere
1580         sh MAKEDEV.local
1581         umask 77
1582         ;;
1583
1584 *)
1585         echo $i - no such device name
1586         ;;
1587
1588 esac
1589 done