Continue untangling the disklabel.
[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.28 2007/05/19 00:51:54 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 #       ccd*    CCD disks
47 #       cd*     SCSI CD-ROM disks
48 #       da*     SCSI Direct Access Devices
49 #       fd*     floppy disk drives (3 1/2", 5 1/4")
50 #       fla*    M-Systems DiskOnChip
51 #       idad*   Compaq Smart-2 RAID arrays
52 #       ips*    IBM ServeRAID controller
53 #       ipsd*   IBM ServeRAID
54 #       md*     Memory (or malloc) disk
55 #       mlx*    Mylex DAC960 RAID controllers
56 #       mlxd*   Mylex DAC960 RAID disk volumes
57 #       pst*    Promise SuperTrak RAID disks
58 #       vn*     vnode disks
59 #       vkd*    virtual kernel disk
60 #
61 # Console ports:
62 #       vty*    virtual console devices for syscons
63 #
64 # Pointing devices:
65 #       mse*    Logitech and ATI Inport bus mouse
66 #       psm*    PS/2 mouse
67 #       jogdial Sony VAIO Jogdial
68 #       sysmouse Mousesystems mouse emulator for syscons
69 #
70 # Time devices:
71 #       refclock-* serial ports used by xntpd parse refclocks
72 #
73 # Terminal ports:
74 #       tty*    general purpose serial ports
75 #       cua*    dialout serial ports
76 #       ttyA*   Specialix SI/XIO dialin ports ('*' = number of devices)
77 #       cuaA*   Specialix SI/XIO dialout ports
78 #       ttyD*   Digiboard - 16 dialin ports
79 #       cuaD*   Digiboard - 16 dialout ports
80 #       ttyE*   Stallion EasyIO (stl) dialin ports
81 #       cuaE*   Stallion EasyIO (stl) dialout ports
82 #       ttyF*   Stallion Brumby (stli) dialin ports
83 #       cuaF*   Stallion Brumby (stli) dialout ports
84 #       ttyR*   Rocketport dialin ports
85 #       cuaR*   Rocketport dialout ports
86 #
87 #       stlN    Stallion EasyIO board N dialin and dialout
88 #       stliN   Stallion Brumby board N dialin and dialout
89 #
90 # Pseudo terminals:
91 #       pty*    set of 32 master and slave pseudo terminals
92 #       vty*    virtual terminals using syscons console
93 #
94 # Parallel port:
95 #       lpt*    Printer
96 #       ppi*    Parallel port i/o
97 #       pps*    Pulse per second timing interface
98 #       pcfclock* Parallel time sync interface
99 #
100 # I2C and SMBus:
101 #       iic*    I2C devices
102 #       smb*    SMBUS devices
103 #
104 # USB devices:
105 #       usb*    USB bus control device
106 #       ucom*   USB serial devices
107 #       ugen*   generic USB device
108 #       uhid*   Human Interface Device (HID)
109 #       ulpt*   printer
110 #       umodem* modems
111 #       ums*    mouse
112 #       urio*   Diamond Rio 500
113 #       uscanner* USB scanners
114 #
115 # SCSI devices (other than CD-ROM, tape and disk):
116 #       ch*     SCSI Media-Changer (juke box) driver
117 #       pt*     Processor Type (HP scanner, as one example)
118 #       pass*   CAM Passthrough device
119 #       ses*    SES (SCSI Environmental Services) and
120 #               SAF-TE (Scsi Accessable Fault-Tolerant Enclosures) device
121 #
122 # PC-CARD (previously called PCMCIA) support
123 #       card*   PC-CARD slots
124 #
125 # ISDN devices:
126 #       i4b     isdnd call control device
127 #       i4bctl  debugging control device
128 #       i4btrc* trace data interface(s), one per passive card
129 #       i4btel* telephony interface(s)
130 #       i4bteld* telephony dialout interface(s)
131 #       i4brbch* raw b channel access device(s)
132 #
133 # Special purpose devices:
134 #       acpi    ACPI control device
135 #       apm     Advanced Power Management BIOS
136 #       apmctl  APM BIOS control device
137 #       bpf*    packet filter
138 #       crypto  crypto interface
139 #       speaker pc speaker
140 #       tw*     xten power controller
141 #       snd*    various sound cards
142 #       pcaudio PCM audio driver
143 #       socksys iBCS2 socket system driver
144 #       vat     VAT compatibility audio driver (requires snd*)
145 #       gsc     Genius GS-4500 hand scanner
146 #       joy     pc joystick
147 #       tun*    Tunneling IP device
148 #       tap*    Ethernet Tunneling device
149 #       snp*    tty snoop devices
150 #       spigot  Video Spigot video acquisition card
151 #       ctx*    Cortex-I video acquisition card
152 #       meteor* Matrox Meteor video acquisition card (pci)
153 #       bktr*   Bt848 based video acquisition card (pci)
154 #       labpc*  National Instrument's Lab-PC and LAB-PC+
155 #       perfmon CPU performance-monitoring counters
156 #       pci     PCI configuration-space access from user mode
157 #       ipl     ipfilter control devices (ipl, ipnat, ipstate, ipauth)
158 #       kbd     keyboard devices
159 #       elan-mmcr       AMD Elan support (e.g. mmap MMCR)
160 #       agpgart AGP interface
161 #       nsmb*   SMB/CIFS protocol interface
162 #       pf      PF packet filter
163 #
164 ##############################################################################
165 #
166 # To override the default ownership and/or permissions, you now have the
167 # /etc/devices.conf file (create it if it's not there). Entries in this file
168 # should look like:
169 #
170 # ad0s1c        root:staff      666     # Override ad0s1c
171 # ad0*          root:wheel      641     # Override the entire ad0 family
172 # sa0.ctl       heinz:ketchup   444     # Override device control node
173 # sa*.ctl       heinz:ketchup   666     # Override all sa* control nodes
174 # fd/4          ihate:floppies  000     # Override /dev/fd/4
175 #
176 # See the devices.conf(5) man page for further information.
177 #
178 # J.Anslik (joerg@anslik.de)
179 #
180 ##############################################################################
181
182
183
184 #-----------------------------------------------------------------------------
185 # Where all device special files are built.
186 #-----------------------------------------------------------------------------
187
188 DEVDIR=dev
189
190
191 #-----------------------------------------------------------------------------
192 # File containing local ownership and permissions override entries.
193 #-----------------------------------------------------------------------------
194
195 DEVPERMS_LOCAL="/etc/devices.conf"
196
197
198 #-----------------------------------------------------------------------------
199 # Some useful programs.
200 #-----------------------------------------------------------------------------
201
202 cut=/usr/bin/cut
203 grep=/usr/bin/grep
204 mknod=/sbin/mknod
205 sed=/usr/bin/sed
206 tr=/usr/bin/tr
207
208
209 #-----------------------------------------------------------------------------
210 # Set up a default search path.
211 #-----------------------------------------------------------------------------
212
213 if [ -n "$MAKEDEVPATH" ]
214 then
215         PATH="$MAKEDEVPATH"
216 else
217         PATH=/sbin:/bin
218 fi
219
220
221 #-----------------------------------------------------------------------------
222 # Print error message $2 and exit this script, returning $1.
223 #-----------------------------------------------------------------------------
224
225 die()
226 {
227         echo $2
228
229         exit $1
230 }
231
232
233 #-----------------------------------------------------------------------------
234 # Convert integer to partition name.
235 #-----------------------------------------------------------------------------
236
237 dkitop()
238 {
239         local p
240
241         case $1 in
242          0) p=a;;  1) p=b;;  2) p=c;;  3) p=d;;
243          4) p=e;;  5) p=f;;  6) p=g;;  7) p=h;;
244          8) p=i;; 9) p=j;;  10) p=k;; 11) p=l;;
245         12) p=m;; 13) p=n;; 14) p=o;; 15) p=p;;
246          *) p="?";;
247         esac
248
249         echo $p
250 }
251
252
253 #-----------------------------------------------------------------------------
254 # Convert integer to slice name.
255 #-----------------------------------------------------------------------------
256
257 dkitos()
258 {
259         local s
260
261         case $1 in
262         0|1) s="" ;;
263           *) s=s$(($1-1)) ;;
264         esac
265
266         echo $s
267 }
268
269 #-----------------------------------------------------------------------------
270 # Convert unit, slice, partition to minor number.
271 #-----------------------------------------------------------------------------
272 #
273 # ndkminor(unit, slice, partition)
274
275 ndkminor()
276 {
277         echo $(( (($1 & 31) << 3) | (($1 & 480) << 16) | \
278                 (($2 & 15) << 16) | (($2 & 112) << 25) | \
279                 ($3 & 7) | (($3 & 8) << 17) | (($3 & 240) << 21) ))
280 }
281
282
283 #-----------------------------------------------------------------------------
284 # Create the device node.
285 #-----------------------------------------------------------------------------
286
287 mknod() {
288
289         local dev=$1
290         local unit=$2
291
292         #---------------------------------------------------------------------
293         # Remove old device node, if any.
294         #---------------------------------------------------------------------
295
296         rm -f "$dev$unit" || exit 1
297
298
299         #---------------------------------------------------------------------
300         # Supply default ownership and/or permissions according to the
301         # number of parameters passed to this function.
302         #---------------------------------------------------------------------
303
304         case $# in
305         5) owner=root:wheel; perms=600;;
306         6) owner=$6;         perms=600;;
307         7) owner=$6;         perms=$7;;
308         *) die 2 "Bad call: mknod $@";;
309         esac
310
311
312         #---------------------------------------------------------------------
313         # Get rid of first two parameters (no longer needed)
314         #---------------------------------------------------------------------
315
316         shift; shift
317
318
319         #---------------------------------------------------------------------
320         # If there's a /etc/devices.conf file, check for local overrides.
321         #---------------------------------------------------------------------
322
323         if [ -s $DEVPERMS_LOCAL ]
324         then
325                 #-------------------------------------------------------------
326                 # Temporarily prepend the device portion with a subdir name
327                 # if we're not in $DEVDIR. We need to do this to distinguish
328                 # between device nodes that live in /dev, and device nodes
329                 # that live in /dev/subdir, like /dev/fd. This way, we can
330                 # have "fd*" entries in the permission files, as well as
331                 # "fd/*" stuff.
332                 #-------------------------------------------------------------
333
334                 tmpdev=$dev
335                 pwd=`/usr/bin/basename $PWD`
336
337                 [ "$pwd" = "$DEVDIR" ] || dev="${pwd}/$dev"
338
339
340                 #-------------------------------------------------------------
341                 # Check /etc/devices.conf for local overrides
342                 #-------------------------------------------------------------
343
344                 match=`$grep ^$dev$unit[[:space:]] $DEVPERMS_LOCAL | \
345                         $sed 's/\*/\\\*/'`
346
347                 [ "$match" ] ||
348                 if [ `expr "$unit" : '\(.*\)\.ctl$'` ]
349                 then
350                         match=`$grep ^$dev\\\*\\\.ctl[[:space:]] \
351                         $DEVPERMS_LOCAL | $sed 's/\*/\\\*/'`
352                 else
353                         match=`$grep ^$dev\\\*[[:space:]] $DEVPERMS_LOCAL | \
354                                 $sed 's/\*/\\\*/'`
355                 fi
356
357                 if [ "$match" ]
358                 then
359                         # Separate each field by one space character...
360                         match=`echo $match | $tr -s "[:space:]" " "`
361
362                         # ...and extract owenership and permissions.
363                         owner=`echo $match | $cut -d' ' -f2`
364                         perms=`echo $match | $cut -d' ' -f3`
365                 fi
366
367                 #-------------------------------------------------------------
368                 # Restore "plain" device name (no prepending subdir name).
369                 #-------------------------------------------------------------
370
371                 dev=$tmpdev
372         fi
373
374         #---------------------------------------------------------------------
375         # Finally, set ownership and permissions.
376         #---------------------------------------------------------------------
377
378         $mknod $dev$unit $1 $2 $3 $owner
379         chmod $perms $dev$unit
380 }
381
382
383 #-----------------------------------------------------------------------------
384 # Convert tape (ctrl, unit, mode, access) to device minor number.
385 #-----------------------------------------------------------------------------
386
387 saminor()
388 {
389         echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
390 }
391
392
393 #-----------------------------------------------------------------------------
394 # Convert the last character of a tty name to a device minor number.
395 #-----------------------------------------------------------------------------
396
397 ttyminor()
398 {
399         case $1 in
400         [0-9]) m=$1;;
401         a) m=10;; b) m=11;; c) m=12;; d) m=13;;
402         e) m=14;; f) m=15;; g) m=16;; h) m=17;;
403         i) m=18;; j) m=19;; k) m=20;; l) m=21;;
404         m) m=22;; n) m=23;; o) m=24;; p) m=25;;
405         q) m=26;; r) m=27;; s) m=28;; t) m=29;;
406         u) m=30;; v) m=31;;
407         *) m="?";;
408         esac
409
410         echo $m
411 }
412
413
414 #-----------------------------------------------------------------------------
415 # Convert a unit number to a device minor number.
416 #-----------------------------------------------------------------------------
417
418 unit2minor()
419 {
420         echo $(((($1 >> 8) << 16) | ($1 % 256)))
421 }
422
423
424 #-----------------------------------------------------------------------------
425 # Stallion devices need some (weird) special treatment.
426 #-----------------------------------------------------------------------------
427
428 stallion()
429 {
430         major=$1
431         letter=$2
432         card=$3
433         iscallout=$4
434
435         port=0
436         maxport=8
437         pref=tty
438         owner=
439         minorbase=0
440
441         if [ $iscallout -gt 0 ]
442         then
443                 pref=cua
444                 owner=uucp:dialer
445                 minorbase=128
446         fi
447
448         case "$card" in 
449         [0-7]);;
450             *) die 1 "Invalid stl card number $card";;
451         esac
452
453         # Make the mem interface for extracting stats & loading microcode.
454         # 0x1000000 + card number
455         mknod staliomem $card c $major 0x0100000$card
456
457         while [ $port -lt $maxport ]
458         do
459                 minor=$(($minorbase + $card * 1048576 + $port))
460
461                 [ $port -lt 32 ] || minor=$(($minor + 65504))
462
463                 unit=$(($card * 64 + $port))
464
465                 mknod ${pref}${letter}  $unit c $major $minor $owner
466                 mknod ${pref}i${letter} $unit c $major $(($minor + 32)) $owner
467                 mknod ${pref}l${letter} $unit c $major $(($minor + 64)) $owner
468
469                 port=$(($port + 1))
470         done
471 }
472
473
474 #-----------------------------------------------------------------------------
475 # Do it.
476 #-----------------------------------------------------------------------------
477
478 for i in $*; do
479 case $i in
480
481 all)
482         sh MAKEDEV std                                  # standard
483         sh MAKEDEV fd0 fd1                              # bdev, floppy disk
484         sh MAKEDEV da0 da1 da2 da3 da4 da5 da6 da7      # bdev, SCSI disk
485         sh MAKEDEV da8 da9 da10 da11 da12 da13 da14     # bdev, SCSI disk
486         sh MAKEDEV da15                                 # bdev, SCSI disk
487         sh MAKEDEV ccd0 ccd1 ccd2 ccd3                  # ccd disk
488         sh MAKEDEV ata                                  # cdev, ATA control
489         sh MAKEDEV ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7      # bdev, ATA disk
490         sh MAKEDEV ar0 ar1                              # bdev, ATA RAID disk
491         sh MAKEDEV acd0 afd0 ast0                       # bdev, ATAPI devices
492         sh MAKEDEV vn0                                  # bdev, virtual disk
493         sh MAKEDEV vkd0                                 # bdev, virtual disk
494         sh MAKEDEV cd0                                  # bdev, cdrom
495         sh MAKEDEV sa0 wt0                              # bdev, tape
496         sh MAKEDEV vty12                                # cdev, virtual tty
497         sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3              # cdev, serial tty
498         sh MAKEDEV pty0                                 # cdev, pseudo tty
499         sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3              # cdev, serial tty
500         sh MAKEDEV kbd0 kbd1                            # cdev, keyboard
501         sh MAKEDEV mse0 psm0 jogdial sysmouse           # cdev, mouse
502         sh MAKEDEV pcaudio speaker snd0                 # cdev, noise
503         sh MAKEDEV ipsd0                                # cdev, ServeRAID disk
504         sh MAKEDEV lpt0 lpt1 lpt2                       # cdev, printer
505         sh MAKEDEV ppi0 ppi1 ppi2                       # cdev, parallel port
506         sh MAKEDEV iic0 iic1                            # cdev, I2C device
507         sh MAKEDEV smb0 smb1                            # cdev, SMBus device
508         sh MAKEDEV usb usb0 uhid0 ums0 ulpt0 ugen0      # cdev, USB devices
509         sh MAKEDEV usb1 uhid1 ums1 ulpt1 ugen1          # cdev, USB devices
510         sh MAKEDEV usb2 usb3 usb4 usb5                  # cdev, USB devices
511         sh MAKEDEV urio0 uscanner0 umodem0              # cdev, USB devices too
512         sh MAKEDEV bpf0 bpf1 bpf2 bpf3                  # cdev, network
513         sh MAKEDEV ipl tun0 tun1 tun2 tun3              # cdev, network
514         sh MAKEDEV tap0 tap1 tap2 tap3                  # cdev, network
515         sh MAKEDEV ch0 perfmon tw0                      # cdev, miscellaneous
516         sh MAKEDEV acpi                                 # cdev, laptop
517         sh MAKEDEV apm apmctl card0 card1 card2 card3   # cdev, laptop
518         sh MAKEDEV pass4 xpt2                           # cdev, CAM
519         sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1           # cdev, ISDN
520         sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1    # cdev, ISDN
521         sh MAKEDEV i4brbch0 i4brbch1                    # cdev, ISDN
522         sh MAKEDEV agpgart                              # cdev, AGP
523         sh MAKEDEV nsmb0                                # cdev, SMB/CIFS
524         sh MAKEDEV twed0                                # 3ware
525         sh MAKEDEV crypto                               # cdev, crypto
526         sh MAKEDEV fw0                                  # cdev, firewire
527         sh MAKEDEV dcons                                # cdev, dcons
528         sh MAKEDEV pf                                   # pf
529         ;;
530
531
532 #-----------------------------------------------------------------------------
533 # A much restricted set of the above, to save precious i-nodes on the
534 # fixit floppy
535 #-----------------------------------------------------------------------------
536
537 fixit)
538         sh MAKEDEV std                                  # standard
539         sh MAKEDEV fd0                                  # bdev, floppy disk
540         sh MAKEDEV da0                                  # bdev, SCSI disk
541         sh MAKEDEV ad0                                  # bdev, ATA disk
542         sh MAKEDEV acd0 afd0 ast0                       # bdev, ATAPI devices
543         sh MAKEDEV vn0                                  # bdev, virtual disk
544         sh MAKEDEV vkd0                                 # bdev, virtual disk
545         sh MAKEDEV cd0                                  # bdev, cdrom
546         sh MAKEDEV sa0                                  # bdev, tape
547         sh MAKEDEV vty2                                 # cdev, virtual tty
548         sh MAKEDEV cuaa0                                # cdev, serial tty
549         sh MAKEDEV pty0                                 # cdev, pseudo tty
550         sh MAKEDEV ttyd0                                # cdev, serial tty
551         sh MAKEDEV kbd0                                 # cdev, keyboard
552         sh MAKEDEV mse0 psm0 sysmouse                   # cdev, mouse
553         sh MAKEDEV lpt0                                 # cdev, printer
554         sh MAKEDEV ppi0                                 # cdev, parallel port
555         sh MAKEDEV iic0                                 # cdev, I2C device
556         sh MAKEDEV smb0                                 # cdev, SMBus device
557         sh MAKEDEV ums0                                 # cdev, USB devices
558         sh MAKEDEV tun0                                 # cdev, network
559         sh MAKEDEV tap0                                 # cdev, network
560         sh MAKEDEV ch0                                  # cdev, miscellaneous
561         sh MAKEDEV apm apmctl card0                     # cdev, laptop
562         sh MAKEDEV pass1 xpt1                           # cdev, CAM
563         sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1           # cdev, ISDN
564         sh MAKEDEV i4btel0 i4bteld0                     # cdev, ISDN
565         sh MAKEDEV i4brbch0                             # cdev, ISDN
566         rm -f fd/[1-9]?
567         ;;
568
569 #-----------------------------------------------------------------------------
570 # Basic device node set.
571 #-----------------------------------------------------------------------------
572
573 std)
574         mknod console "" c 0 0
575         mknod kmem    "" c 2 1 root:kmem 640
576         mknod mem     "" c 2 0 root:kmem 640
577         mknod null    "" c 2 2 root:wheel 666
578         mknod random  "" c 2 3 root:wheel 644
579         mknod urandom "" c 2 4 root:wheel 644
580         mknod zero    "" c 2 12 root:wheel 666
581         mknod io      "" c 2 14
582         mknod tty     "" c 1 0 root:wheel 666
583         mknod klog    "" c 7 0
584         mknod stdin   "" c 22 0 root:wheel 666
585         mknod stdout  "" c 22 1 root:wheel 666
586         mknod stderr  "" c 22 2 root:wheel 666
587         mknod pci     "" c 78 0 root:wheel 644
588
589
590         #---------------------------------------------------------------------  
591         # Create floppy disk nodes in /dev/fd
592         #---------------------------------------------------------------------  
593
594         mkdir -p fd
595
596         (cd fd &&
597          i=0   &&
598          while [ $i -lt 64 ]
599          do
600                 mknod $i "" c 22 $i root:wheel 666
601
602                 i=$(($i + 1))
603          done)
604
605         chmod 555 fd
606         ;;
607
608 #-----------------------------------------------------------------------------
609
610 jail)
611         sh MAKEDEV std pty0
612
613         rm mem kmem pci io klog console
614
615         ln -sf null mem
616         ln -sf null kmem
617         ln -sf null console
618         ;;
619
620 #-----------------------------------------------------------------------------
621
622 mach-4)
623         mknod iopl     "" c 22 0
624         mknod kbd      "" c 23 0
625         mknod mouse    "" c 24 0
626         mknod time     "" c 25 0
627         mknod timezone "" c 26 0
628         ;;
629
630 #-----------------------------------------------------------------------------
631
632 wt*)
633         u=`expr $i : '..\(.*\)'`
634
635         [ "$u" ] || u=0
636
637         # Default density, 512b blocks
638         mknod rwt  $u  c 10 $((0 + $u))  root:operator 660
639         mknod nrwt $u  c 10 $((4 + $u))  root:operator 660
640
641         # Default density, 1024b blocks
642 #       mknod rWt  $u    c 10 $((64 + $u)) root:operator 660
643 #       mknod nrWt $u    c 10 $((68 + $u)) root:operator 660
644         mknod rwt  ${u}b c 10 $((16 + $u)) root:operator 660    # 60 MB
645         mknod nrwt ${u}b c 10 $((20 + $u)) root:operator 660
646         mknod rwt  ${u}c c 10 $((24 + $u)) root:operator 660    # 120 MB
647         mknod nrwt ${u}c c 10 $((28 + $u)) root:operator 660
648         mknod rwt  ${u}d c 10 $((32 + $u)) root:operator 660    # 150 MB
649         mknod nrwt ${u}d c 10 $((36 + $u)) root:operator 660
650 #       mknod rwt  ${u}e c 10 $((40 + $u)) root:operator 660    # 300 MB?
651 #       mknod nrwt ${u}e c 10 $((44 + $u)) root:operator 660
652 #       mknod rwt  ${u}f c 10 $((48 + $u)) root:operator 660    # 600 MB?
653 #       mknod nrwt ${u}f c 10 $((52 + $u)) root:operator 660
654         ;;
655
656 #-----------------------------------------------------------------------------
657
658 aacd*s*|acd*s*|ad*s*|ar*s*|afd*s*|amrd*s*|ccd*s*|da*s*|fla*s*|idad*s*|ipsd*s*|md*s*|mlxd*s*|pst*s*|twed*s*|vn*s*|vkd*s*)
659         case $i in
660         aacd*s*) name=aacd; chr=151;;
661         acd*s*)  name=acd;  chr=117;;
662         ad*s*)   name=ad;   chr=116;;
663         ar*s*)   name=ar;   chr=157;;
664         afd*s*)  name=afd;  chr=118;;
665         amrd*s*) name=amrd; chr=133;;
666         ccd*s*)  name=ccd;  chr=74;;
667         da*s*)   name=da;   chr=13;;
668         fla*s*)  name=fla;  chr=102;;
669         idad*s*) name=idad; chr=109;;
670         ipsd*s*) name=ipsd; chr=176;;
671         md*s*)   name=md;   chr=95;;
672         mlxd*s*) name=mlxd; chr=131;;
673         pst*s*)  name=pst;  chr=168;;
674         twed*s*) name=twed; chr=147;;
675         vn*s*)   name=vn;   chr=43;;
676         vkd*s*)  name=vkd;  chr=97;;
677         esac
678
679         case $i in
680         aacd*s*|amrd*s*|idad*s*|ipsd*s*|mlxd*s*|twed*s*)
681                 unit=`expr $i  : '....\([0-9]*\)s'`
682                 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
683                 part=`expr $i  : '....[0-9]*s[0-9]*\(.*\)'`
684                 ;;
685
686         acd*s*|afd*s*|ccd*s*|fla*s*|pst*s*|wfd*s*|vkd*s*)
687                 unit=`expr $i  : '...\([0-9]*\)s'`
688                 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
689                 part=`expr $i  : '...[0-9]*s[0-9]*\(.*\)'`
690                 ;;
691         *)
692                 unit=`expr $i  : '..\([0-9]*\)s'`
693                 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
694                 part=`expr $i  : '..[0-9]*s[0-9]*\(.*\)'`
695                 ;;
696         esac
697
698         case $unit in
699         [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
700                 case $slice in
701                 [0-9]|[1-2][0-9]|30)
702                         oldslice=$slice
703                         slice=$(($slice+1))
704                         slicename=`dkitos $slice`
705                         minor=`ndkminor $unit $slice 2`
706                         mknod  $name $unit${slicename}.compat c $chr $minor \
707                                 root:operator 640
708                         minor=`ndkminor $unit $slice 255`
709                         mknod  ${name} $unit$slicename c $chr $minor \
710                                 root:operator 640
711                         rm -f r$name$unit$slicename
712
713                         case $part in [a-h])
714                         [ $oldslice -ne 0 ]|| slice=$oldslice
715
716                         for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
717                         do
718                                 minor=`ndkminor $unit $slice $part`
719                                 partname=`dkitop $part`
720                                 mknod $name $unit$slicename$partname \
721                                       c $chr $minor root:operator 640
722                                 rm -f r$name$unit$slicename$partname
723                         done
724                         ;;
725
726                         "") ;;
727                         *) echo bad partition for disk in: $i
728                         ;;
729                         esac
730                         ;;
731                 *)
732                         echo bad slice for disk in: $i
733                         ;;
734                 esac
735                 ;;
736         *)
737                 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
738                 ;;
739         esac
740         ;;
741
742 #-----------------------------------------------------------------------------
743
744 fd*)
745         unit=`expr $i : '..\(.*\)'`
746         name=fd; chr=9
747
748         case $unit in
749         0|1|2|3)
750                 mknod $name $unit c $chr $(($unit * 64)) root:operator 640
751                 rm -f r$name$unit
752                 # Fake BSD partitions
753                 for i in a b c d e f g h
754                 do
755                         ln -f $name$unit $name$unit$i
756                         rm -f r$name$unit r$name$unit$i
757                 done
758                 # User-readable and programmer-readable name sets
759
760                 mknod $name ${unit}.1720 c $chr $(($unit * 64 + 1)) \
761                         root:operator 640
762                 rm -f r${name}${unit}.1720
763                 # ln -f $name${unit}.1720 ${name}${unit}135hs21
764                 # rm -f r$name${unit}135hs21
765
766                 mknod $name ${unit}.1480 c $chr $(($unit * 64 + 2)) \
767                     root:operator 640
768                 rm -f r$name${unit}.1480
769                 # ln -f $name${unit}.1480 ${name}${unit}135hs18
770                 # rm -f r$name${unit}135hs18
771                 # ln -f $name${unit}.1480 ${name}${unit}96hs18
772                 # rm -f r$name${unit}96hs18
773
774                 mknod $name ${unit}.1440 c $chr $(($unit * 64 + 3)) \
775                     root:operator 640
776                 rm -f r$name${unit}.1440
777                 # ln -f $name${unit}.1440 $name${unit}135
778                 # rm -f r$name${unit}135
779                 # ln -f $name${unit}.1440 $name${unit}135ds18
780                 # rm -f r$name${unit}135ds18
781                 # ln -f $name${unit}.1440 $name${unit}96ds18
782                 # rm -f r$name${unit}96ds18
783
784                 mknod $name ${unit}.1200 c $chr $(($unit * 64 + 4)) \
785                     root:operator 640
786                 rm -f r$name${unit}.1200
787                 # ln -f $name${unit}.1200 $name${unit}96
788                 # rm -f r$name${unit}96
789                 # ln -f $name${unit}.1200 $name${unit}96ds15
790                 # rm -f r$name${unit}96ds15
791                 # ln -f $name${unit}.1200 $name${unit}135ds15
792                 # rm -f r$name${unit}135ds15
793
794                 mknod $name ${unit}.820 c $chr $(($unit * 64 + 5)) \
795                     root:operator 640
796                 rm -f r$name${unit}.820
797                 # ln -f $name${unit}.820 $name${unit}96hs10
798                 # rm -f r$name${unit}96hs10
799                 # ln -f $name${unit}.820 $name${unit}135hs10
800                 # rm -f r$name${unit}135hs10
801
802                 mknod $name ${unit}.800 c $chr $(($unit * 64 + 6)) \
803                     root:operator 640
804                 rm -f r$name${unit}.800
805                 # ln -f $name${unit}.800 $name${unit}96ds10
806                 # rm -f r$name${unit}96ds10
807                 # ln -f $name${unit}.800 $name${unit}135ds10
808                 # rm -f r$name${unit}135ds10
809
810                 mknod $name ${unit}.720 c $chr $(($unit * 64 + 7)) \
811                     root:operator 640
812                 rm -f r$name${unit}.720
813                 # ln -f $name${unit}.720 $name${unit}96ds9
814                 # rm -f r$name${unit}96ds9
815                 # ln -f $name${unit}.720 $name${unit}135ds9
816                 # rm -f r$name${unit}135ds9
817
818                 mknod $name ${unit}.360 c $chr $(($unit * 64 + 8)) \
819                     root:operator 640
820                 rm -f r$name${unit}.360
821                 # ln -f $name${unit}.360 $name${unit}48
822                 # rm -f r$name${unit}48
823                 # ln -f $name${unit}.360 $name${unit}48ds9
824                 # rm -f r$name${unit}48ds9
825
826                 mknod $name ${unit}.640 c $chr $(($unit * 64 + 9)) \
827                     root:operator 640
828                 rm -f r$name${unit}.640
829                 # ln -f $name${unit}.640 $name${unit}96ds8
830                 # rm -f r$name${unit}96ds8
831                 # ln -f $name${unit}.640 $name${unit}135ds8
832                 # rm -f r$name${unit}135ds8
833
834                 mknod $name ${unit}.1232 c $chr $(($unit * 64 + 10)) \
835                     root:operator 640
836                 rm -f r$name${unit}.1232
837                 # ln -f $name${unit}.1232 $name${unit}96ds8
838                 # rm -f r$name${unit}96ds8
839                 # ln -f $name${unit}.1232 $name${unit}135ds8
840                 # rm -f r$name${unit}135ds8
841                 ;;
842         *)
843                 echo bad unit for disk in: $i
844                 ;;
845         esac
846         ;;
847
848 #-----------------------------------------------------------------------------
849
850 acd*t*)
851         units=`expr $i : '...\(.*\)t'`;
852         tracks=`expr $i : '.*t\(.*\)'`;
853         name=acd;
854         chr=117;
855
856         [ "$units"  ] || units=0
857         [ "$tracks" ] || tracks=100
858
859         if [ "$units" -le 31 -a "$tracks" -le 169 ]
860         then
861                 i=0
862                 while [ $i -le $units ]
863                 do
864                         dname=$name$i
865                         rm -rf ${dname}t*
866
867                         j=1
868                         while [ $j -le $tracks ]
869                         do
870                                 # cd unit tracks use the compatibility slice
871                                 # and partition numbers 129+ for tracks 1+.
872                                 #
873                                 minor=`ndkminor $i 0 $(($j + 128))`
874                                 mknod ${dname}t $j c $chr $minor \
875                                         root:operator 640
876                                 j=$(($j + 1))
877                         done
878
879                         i=$(($i + 1))
880                 done
881         else
882                 echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
883         fi
884         ;;
885
886 #-----------------------------------------------------------------------------
887
888 aacd*|acd*|ad*|ar*|afd*|amrd*|ccd*|da*|fla*|idad*|ipsd*|md*|mlxd*|pst*|twed*|vn*|vkd*)
889         doslices=1
890         case $i in
891         aacd*) name=aacd; chr=151;;
892         acd*)  name=acd;  chr=117; doslices=0;;
893         ad*)   name=ad;   chr=116;;
894         ar*)   name=ar;   chr=157;;
895         afd*)  name=afd;  chr=118;;
896         amrd*) name=amrd; chr=133;;
897         da*)   name=da;   chr=13;;
898         ccd*)  name=ccd;  chr=74;;
899         fla*)  name=fla;  chr=102;;
900         idad*) name=idad; chr=109;;
901         ipsd*) name=ipsd; chr=176;;
902         md*)   name=md;   chr=95;;
903         mlxd*) name=mlxd; chr=131;;
904         pst*)  name=pst;  chr=168;;
905         twed*) name=twed; chr=147;;
906         vn*)   name=vn;   chr=43;;
907         vkd*)  name=vkd;  chr=97;;
908         esac
909
910         case $i in
911         aacd*|amrd*|idad*|ipsd*|mlxd*|twed*)
912                 unit=`expr $i : '....\(.*\)'`
913                 ;;
914         acd*|afd*|ccd*|fla*|pst*|wfd*|vkd*)
915                 unit=`expr $i : '...\(.*\)'`
916                 ;;
917         *)
918                 unit=`expr $i : '..\(.*\)'`
919                 ;;
920         esac
921
922         case $unit in
923         [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
924                 if [ "$doslices" -gt 0 ]; then
925                         for slicepartname in s0h s1h s2 s3 s4
926                         do
927                                 sh MAKEDEV $name$unit$slicepartname
928                         done
929                 else
930                         minor=`ndkminor $unit 0 0`
931                         mknod  ${name} $unit.compat c $chr $minor \
932                                 root:operator 640
933                         minor=`ndkminor $unit 1 255`
934                         mknod  ${name} ${unit} c $chr $minor \
935                                 root:operator 640
936                         minor=`ndkminor $unit 1 0`
937                         mknod  ${name} ${unit}a c $chr $minor \
938                                 root:operator 640
939                         minor=`ndkminor $unit 1 2`
940                         mknod  ${name} ${unit}c c $chr $minor \
941                                 root:operator 640
942                 fi
943                 ;;
944         *)
945                 echo bad unit for disk in: $i
946                 ;;
947         esac
948         ;;
949
950 #-----------------------------------------------------------------------------
951
952 pt[0-9]*)
953         chr=61
954         name=pt
955         unit=`expr $i : 'pt\([0-9][0-9]*\)'`
956
957         [ "$unit" ] || unit=0
958
959         unit=$(($unit + 1 - 1))
960         mknod $name $unit c $chr `unit2minor $unit`
961         ;;
962
963 #-----------------------------------------------------------------------------
964
965 ses[0-9]*)
966         chr=110
967         name=ses
968         unit=`expr $i : 'ses\([0-9][0-9]*\)'`
969
970         [ "$unit" ] || unit=0
971
972         unit=$(($unit + 1 - 1))
973         mknod $name $unit c $chr `unit2minor $unit`
974         ;;
975
976 #-----------------------------------------------------------------------------
977
978 targ[0-9]*)
979         chr=65
980         name=targ
981         unit=`expr $i : 'targ\([0-9][0-9]*\)'`
982
983         [ "$unit" ] || unit=0
984
985         unit=$(($unit + 1 - 1))
986
987         mknod $name $unit c $chr `unit2minor $unit`
988         mknod ${name}.ctl "" c $chr 0xffff00ff
989         ;;
990
991 #-----------------------------------------------------------------------------
992
993 # CAM transport layer device
994 xpt*)
995         # This major number is temporary
996         chr=104
997         name=xpt
998         units=`expr $i : 'xpt\(.*\)'`
999
1000         [ "$units" ] || units=1
1001
1002         i=0
1003         while [ $i -lt $units ]
1004         do
1005                 rm -rf $name$i
1006
1007                 mknod $name $i c $chr `unit2minor $i` root:operator
1008
1009                 i=$(($i + 1))
1010         done
1011         ;;
1012
1013 #-----------------------------------------------------------------------------
1014
1015 pass*)
1016         # This major number is temporary
1017         chr=31
1018         name=pass
1019         units=`expr $i : 'pass\(.*\)'`
1020
1021         [ "$units" ] || units=1
1022
1023         i=0
1024         while [ $i -lt $units ]
1025         do
1026                 rm -rf $name$i
1027
1028                 mknod $name $i c $chr `unit2minor $i` root:operator
1029
1030                 i=$(($i + 1))
1031         done
1032         ;;
1033
1034 #-----------------------------------------------------------------------------
1035
1036 pty*)
1037         class=`expr $i : 'pty\(.*\)'`
1038         case $class in
1039         0) offset=0   name=p;;
1040         1) offset=32  name=q;;
1041         2) offset=64  name=r;;
1042         3) offset=96  name=s;;
1043         4) offset=128 name=P;;  # Note that xterm (at least) only look at p-s.
1044         5) offset=160 name=Q;;
1045         6) offset=192 name=R;;
1046         7) offset=224 name=S;;
1047         *) echo bad unit for pty in: $i;;
1048         esac
1049
1050         case $class in
1051         0|1|2|3|4|5|6|7)
1052                 i=0
1053                 while [ $i -lt 32 ]
1054                 do
1055                         c=$(echo 0123456789abcdefghijklmnopqrstuv |
1056                             dd bs=1 skip=$i count=1 2>/dev/null)
1057
1058                         mknod tty$name $c c 5 $(($offset + $i)) root:wheel 666
1059                         mknod pty$name $c c 6 $(($offset + $i)) root:wheel 666
1060
1061                         i=$(($i + 1))
1062                 done
1063                 ;;
1064         esac
1065         ;;
1066
1067 #-----------------------------------------------------------------------------
1068
1069 sa*)
1070         unit=`expr $i : '..\(.*\)'`
1071         chr=14
1072
1073         case $unit in
1074         [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
1075                 mknod sa ${unit}.ctl c $chr `saminor 1 ${unit} 0 0` \
1076                         root:wheel 660
1077                 ln -f sa${unit}.ctl rsa${unit}.ctl
1078
1079                 for m in 0 1 2 3
1080                 do
1081                         mknod sa ${unit}.$m c $chr \
1082                             `saminor 0 $unit $m 0` root:operator 660
1083                         ln -f sa${unit}.$m rsa${unit}.$m
1084
1085                         mknod nsa ${unit}.$m c $chr \
1086                             `saminor 0 $unit $m 1` root:operator 660
1087                         ln -f nsa${unit}.$m nrsa${unit}.$m
1088
1089                         mknod esa ${unit}.$m c $chr \
1090                             `saminor 0 $unit $m 2` root:operator 660
1091                         ln -f esa${unit}.$m ersa${unit}.$m
1092                 done
1093
1094                 ln -f sa${unit}.0  sa$unit
1095                 ln -f sa${unit}.0  rsa${unit}.0
1096                 ln -f sa${unit}.0  rsa$unit
1097                 ln -f nsa${unit}.0 nsa$unit
1098                 ln -f nsa${unit}.0 nrsa${unit}.0
1099                 ln -f nsa${unit}.0 nrsa$unit
1100                 ln -f esa${unit}.0 esa$unit
1101                 ln -f esa${unit}.0 ersa${unit}.0
1102                 ln -f esa${unit}.0 ersa$unit
1103                 ;;
1104         *)
1105                 echo bad unit for tape in: $i
1106                 ;;
1107         esac
1108         ;;
1109
1110 #-----------------------------------------------------------------------------
1111
1112 ch*)
1113         unit=`expr $i : '..\(.*\)'`
1114
1115         case $i in
1116         ch*) name=ch;  chr=17;;
1117         esac
1118
1119         case $unit in
1120         0|1|2|3|4|5|6)
1121                 mknod $name $unit c $chr $unit root:operator 640
1122                 ;;
1123         *)
1124                 echo bad unit for media changer in: $i
1125                 ;;
1126         esac
1127         ;;
1128
1129 #-----------------------------------------------------------------------------
1130
1131 ata)
1132         mknod ata "" c 159 0 root:operator
1133         ;;
1134
1135 #-----------------------------------------------------------------------------
1136
1137 ast*)
1138         unit=`expr $i : '...\(.*\)'`
1139         chr=119
1140
1141         case $unit in
1142         0|1|2|3)
1143                 mknod ast  $unit c $chr $(($unit * 8 + 0)) root:operator 640
1144                 mknod nast $unit c $chr $(($unit * 8 + 1)) root:operator 640
1145                 ;;
1146         *)
1147                 echo bad unit for tape in: $i
1148                 ;;
1149         esac
1150         ;;
1151
1152 #-----------------------------------------------------------------------------
1153
1154 cd*)
1155         case $i in
1156         cd*)  units=`expr $i : '..\(.*\)'` ; name=cd;  chr=15;;
1157         esac
1158
1159         [ "$units" ] || units=0
1160
1161         if [ "$units" -le 31 ]
1162         then
1163                 i=0
1164                 while [ $i -le $units ]
1165                 do
1166                         dname=$name$i
1167                         rm -rf ${dname}*
1168
1169                         case $name in 
1170                         acd)
1171                                 mknod $name ${i} c $chr $(($i * 8 )) \
1172                                         root:operator 640
1173                                 ln -f ${dname} ${dname}a
1174                                 ln -f ${dname} ${dname}c
1175                                 ;;
1176                         *)
1177                                 mknod $name ${i}a c $chr $(($i * 8)) \
1178                                         root:operator 640
1179                                 mknod $name ${i}c c $chr $(($i * 8 + 2)) \
1180                                         root:operator 640
1181                                 ;;
1182                         esac
1183
1184                         rm -f r${dname}a
1185                         rm -f r${dname}c
1186
1187                         i=$(($i + 1))
1188                 done
1189         else
1190                 echo "$i is invalid -- can't have more than 32 cd devices"
1191         fi
1192         ;;
1193
1194 #-----------------------------------------------------------------------------
1195
1196 iic*)
1197         unit=`expr $i : 'iic\(.*\)'`
1198
1199         mknod iic $unit c 105 `unit2minor $unit`
1200         ;;
1201
1202 #-----------------------------------------------------------------------------
1203
1204 smb*)
1205         unit=`expr $i : 'smb\(.*\)'`
1206
1207         mknod smb $unit c 106 `unit2minor $unit`
1208         ;;
1209
1210 #-----------------------------------------------------------------------------
1211
1212 pcfclock*)
1213         unit=`expr $i : 'pcfclock\(.*\)'`
1214
1215         mknod pcfclock $unit c 140 `unit2minor $unit`
1216         ;;
1217
1218 #-----------------------------------------------------------------------------
1219
1220 ppi*)
1221         unit=`expr $i : 'ppi\(.*\)'`
1222
1223         mknod ppi $unit c 82 `unit2minor $unit`
1224         ;;
1225
1226 #-----------------------------------------------------------------------------
1227
1228 pps*)
1229         unit=`expr $i : 'pps\(.*\)'`
1230
1231         mknod pps $unit c 89 `unit2minor $unit`
1232         ;;
1233
1234 #-----------------------------------------------------------------------------
1235
1236 usb)
1237         mknod usb "" c 108 255 root:operator 0660
1238         ;;
1239
1240 #-----------------------------------------------------------------------------
1241
1242 usb*)
1243         unit=`expr $i : 'usb\(.*\)'`
1244
1245         mknod usb $unit c 108 `unit2minor $unit` root:operator 660
1246         ;;
1247
1248 #-----------------------------------------------------------------------------
1249
1250 ucom*)
1251         unit=`expr $i : 'ucom\(.*\)'`
1252
1253         minor=$(($unit + 128))
1254         minor=`unit2minor $(($unit + 128))`
1255
1256         mknod ucom $unit c 138 $minor uucp:dialer 660
1257         ;;
1258
1259 #-----------------------------------------------------------------------------
1260
1261 uhid*)
1262         unit=`expr $i : 'uhid\(.*\)'`
1263
1264         mknod uhid $unit c 122 `unit2minor $unit` root:operator 660
1265         ;;
1266
1267 #-----------------------------------------------------------------------------
1268
1269 ums*)
1270         unit=`expr $i : 'ums\(.*\)'`
1271
1272         mknod ums $unit c 111 `unit2minor $unit` root:operator 660
1273         ;;
1274
1275 #-----------------------------------------------------------------------------
1276
1277 ulpt*)
1278         unit=`expr $i : 'ulpt\(.*\)'`
1279
1280         minor=`unit2minor $unit`
1281         mknod ulpt $unit c 113 $minor
1282
1283         minor=`unit2minor $(($unit + 64))`
1284         mknod unlpt $unit c 113 $minor          # and the 'no prime' version
1285         ;;
1286
1287 #-----------------------------------------------------------------------------
1288
1289 ugen*)
1290         unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
1291         endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
1292
1293         [ "$unit" ] || echo $i - Invalid unit number
1294
1295         if [ -z "${endpoint}" ]         # ugen0 & ugen0.1 - ugen0.15
1296         then
1297                 mknod ugen $unit c 114 `unit2minor $(($unit * 16))` \
1298                         root:operator 660
1299                 i=1
1300                 while [ $i -lt 16 ]
1301                 do
1302                         mknod ugen $unit.$i c 114 `unit2minor \
1303                                 $(($unit * 16 + $i))` root:operator 660
1304
1305                         i=$(($i + 1))
1306                 done
1307         else
1308                 minor=`unit2minor $(($unit * 16 + $endpoint))`
1309                 mknod ugen $unit.$endpoint c 114 $minor root:operator 660
1310         fi
1311         ;;
1312
1313 #-----------------------------------------------------------------------------
1314
1315 urio*)
1316         unit=`expr $i : 'urio\(.*\)'`
1317
1318         mknod urio $unit c 143 `unit2minor $unit` root:operator 660
1319         ;;
1320
1321 #-----------------------------------------------------------------------------
1322
1323 uscanner*)
1324         unit=`expr $i : 'uscanner\(.*\)'`
1325
1326         mknod uscanner $unit c 156 `unit2minor $unit` root:operator 660
1327         ;;
1328
1329 #-----------------------------------------------------------------------------
1330
1331 umodem*)
1332         unit=`expr $i : 'umodem\(.*\)'`
1333
1334         mknod umodem $unit c 124 `unit2minor $unit` uucp:dialer 660
1335         ;;
1336
1337 #-----------------------------------------------------------------------------
1338
1339 lpt*)
1340         unit=`expr $i : 'lpt\(.*\)'`
1341
1342         mknod lpt $unit   c 16 `unit2minor $unit`
1343         mknod lpctl $unit c 16 `unit2minor $(($unit + 128))`
1344         ;;
1345
1346 #-----------------------------------------------------------------------------
1347
1348 vty*)
1349         chr=12
1350         units=`expr $i : 'vty\(.*\)'`
1351
1352         i=0
1353         while [ $i -lt $units ]
1354         do
1355                 mknod ttyv $(printf %01x $i) c $chr `unit2minor $i`
1356
1357                 i=$(($i + 1))
1358         done
1359
1360         ln -fs ttyv0 vga
1361         ;;
1362
1363 #-----------------------------------------------------------------------------
1364
1365 nmdm*)
1366         units=`expr $i : 'nmdm\(.*\)'`
1367         chr=18
1368
1369         i=0
1370         while [ $i -lt $units ]
1371         do
1372                 minor=`unit2minor $i`
1373                 minor=$(($minor + $minor))
1374                 mknod nmdm ${i}A c $chr $minor
1375                 mknod nmdm ${i}B c $chr $(($minor + 1))
1376
1377                 i=$(($i + 1))
1378         done
1379         ;;
1380
1381 #-----------------------------------------------------------------------------
1382
1383 bpf*)
1384         nbpf=`expr $i : 'bpf\(.*\)$'`
1385
1386         unit=0
1387         while [ $unit -le $nbpf ]
1388         do
1389                 mknod bpf $unit c 23 `unit2minor $unit`
1390
1391                 unit=$(($unit + 1))
1392         done
1393         ;;
1394
1395 #-----------------------------------------------------------------------------
1396
1397 speaker)
1398         mknod speaker "" c 26 0
1399         ;;
1400
1401 #-----------------------------------------------------------------------------
1402
1403 cua?|cuaa?|cuaa??)
1404         unit_low=`expr $i : 'cua.*\(.\)$'`
1405
1406         case $i in
1407         cua?|cuaa?)
1408                 unit_high=""
1409                 m_high=0
1410                 ;;
1411         cuaa??)
1412                 unit_high=`expr $i : 'cuaa\(.\).$'`
1413                 m_high=`ttyminor $unit_high`
1414                 ;;
1415         esac
1416
1417         unit=$unit_high$unit_low
1418         m=$(($m_high << 16 | `ttyminor $unit_low`))
1419
1420         mknod cuaa  $unit c 28 $(($m | 128)) uucp:dialer 660
1421         mknod cuaia $unit c 28 $(($m | 32 | 128)) uucp:dialer 660
1422         mknod cuala $unit c 28 $(($m | 64 | 128)) uucp:dialer 660
1423         ;;
1424
1425 #-----------------------------------------------------------------------------
1426
1427 crypto)
1428         mknod crypto "" c 70 0 root:operator 666
1429         ;;
1430
1431 #-----------------------------------------------------------------------------
1432
1433 pf)
1434         mknod pf "" c 73 0 root:operator 600
1435         ;;
1436
1437 #-----------------------------------------------------------------------------
1438
1439 fw?)
1440         unit=`expr $i : 'fw\(.\)$'`
1441
1442         for sub in 0 1 2 3
1443         do
1444                 minor=$(($unit << 16 | $sub))
1445                 mknod fw $unit.$sub c 127 $minor root:operator 660
1446                 mknod fwmem $unit.$sub c 127 $((1<<24 | $minor)) \
1447                         root:operator 660
1448         done
1449
1450         ln -sf fw$unit.0 fw$unit
1451         ln -sf fwmem$unit.0 fwmem$unit
1452         ;;
1453
1454 #-----------------------------------------------------------------------------
1455
1456 dcons)
1457         mknod dcons "" c 184 0 root:wheel 600
1458         ;;
1459
1460 #-----------------------------------------------------------------------------
1461
1462 tty?|tty0?|ttyd?|ttyd??)
1463         unit_low=`expr $i : 'tty.*\(.\)$'`
1464
1465         case $i in
1466         tty?|tty0?|ttyd?)
1467                 unit_high=""
1468                 m_high=0
1469                 ;;
1470         ttyd??)
1471                 unit_high=`expr $i : 'ttyd\(.\).$'`
1472                 m_high=`ttyminor $unit_high`
1473                 ;;
1474         esac
1475
1476         unit=$unit_high$unit_low
1477         m=$(($m_high << 16 | `ttyminor $unit_low`))
1478
1479         mknod ttyd $unit  c 28 $m
1480         mknod ttyid $unit c 28 $(($m | 32))
1481         mknod ttyld $unit c 28 $(($m | 64))
1482         ;;
1483
1484 #-----------------------------------------------------------------------------
1485
1486 cuac?)
1487         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1488                   g h i j k l m n o p q r s t u v"
1489         major=48
1490         card=`expr $i : 'cua.*\(.\)$'`
1491
1492         for unit in $portlist
1493         do
1494                 minor=`ttyminor $unit`
1495                 minor=$(($card * 65536 + $minor))
1496                 name=$card$unit
1497
1498                 mknod cuac $name  c $major $(($minor + 128)) uucp:dialer 660
1499                 mknod cuaic $name c $major $(($minor + 32 + 128)) \
1500                         uucp:dialer 660
1501                 mknod cualc $name c $major $(($minor + 64 + 128)) \
1502                         uucp:dialer 660
1503         done
1504         ;;
1505
1506 #-----------------------------------------------------------------------------
1507
1508 ttyc?)
1509         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1510                   g h i j k l m n o p q r s t u v"
1511         major=48
1512         card=`expr $i : 'tty.*\(.\)$'`
1513
1514         for unit in $portlist
1515         do
1516                 minor=`ttyminor $unit`
1517                 minor=$(($card * 65536 + $minor))
1518                 name=$card$unit
1519
1520                 mknod ttyc $name  c $major $minor
1521                 mknod ttyic $name c $major $(($minor + 32))
1522                 mknod ttylc $name c $major $(($minor + 64))
1523         done
1524         ;;
1525
1526 #-----------------------------------------------------------------------------
1527
1528 cuam?)
1529         unit=`expr $i : 'cua.*\(.\)$'`
1530
1531         m=`ttyminor $unit`
1532
1533         mknod cuam $unit c 63 $(($m + 128)) uucp:dialer 660
1534         ;;
1535
1536 #-----------------------------------------------------------------------------
1537
1538 ttym?)
1539         unit=`expr $i : 'tty.*\(.\)$'`
1540
1541         m=`ttyminor $unit`
1542
1543         mknod ttym $unit c 63 $m
1544         ;;
1545
1546 #-----------------------------------------------------------------------------
1547
1548 ttyA*)
1549         major=68
1550         nports=`expr $i : 'ttyA\(.*\)$'`
1551         port=1
1552
1553         while [ $port -le $nports ]
1554         do
1555                 minor=$(($port - 1))
1556                 name=$(printf %02d $port)
1557
1558                 mknod ttyA $name  c $major $minor
1559                 mknod ttyiA $name c $major $(($minor + 65536))
1560                 mknod ttylA $name c $major $(($minor + 131072))
1561
1562                 port=$(($port + 1))
1563         done
1564
1565         # For the user-mode control program, 'sicontrol'
1566         mknod si_control "" c 68 262144
1567         ;;
1568
1569 #-----------------------------------------------------------------------------
1570
1571 cuaA*)
1572         major=68
1573         nports=`expr $i : 'cuaA\(.*\)$'`
1574         port=1
1575
1576         while [ $port -le $nports ]
1577         do
1578                 minor=$(($port - 1))
1579                 name=$(printf %02d $port)
1580
1581                 mknod cuaA $name  c $major $(($minor + 128)) uucp:dialer 660
1582                 mknod cuaiA $name c $major $(($minor + 128 + 65536)) \
1583                     uucp:dialer 660
1584                 mknod cualA $name c $major $(($minor + 128 + 131072)) \
1585                     uucp:dialer 660
1586
1587                 port=$(($port + 1))
1588         done
1589         ;;
1590
1591 #-----------------------------------------------------------------------------
1592
1593 ttyD?)
1594         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1595         major=58
1596         card=`expr $i : 'tty.*\(.\)$'`
1597
1598         for unit in $portlist
1599         do
1600                 minor=`ttyminor $unit`
1601                 minor=$(($card * 65536 + $minor))
1602                 name=$card$unit
1603
1604                 mknod ttyD  $name c $major $minor
1605                 mknod ttyiD $name c $major $(($minor + 32))
1606                 mknod ttylD $name c $major $(($minor + 64))
1607         done
1608         ;;
1609
1610 #-----------------------------------------------------------------------------
1611
1612 cuaD?)
1613         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1614         major=58
1615         card=`expr $i : 'cua.*\(.\)$'`
1616
1617         for unit in $portlist
1618         do
1619                 minor=`ttyminor $unit`
1620                 minor=$(($card * 65536 + $minor))
1621                 name=$card$unit
1622
1623                 mknod cuaD $name c $major $(($minor + 128)) uucp:dialer 660
1624                 mknod cuaiD $name c $major $(($minor + 32 + 128)) \
1625                         uucp:dialer 660
1626                 mknod cualD $name c $major $(($minor + 64 + 128)) \
1627                         uucp:dialer 660
1628         done
1629         ;;
1630
1631 #-----------------------------------------------------------------------------
1632
1633 ttyE*)
1634         stallion 72 E `expr $i : 'tty.*\(.\)$'` 0
1635         ;;
1636 cuaE*)
1637         stallion 72 E `expr $i : 'cua.*\(.\)$'` 1
1638         ;;
1639 stl*)
1640         card=`expr $i : 'stl\(.\)$'`
1641         stallion 72 E $card 0
1642         stallion 72 E $card 1
1643         ;;
1644
1645 ttyF*)
1646         stallion 75 F `expr $i : 'tty.*\(.\)$'` 0
1647         ;;
1648 cuaF*)
1649         stallion 75 F `expr $i : 'cua.*\(.\)$'` 1
1650         ;;
1651 stli*)
1652         card=`expr $i : 'stl\(.\)$'`
1653         stallion 75 F $card 0
1654         stallion 75 F $card 1
1655         ;;
1656
1657 ttyM*)
1658         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1659         modulelist="a b c d"
1660         major=101
1661         card=`expr $i : 'tty.*\(.\)$'`
1662
1663         for unit in $modulelist
1664         do
1665                 moduleminor=`ttyminor $unit`
1666                 moduleminor=$(($moduleminor % 10 * 16))
1667                 modulename=$unit
1668
1669                 for unit in $portlist
1670                 do
1671                         minor=`ttyminor $unit`
1672                         minor=$(($card * 65536 + $minor + $moduleminor))
1673                         name=$card$modulename$unit
1674
1675                         rm -f tty*M$name
1676
1677                         mknod ttyM $name  c $major $minor
1678                         mknod ttyiM $name c $major $(($minor + 64))
1679                         mknod ttylM $name c $major $(($minor + 128))
1680                 done
1681         done
1682         ;;
1683
1684 cuaM?)
1685         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1686         modulelist="a b c d"
1687         major=101
1688         card=`expr $i : 'cua.*\(.\)$'`
1689
1690         for unit in $modulelist
1691         do
1692                 moduleminor=`ttyminor $unit`
1693                 moduleminor=$(($moduleminor % 10 * 16))
1694                 modulename=$unit
1695
1696                 for unit in $portlist
1697                 do
1698                         minor=`ttyminor $unit`
1699                         minor=$(($card * 65536 + $minor + $moduleminor))
1700                         name=$card$modulename$unit
1701
1702                         rm -f cua*M$name
1703
1704                         mknod cuaM $name c $major $(($minor + 262144)) \
1705                             uucp:dialer 660
1706                         mknod cuaiM $name c $major $(($minor + 64 + 262144)) \
1707                             uucp:dialer 660
1708                         mknod cualM $name c $major $(($minor + 128 + 262144)) \
1709                             uucp:dialer 660
1710                 done
1711         done
1712         ;;
1713
1714 ttyR?)
1715         major=81
1716         BOARD=1; Rnum=0
1717         MINOR=$(($BOARD * 65536))
1718         controllers=$(
1719         dmesg | while read first rest
1720         do
1721                 case "$first" in
1722                 RocketPort[0-4]) echo "$first"
1723                 ;;
1724                 esac
1725         done)
1726
1727         rm -f ttyR* ttyiR* ttylR*
1728
1729         for i in $controllers
1730         do
1731                 ndevices=$(
1732                 dmesg | while read first bar ports rest
1733                         do
1734                                 case "$first" in
1735                                 $i*) echo "$ports"
1736                                 ;;
1737                                 esac
1738                         done)
1739
1740                 echo -n "Creating $ndevices devices for $i: "
1741                 dev=0
1742
1743                 while [ $dev -lt $ndevices ]
1744                 do
1745                         mknod ttyR $Rnum c $major $MINOR
1746                         mknod ttyiR $Rnum c $major $(($MINOR + 32))
1747                         mknod ttylR $Rnum c $major $(($MINOR + 64))
1748
1749                         Rnum=$(($Rnum + 1))
1750                         MINOR=$(($MINOR + 1))
1751
1752                         dev=$(($dev + 1))
1753                 done
1754
1755                 BOARD=$(($BOARD + 1))
1756                 MINOR=$(($BOARD * 65536))
1757                 echo " "
1758         done
1759         ;;
1760
1761 cuaR?)
1762         major=81
1763         BOARD=1; Rnum=0
1764         MINOR=$(($BOARD * 65536))
1765         controllers=$(
1766                 dmesg | while read first rest
1767                         do
1768                                 case "$first" in
1769                                 RocketPort[0-4]) echo "$first"
1770                                 ;;
1771                                 esac
1772                         done)
1773
1774         rm -f cuaR* cuaiR* cualR*
1775
1776         for i in $controllers
1777         do
1778                 ndevices=$(
1779                 dmesg | while read first bar ports rest
1780                         do
1781                                 case "$first" in
1782                                 $i*) echo "$ports"
1783                                 ;;
1784                                 esac
1785                         done)
1786
1787                 echo -n "Creating $ndevices devices for $i: "
1788                 dev=0
1789
1790                 while [ $dev -lt $ndevices ]
1791                 do
1792                         mknod cuaR $Rnum c  $major $(($MINOR + 128)) \
1793                                 uucp:dialer 660
1794                         mknod cuaiR $Rnum c $major $(($MINOR + 128 + 32)) \
1795                                 uucp:dialer 660
1796                         mknod cualR $Rnum c $major $(($MINOR + 128 + 64)) \
1797                                 uucp:dialer 660
1798
1799                         Rnum=$(($Rnum + 1))
1800                         MINOR=$(($MINOR + 1))
1801
1802                         dev=$(($dev + 1))
1803                 done
1804
1805                 BOARD=$(($BOARD + 1))
1806                 MINOR=$(($BOARD * 65536))
1807                 echo " "
1808         done
1809         ;;
1810
1811 #-----------------------------------------------------------------------------
1812
1813 mse*)
1814         unit=`expr $i : 'mse\(.*\)'`
1815         chr=27
1816
1817         # Non-blocking for X11
1818         mknod mse $unit c $chr `unit2minor $(($unit * 2 + 1))`
1819         ;;
1820
1821 #-----------------------------------------------------------------------------
1822
1823 psm*)
1824         unit=`expr $i : 'psm\(.*\)'`
1825         chr=21
1826
1827         # Non-blocking for X11
1828         mknod psm $unit c $chr `unit2minor $(($unit * 2 + 1))`
1829         ;;
1830
1831 #-----------------------------------------------------------------------------
1832
1833 mouse*)
1834         name=`expr $i : 'mouse\(.*\)'`
1835
1836         [ -c $name ] || $0 $name        # Make the appropriate device
1837
1838         ln -fs $name mouse
1839         ;;
1840
1841 #-----------------------------------------------------------------------------
1842
1843 pcaudio)
1844         mknod pcaudio    "" c 24 0
1845         mknod pcaudioctl "" c 24 128
1846         ;;
1847
1848 #-----------------------------------------------------------------------------
1849
1850 socksys)
1851         mknod socksys "" c 41 0 root:wheel 666
1852         mknod spx     "" c 41 1 root:wheel 666
1853
1854         ln -fs socksys nfsd
1855         ;;
1856
1857 #-----------------------------------------------------------------------------
1858
1859 snd*)
1860
1861         unit=`expr $i : 'snd\(.*\)'`
1862         chr=30
1863
1864         ln -fs mixer$unit mixer
1865         ln -fs sequencer$unit sequencer
1866         ln -fs dsp$unit dsp
1867         ln -fs audio$unit audio
1868         ln -fs dspW$unit dspW
1869         ln -fs music$unit music
1870         ln -fs pss$unit pss
1871         ln -fs dsp$unit.0 dsp$unit
1872         ln -fs audio$unit.0 audio$unit
1873         ln -fs dspW$unit.0 dspW$unit
1874
1875         mknod mixer $unit c $chr `unit2minor $(($unit * 16 + 0))` \
1876                 root:wheel 666
1877         mknod sequencer $unit c $chr `unit2minor $(($unit * 16 + 1))` \
1878                 root:wheel 666
1879         mknod midi $unit c $chr `unit2minor $(($unit * 16 + 2))` \
1880                 root:wheel 666
1881
1882         for chn in 0 1 2 3
1883         do
1884                 minor=$(($chn * 65536 + $unit * 16))
1885
1886                 mknod dsp $unit.$chn   c $chr $(($minor + 3)) root:wheel 666
1887                 mknod audio $unit.$chn c $chr $(($minor + 4)) root:wheel 666
1888                 mknod dspW $unit.$chn  c $chr $(($minor + 5)) root:wheel 666
1889         done
1890
1891         mknod sndstat "" c $chr 6 root:wheel 666
1892         mknod music $unit c $chr `unit2minor $(($unit * 16 + 8))` root:wheel 666
1893         mknod pss $unit c $chr `unit2minor $(($unit * 16 + 9))` root:wheel 666
1894         ;;
1895
1896 #-----------------------------------------------------------------------------
1897
1898 vat)
1899         mknod vatio "" c 25 128 root:wheel 660
1900         ;;
1901
1902 #-----------------------------------------------------------------------------
1903
1904 gsc*)
1905         unit=`expr $i : 'gsc\(.*\)'`
1906
1907         mknod gsc $unit c 47 `unit2minor $unit` root:wheel 666
1908         mknod gsc ${unit}p c 47 `unit2minor $(($unit + 8))` root:wheel 666
1909         mknod gsc ${unit}d c 47 `unit2minor $(($unit + 32))` root:wheel 666
1910         mknod gsc ${unit}pd c 47 `unit2minor $(($unit + 40))` root:wheel 666
1911         ;;
1912
1913 #-----------------------------------------------------------------------------
1914
1915 acpi)
1916         mknod acpi "" c 152 0 root:operator 664
1917         ;;
1918
1919 #-----------------------------------------------------------------------------
1920
1921 apm)
1922         mknod apm "" c 39 0 root:operator 664
1923         ;;
1924
1925 #-----------------------------------------------------------------------------
1926
1927 apmctl)
1928         mknod apmctl "" c 39 8 root:operator 660
1929         ;;
1930
1931 #-----------------------------------------------------------------------------
1932
1933 card*)
1934         unit=`expr $i : 'card\(.*\)'`
1935         chr=50
1936
1937         mknod card $unit c $chr `unit2minor $unit` root:wheel 644
1938         ;;
1939
1940 #-----------------------------------------------------------------------------
1941
1942 ttyx?|ttyy?|ttyz?)
1943         case $i in
1944         *0) unit=0;;  *1) unit=1;;  *2) unit=2;;  *3) unit=3;;
1945         *4) unit=4;;  *5) unit=5;;  *6) unit=6;;  *7) unit=7;;
1946         *8) unit=8;;  *9) unit=9;;  *a) unit=10;; *b) unit=11;;
1947         *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1948         esac
1949
1950         case $i in
1951         ttyy?) unit=$(($unit + 16));;
1952         ttyz?) unit=$(($unit + 32));;
1953         esac
1954
1955         mknod $i "" c 42 $unit
1956         ;;
1957
1958 #-----------------------------------------------------------------------------
1959
1960 cronyx)
1961         mknod cronyx "" c 42 63
1962         ;;
1963
1964 #-----------------------------------------------------------------------------
1965
1966 joy)
1967         mknod joy 0 c 51 0 root:operator 640
1968         mknod joy 1 c 51 1 root:operator 640
1969         ;;
1970
1971 #-----------------------------------------------------------------------------
1972
1973 spigot)
1974         mknod spigot "" c 11 0 root:wheel 444
1975         ;;
1976
1977 #-----------------------------------------------------------------------------
1978
1979 ctx?)
1980         unit=`expr $i : 'ctx\(.*\)'`
1981
1982         mknod ctx $unit c 40 `unit2minor $unit` root:wheel 444
1983         ;;
1984
1985 #-----------------------------------------------------------------------------
1986
1987 meteor?)
1988         unit=`expr $i : 'meteor\(.*\)'`
1989
1990         mknod meteor $unit c 67 `unit2minor $unit` root:wheel 444
1991         ;;
1992
1993 #-----------------------------------------------------------------------------
1994
1995 bktr?)
1996         unit=`expr $i : 'bktr\(.*\)'`
1997
1998         mknod bktr  $unit c 92 `unit2minor $unit` root:wheel 444
1999         mknod tuner $unit c 92 `unit2minor $((16 + $unit))` root:wheel 444
2000         mknod vbi   $unit c 92 `unit2minor $((32 + $unit))` root:wheel 444
2001         ;;
2002
2003 #-----------------------------------------------------------------------------
2004
2005 tun*)
2006         ntun=`expr $i : 'tun\(.*\)$'`
2007         unit=0
2008
2009         while [ $unit -le $ntun ]
2010         do
2011                 mknod tun $unit c 52 `unit2minor $unit`
2012
2013                 unit=$(($unit + 1))
2014         done
2015         ;;
2016
2017 #-----------------------------------------------------------------------------
2018
2019 tap*)
2020         ntap=`expr $i : 'tap\(.*\)$'`
2021         unit=0
2022
2023         while [ $unit -le $ntap ]
2024         do
2025                 mknod tap $unit c 149 `unit2minor $unit` root:network
2026
2027                 unit=$(($unit + 1))
2028         done
2029         ;;
2030
2031 #-----------------------------------------------------------------------------
2032
2033 sysmouse)
2034         mknod sysmouse "" c 12 128
2035         mknod consolectl "" c 12 255
2036         ;;
2037
2038 #-----------------------------------------------------------------------------
2039
2040 jogdial)
2041         mknod jogdial "" c 160 0
2042         ;;
2043
2044 #-----------------------------------------------------------------------------
2045
2046 snp?)
2047         unit=`expr $i : 'snp\(.*\)'`
2048
2049         mknod snp $unit c 53 `unit2minor $unit`
2050         ;;
2051
2052 #-----------------------------------------------------------------------------
2053
2054 labpc*)
2055         case $i in
2056         labpcaio*)
2057                 name=labpcaio
2058                 unit=`expr $i : 'labpcaio\(.*\)'`
2059                 all="0 1 2 3 4 5 6 7"
2060                 offset=0
2061                 ;;
2062
2063         labpcdio*)
2064                 name=labpcdio
2065                 unit=`expr $i : 'labpcdio\(.*\)'`
2066                 all="0 1 2 3"
2067                 offset=8
2068                 ;;
2069
2070         *)
2071                 die 3 "Don't know LabPC type $i"
2072                 ;;
2073         esac
2074
2075         [ "${unit}" ] || unit=all
2076
2077         case $unit in
2078                 0|1|2|3|4|5|6|7)
2079                         mknod $name $unit c 66 $(($offset + $unit)) \
2080                                 root:wheel 660
2081                 ;;
2082
2083                 all)
2084                         for i in $all
2085                         do
2086                                 mknod $name $i c 66 $(($offset + $i)) \
2087                                         root:wheel 660
2088                         done
2089                         ;;
2090
2091                 *)
2092                         echo "No such LabPC unit: $unit"
2093                         ;;
2094         esac
2095         ;;
2096
2097 #-----------------------------------------------------------------------------
2098
2099 perfmon)
2100         mknod perfmon "" c 2 32 root:kmem 640
2101         ;;
2102
2103 #-----------------------------------------------------------------------------
2104
2105 ipl)
2106         mknod ipl     "" c 79 0
2107         mknod ipnat   "" c 79 1
2108         mknod ipstate "" c 79 2
2109         mknod ipauth  "" c 79 3
2110         ;;
2111
2112 #-----------------------------------------------------------------------------
2113
2114 elan*)
2115         mknod elan-mmcr "" c 100 0 root:wheel 600
2116         ;;
2117
2118 #-----------------------------------------------------------------------------
2119
2120 kbd*)
2121         unit=`expr $i : 'kbd\(.*\)'`
2122         chr=112
2123
2124         mknod kbd $unit c $chr `unit2minor $unit`
2125         ;;
2126
2127 #-----------------------------------------------------------------------------
2128
2129 i4b)
2130         mknod i4b "" c 60 0
2131         ;;
2132
2133 i4bctl)
2134         mknod i4bctl "" c 55 0
2135         ;;
2136
2137 i4brbch*)
2138         unit=`expr $i : 'i4brbch\(.*\)'`
2139
2140         mknod i4brbch $unit c 57 `unit2minor $unit`
2141         ;;
2142
2143 i4bteld*)
2144         offset=64
2145         unit=`expr $i : 'i4bteld\(.*\)'`
2146
2147         mknod i4bteld $unit c 56 `unit2minor $(($offset + $unit))`
2148         ;;
2149
2150 i4btel*)
2151         unit=`expr $i : 'i4btel\(.*\)'`
2152
2153         mknod i4btel $unit c 56 `unit2minor $unit`
2154         ;;
2155
2156 i4btrc*)
2157         unit=`expr $i : 'i4btrc\(.*\)'`
2158
2159         mknod i4btrc $unit c 59 `unit2minor $unit`
2160         ;;
2161
2162 #-----------------------------------------------------------------------------
2163
2164 aac*)
2165         unit=`expr $i : 'aac\(.*\)'`
2166
2167         mknod aac $unit c 150 `unit2minor $unit`
2168
2169         ln -fs aac$unit afa$unit
2170         ln -fs aac$unit hpn$unit
2171         ;;
2172
2173 #-----------------------------------------------------------------------------
2174
2175 mlx*)
2176         unit=`expr $i : 'mlx\(.*\)'`
2177
2178         mknod mlx $unit c 130 `unit2minor $unit`
2179         ;;
2180
2181 #-----------------------------------------------------------------------------
2182
2183 amr*)
2184         unit=`expr $i : 'amr\(.*\)'`
2185
2186         mknod amr $unit c 132 `unit2minor $unit`
2187         ;;
2188
2189 #-----------------------------------------------------------------------------
2190
2191 ips*)
2192         unit=`expr $i : 'ips\(.*\)'`
2193
2194         mknod mlx $unit c 175 `unit2minor $unit`
2195         ;;
2196
2197 #-----------------------------------------------------------------------------
2198
2199 ciss*)
2200         unit=`expr $i : 'ciss\(.*\)'`
2201
2202         mknod ciss $unit c 166 `unit2minor $unit`
2203         ;;
2204
2205 #-----------------------------------------------------------------------------
2206
2207 agpgart)
2208         mknod agpgart "" c 148 0
2209         ;;
2210
2211 #-----------------------------------------------------------------------------
2212
2213 twe*)
2214         unit=`expr $i : 'twe\(.*\)'`
2215
2216         mknod twe $unit c 146 `unit2minor $unit`
2217         ;;
2218
2219 #-----------------------------------------------------------------------------
2220
2221 tw*)
2222         unit=`expr $i : 'tw\(.*\)'`
2223
2224         mknod tw $unit c 19 `unit2minor $unit` root:operator
2225         ;;
2226
2227 #-----------------------------------------------------------------------------
2228
2229 nsmb*)
2230         unit=`expr $i : 'nsmb\(.*\)'`
2231
2232         mknod nsmb $unit c 144 $unit
2233         ;;
2234
2235 #-----------------------------------------------------------------------------
2236
2237 local)
2238         umask 0
2239         sh MAKEDEV.local
2240         umask 77
2241         ;;
2242
2243 #-----------------------------------------------------------------------------
2244
2245 *)
2246         echo $i - no such device name
2247         ;;
2248
2249 esac
2250 done