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