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