Reformulate some code which was #if 0'd out in the last patch. When
[dragonfly.git] / etc / MAKEDEV
blob360317bb9a0c930811e87e85faf0875ccb29e7b2
1 #!/bin/sh -
3 # Copyright (c) 1990 The Regents of the University of California.
4 # All rights reserved.
6 # Written and contributed by W. Jolitz 12/90
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.
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.20 2005/05/07 17:38:33 swildner Exp $
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)
34 # Tapes:
35 # ast* ATAPI tape drives
36 # wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
37 # sa* SCSI Sequential Access Devices
39 # Disks:
40 # aac* Adaptec FSA RAID controllers
41 # aacd* Adaptec FSA RAID
42 # acd* ATAPI CD-ROM disks
43 # ad* ATA disks
44 # afd* ATAPI floppy disks
45 # amrd* AMI MegaRAID
46 # cd* SCSI CD-ROM disks
47 # da* SCSI Direct Access Devices
48 # fd* floppy disk drives (3 1/2", 5 1/4")
49 # fla* M-Systems DiskOnChip
50 # idad* Compaq Smart-2 RAID arrays
51 # ips* IBM ServeRAID controller
52 # ipsd* IBM ServeRAID
53 # mcd* Mitsumi CD-ROM disks
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 # scd* Sony CD-ROM disks
59 # vn* vnode disks
61 # Console ports:
62 # vty* virtual console devices for syscons
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
70 # Time devices:
71 # refclock-* serial ports used by xntpd parse refclocks
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
87 # stlN Stallion EasyIO board N dialin and dialout
88 # stliN Stallion Brumby board N dialin and dialout
90 # Pseudo terminals:
91 # pty* set of 32 master and slave pseudo terminals
92 # vty* virtual terminals using syscons console
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
100 # I2C and SMBus:
101 # iic* I2C devices
102 # smb* SMBUS devices
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
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
122 # PC-CARD (previously called PCMCIA) support
123 # card* PC-CARD slots
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)
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 # cfs* Coda Distributed Filesystem
162 # nsmb* SMB/CIFS protocol interface
163 # pf PF packet filter
165 ##############################################################################
167 # To override the default ownership and/or permissions, you now have the
168 # /etc/devices.conf file (create it if it's not there). Entries in this file
169 # should look like:
171 # ad0s1c root:staff 666 # Override ad0s1c
172 # ad0* root:wheel 641 # Override the entire ad0 family
173 # sa0.ctl heinz:ketchup 444 # Override device control node
174 # sa*.ctl heinz:ketchup 666 # Override all sa* control nodes
175 # fd/4 ihate:floppies 000 # Override /dev/fd/4
177 # See the devices.conf(5) man page for further information.
179 # J.Anslik (joerg@anslik.de)
181 ##############################################################################
185 #-----------------------------------------------------------------------------
186 # Where all device special files are built.
187 #-----------------------------------------------------------------------------
189 DEVDIR=dev
192 #-----------------------------------------------------------------------------
193 # File containing local ownership and permissions override entries.
194 #-----------------------------------------------------------------------------
196 DEVPERMS_LOCAL="/etc/devices.conf"
199 #-----------------------------------------------------------------------------
200 # Some useful programs.
201 #-----------------------------------------------------------------------------
203 cut=/usr/bin/cut
204 grep=/usr/bin/grep
205 mknod=/sbin/mknod
206 sed=/usr/bin/sed
207 tr=/usr/bin/tr
210 #-----------------------------------------------------------------------------
211 # Set up a default search path.
212 #-----------------------------------------------------------------------------
214 if [ -n "$MAKEDEVPATH" ]
215 then
216 PATH="$MAKEDEVPATH"
217 else
218 PATH=/sbin:/bin
222 #-----------------------------------------------------------------------------
223 # Print error message $2 and exit this script, returning $1.
224 #-----------------------------------------------------------------------------
226 die()
228 echo $2
230 exit $1
234 #-----------------------------------------------------------------------------
235 # Convert integer to partition name.
236 #-----------------------------------------------------------------------------
238 dkitop()
240 local p
242 case $1 in
243 0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;;
244 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
245 8) p=i;; 9) p=j;; 10) p=k;; 11) p=l;;
246 12) p=m;; 13) p=n;; 14) p=o;; 15) p=p;;
247 *) p="?";;
248 esac
250 echo $p
254 #-----------------------------------------------------------------------------
255 # Convert integer to slice name.
256 #-----------------------------------------------------------------------------
258 dkitos()
260 local s
262 case $1 in
263 0|1) s="" ;;
264 *) s=s$(($1-1)) ;;
265 esac
267 echo $s
270 #-----------------------------------------------------------------------------
271 # Convert disk|type|unit|slice|partition to minor number.
272 #-----------------------------------------------------------------------------
274 dkminor()
276 echo $(($1 << 25 | ($2 / 32) << 21 | \
277 ($2 % 32) << 3 | $3 << 16 | \
278 ($4 & 7) | ($4 & 8) << 17))
282 #-----------------------------------------------------------------------------
283 # Create the device node.
284 #-----------------------------------------------------------------------------
286 mknod() {
288 local dev=$1
289 local unit=$2
291 #---------------------------------------------------------------------
292 # Remove old device node, if any.
293 #---------------------------------------------------------------------
295 rm -f "$dev$unit" || exit 1
298 #---------------------------------------------------------------------
299 # Supply default ownership and/or permissions according to the
300 # number of parameters passed to this function.
301 #---------------------------------------------------------------------
303 case $# in
304 5) owner=root:wheel; perms=600;;
305 6) owner=$6; perms=600;;
306 7) owner=$6; perms=$7;;
307 *) die 2 "Bad call: mknod $@";;
308 esac
311 #---------------------------------------------------------------------
312 # Get rid of first two parameters (no longer needed)
313 #---------------------------------------------------------------------
315 shift; shift
318 #---------------------------------------------------------------------
319 # If there's a /etc/devices.conf file, check for local overrides.
320 #---------------------------------------------------------------------
322 if [ -s $DEVPERMS_LOCAL ]
323 then
324 #-------------------------------------------------------------
325 # Temporarily prepend the device portion with a subdir name
326 # if we're not in $DEVDIR. We need to do this to distinguish
327 # between device nodes that live in /dev, and device nodes
328 # that live in /dev/subdir, like /dev/fd. This way, we can
329 # have "fd*" entries in the permission files, as well as
330 # "fd/*" stuff.
331 #-------------------------------------------------------------
333 tmpdev=$dev
334 pwd=`/usr/bin/basename $PWD`
336 [ "$pwd" = "$DEVDIR" ] || dev="${pwd}/$dev"
339 #-------------------------------------------------------------
340 # Check /etc/devices.conf for local overrides
341 #-------------------------------------------------------------
343 match=`$grep ^$dev$unit[[:space:]] $DEVPERMS_LOCAL | \
344 $sed 's/\*/\\\*/'`
346 [ "$match" ] ||
347 if [ `expr "$unit" : '\(.*\)\.ctl$'` ]
348 then
349 match=`$grep ^$dev\\\*\\\.ctl[[:space:]] \
350 $DEVPERMS_LOCAL | $sed 's/\*/\\\*/'`
351 else
352 match=`$grep ^$dev\\\*[[:space:]] $DEVPERMS_LOCAL | \
353 $sed 's/\*/\\\*/'`
356 if [ "$match" ]
357 then
358 # Separate each field by one space character...
359 match=`echo $match | $tr -s "[:space:]" " "`
361 # ...and extract owenership and permissions.
362 owner=`echo $match | $cut -d' ' -f2`
363 perms=`echo $match | $cut -d' ' -f3`
366 #-------------------------------------------------------------
367 # Restore "plain" device name (no prepending subdir name).
368 #-------------------------------------------------------------
370 dev=$tmpdev
373 #---------------------------------------------------------------------
374 # Finally, set ownership and permissions.
375 #---------------------------------------------------------------------
377 $mknod $dev$unit $1 $2 $3 $owner
378 chmod $perms $dev$unit
382 #-----------------------------------------------------------------------------
383 # Convert tape (ctrl, unit, mode, access) to device minor number.
384 #-----------------------------------------------------------------------------
386 saminor()
388 echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
392 #-----------------------------------------------------------------------------
393 # Convert the last character of a tty name to a device minor number.
394 #-----------------------------------------------------------------------------
396 ttyminor()
398 case $1 in
399 [0-9]) m=$1;;
400 a) m=10;; b) m=11;; c) m=12;; d) m=13;;
401 e) m=14;; f) m=15;; g) m=16;; h) m=17;;
402 i) m=18;; j) m=19;; k) m=20;; l) m=21;;
403 m) m=22;; n) m=23;; o) m=24;; p) m=25;;
404 q) m=26;; r) m=27;; s) m=28;; t) m=29;;
405 u) m=30;; v) m=31;;
406 *) m="?";;
407 esac
409 echo $m
413 #-----------------------------------------------------------------------------
414 # Convert a unit number to a device minor number.
415 #-----------------------------------------------------------------------------
417 unit2minor()
419 echo $(((($1 >> 8) << 16) | ($1 % 256)))
423 #-----------------------------------------------------------------------------
424 # Stallion devices need some (weird) special treatment.
425 #-----------------------------------------------------------------------------
427 stallion()
429 major=$1
430 letter=$2
431 card=$3
432 iscallout=$4
434 port=0
435 maxport=8
436 pref=tty
437 owner=
438 minorbase=0
440 if [ $iscallout -gt 0 ]
441 then
442 pref=cua
443 owner=uucp:dialer
444 minorbase=128
447 case "$card" in
448 [0-7]);;
449 *) die 1 "Invalid stl card number $card";;
450 esac
452 # Make the mem interface for extracting stats & loading microcode.
453 # 0x1000000 + card number
454 mknod staliomem $card c $major 0x0100000$card
456 while [ $port -lt $maxport ]
458 minor=$(($minorbase + $card * 1048576 + $port))
460 [ $port -lt 32 ] || minor=$(($minor + 65504))
462 unit=$(($card * 64 + $port))
464 mknod ${pref}${letter} $unit c $major $minor $owner
465 mknod ${pref}i${letter} $unit c $major $(($minor + 32)) $owner
466 mknod ${pref}l${letter} $unit c $major $(($minor + 64)) $owner
468 port=$(($port + 1))
469 done
473 #-----------------------------------------------------------------------------
474 # Do it.
475 #-----------------------------------------------------------------------------
477 for i in $*; do
478 case $i in
480 all)
481 sh MAKEDEV std # standard
482 sh MAKEDEV fd0 fd1 # bdev, floppy disk
483 sh MAKEDEV da0 da1 da2 da3 da4 da5 da6 da7 # bdev, SCSI disk
484 sh MAKEDEV da8 da9 da10 da11 da12 da13 da14 # bdev, SCSI disk
485 sh MAKEDEV da15 # bdev, SCSI disk
486 sh MAKEDEV ata # cdev, ATA control
487 sh MAKEDEV ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 # bdev, ATA disk
488 sh MAKEDEV ar0 ar1 # bdev, ATA RAID disk
489 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
490 sh MAKEDEV vn0 # bdev, virtual disk
491 sh MAKEDEV cd0 mcd0 scd0 # bdev, cdrom
492 sh MAKEDEV sa0 wt0 # bdev, tape
493 sh MAKEDEV vty12 # cdev, virtual tty
494 sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3 # cdev, serial tty
495 sh MAKEDEV pty0 # cdev, pseudo tty
496 sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3 # cdev, serial tty
497 sh MAKEDEV zs0 # big-Alpha serial tty
498 sh MAKEDEV kbd0 kbd1 # cdev, keyboard
499 sh MAKEDEV mse0 psm0 jogdial sysmouse # cdev, mouse
500 sh MAKEDEV pcaudio speaker snd0 # cdev, noise
501 sh MAKEDEV ipsd0 # cdev, ServeRAID disk
502 sh MAKEDEV lpt0 lpt1 lpt2 # cdev, printer
503 sh MAKEDEV ppi0 ppi1 ppi2 # cdev, parallel port
504 sh MAKEDEV iic0 iic1 # cdev, I2C device
505 sh MAKEDEV smb0 smb1 # cdev, SMBus device
506 sh MAKEDEV usb usb0 uhid0 ums0 ulpt0 ugen0 # cdev, USB devices
507 sh MAKEDEV usb1 uhid1 ums1 ulpt1 ugen1 # cdev, USB devices
508 sh MAKEDEV usb2 usb3 usb4 usb5 # cdev, USB devices
509 sh MAKEDEV urio0 uscanner0 umodem0 # cdev, USB devices too
510 sh MAKEDEV bpf0 bpf1 bpf2 bpf3 # cdev, network
511 sh MAKEDEV ipl tun0 tun1 tun2 tun3 # cdev, network
512 sh MAKEDEV tap0 tap1 tap2 tap3 # cdev, network
513 sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous
514 sh MAKEDEV acpi # cdev, laptop
515 sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop
516 sh MAKEDEV pass4 xpt2 # cdev, CAM
517 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
518 sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN
519 sh MAKEDEV i4brbch0 i4brbch1 # cdev, ISDN
520 sh MAKEDEV agpgart # cdev, AGP
521 sh MAKEDEV nsmb0 # cdev, SMB/CIFS
522 sh MAKEDEV twed0 # 3ware
523 sh MAKEDEV crypto # cdev, crypto
524 sh MAKEDEV fw0 # cdev, firewire
525 sh MAKEDEV dcons # cdev, dcons
526 sh MAKEDEV pf # pf
530 #-----------------------------------------------------------------------------
531 # A much restricted set of the above, to save precious i-nodes on the
532 # fixit floppy
533 #-----------------------------------------------------------------------------
535 fixit)
536 sh MAKEDEV std # standard
537 sh MAKEDEV fd0 # bdev, floppy disk
538 sh MAKEDEV da0 # bdev, SCSI disk
539 sh MAKEDEV ad0 # bdev, ATA disk
540 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
541 sh MAKEDEV vn0 # bdev, virtual disk
542 sh MAKEDEV cd0 # bdev, cdrom
543 sh MAKEDEV sa0 # bdev, tape
544 sh MAKEDEV vty2 # cdev, virtual tty
545 sh MAKEDEV cuaa0 # cdev, serial tty
546 sh MAKEDEV pty0 # cdev, pseudo tty
547 sh MAKEDEV ttyd0 # cdev, serial tty
548 sh MAKEDEV zs0 # big-Alpha serial tty
549 sh MAKEDEV kbd0 # cdev, keyboard
550 sh MAKEDEV mse0 psm0 sysmouse # cdev, mouse
551 sh MAKEDEV lpt0 # cdev, printer
552 sh MAKEDEV ppi0 # cdev, parallel port
553 sh MAKEDEV iic0 # cdev, I2C device
554 sh MAKEDEV smb0 # cdev, SMBus device
555 sh MAKEDEV ums0 # cdev, USB devices
556 sh MAKEDEV tun0 # cdev, network
557 sh MAKEDEV tap0 # cdev, network
558 sh MAKEDEV ch0 # cdev, miscellaneous
559 sh MAKEDEV apm apmctl card0 # cdev, laptop
560 sh MAKEDEV pass1 xpt1 # cdev, CAM
561 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
562 sh MAKEDEV i4btel0 i4bteld0 # cdev, ISDN
563 sh MAKEDEV i4brbch0 # cdev, ISDN
564 rm -f fd/[1-9]?
567 #-----------------------------------------------------------------------------
568 # Basic device node set.
569 #-----------------------------------------------------------------------------
571 std)
572 mknod console "" c 0 0
573 mknod kmem "" c 2 1 root:kmem 640
574 mknod mem "" c 2 0 root:kmem 640
575 mknod null "" c 2 2 root:wheel 666
576 mknod random "" c 2 3 root:wheel 644
577 mknod urandom "" c 2 4 root:wheel 644
578 mknod zero "" c 2 12 root:wheel 666
579 mknod io "" c 2 14
580 mknod tty "" c 1 0 root:wheel 666
581 mknod klog "" c 7 0
582 mknod stdin "" c 22 0 root:wheel 666
583 mknod stdout "" c 22 1 root:wheel 666
584 mknod stderr "" c 22 2 root:wheel 666
585 mknod pci "" c 78 0 root:wheel 644
588 #---------------------------------------------------------------------
589 # Create floppy disk nodes in /dev/fd
590 #---------------------------------------------------------------------
592 mkdir -p fd
594 (cd fd &&
595 i=0 &&
596 while [ $i -lt 64 ]
598 mknod $i "" c 22 $i root:wheel 666
600 i=$(($i + 1))
601 done)
603 chmod 555 fd
606 #-----------------------------------------------------------------------------
608 jail)
609 sh MAKEDEV std pty0
611 rm mem kmem pci io klog console
613 ln -sf null mem
614 ln -sf null kmem
615 ln -sf null console
618 #-----------------------------------------------------------------------------
620 mach-4)
621 mknod iopl "" c 22 0
622 mknod kbd "" c 23 0
623 mknod mouse "" c 24 0
624 mknod time "" c 25 0
625 mknod timezone "" c 26 0
628 #-----------------------------------------------------------------------------
630 wt*)
631 u=`expr $i : '..\(.*\)'`
633 [ "$u" ] || u=0
635 # Default density, 512b blocks
636 mknod rwt $u c 10 $((0 + $u)) root:operator 660
637 mknod nrwt $u c 10 $((4 + $u)) root:operator 660
639 # Default density, 1024b blocks
640 # mknod rWt $u c 10 $((64 + $u)) root:operator 660
641 # mknod nrWt $u c 10 $((68 + $u)) root:operator 660
642 mknod rwt ${u}b c 10 $((16 + $u)) root:operator 660 # 60 MB
643 mknod nrwt ${u}b c 10 $((20 + $u)) root:operator 660
644 mknod rwt ${u}c c 10 $((24 + $u)) root:operator 660 # 120 MB
645 mknod nrwt ${u}c c 10 $((28 + $u)) root:operator 660
646 mknod rwt ${u}d c 10 $((32 + $u)) root:operator 660 # 150 MB
647 mknod nrwt ${u}d c 10 $((36 + $u)) root:operator 660
648 # mknod rwt ${u}e c 10 $((40 + $u)) root:operator 660 # 300 MB?
649 # mknod nrwt ${u}e c 10 $((44 + $u)) root:operator 660
650 # mknod rwt ${u}f c 10 $((48 + $u)) root:operator 660 # 600 MB?
651 # mknod nrwt ${u}f c 10 $((52 + $u)) root:operator 660
654 #-----------------------------------------------------------------------------
656 aacd*s*|ad*s*|ar*s*|afd*s*|amrd*s*|da*s*|fla*s*|idad*s*|ipsd*s*|md*s*|mlxd*s*|pst*s*|twed*s*|vn*s*)
657 case $i in
658 aacd*s*) name=aacd; chr=151;;
659 ad*s*) name=ad; chr=116;;
660 ar*s*) name=ar; chr=157;;
661 afd*s*) name=afd; chr=118;;
662 amrd*s*) name=amrd; chr=133;;
663 da*s*) name=da; chr=13;;
664 fla*s*) name=fla; chr=102;;
665 idad*s*) name=idad; chr=109;;
666 ipsd*s*) name=ipsd; chr=176;;
667 md*s*) name=md; chr=95;;
668 mlxd*s*) name=mlxd; chr=131;;
669 pst*s*) name=pst; chr=168;;
670 twed*s*) name=twed; chr=147;;
671 vn*s*) name=vn; chr=43;;
672 esac
674 case $i in
675 aacd*s*|amrd*s*|idad*s*|ipsd*s*|mlxd*s*|twed*s*)
676 unit=`expr $i : '....\([0-9]*\)s'`
677 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
678 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
681 afd*s*|fla*s*|pst*s*|wfd*s*)
682 unit=`expr $i : '...\([0-9]*\)s'`
683 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
684 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
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]*\(.*\)'`
691 esac
693 case $unit in
694 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
695 case $slice in
696 [0-9]|[1-2][0-9]|30)
697 oldslice=$slice
698 slice=$(($slice+1))
699 slicename=`dkitos $slice`
700 minor=`dkminor 0 $unit $slice 2`
701 mknod $name $unit$slicename c $chr $minor \
702 root:operator 640
703 rm -f r$name$unit$slicename
705 case $part in [a-h])
706 [ $oldslice -ne 0 ]|| slice=$oldslice
708 for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
710 minor=`dkminor 0 $unit $slice $part`
711 partname=`dkitop $part`
712 mknod $name $unit$slicename$partname \
713 c $chr $minor root:operator 640
714 rm -f r$name$unit$slicename$partname
715 done
718 "") ;;
719 *) echo bad partition for disk in: $i
721 esac
724 echo bad slice for disk in: $i
726 esac
729 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
731 esac
734 #-----------------------------------------------------------------------------
736 fd*)
737 unit=`expr $i : '..\(.*\)'`
738 name=fd; chr=9
740 case $unit in
741 0|1|2|3)
742 mknod $name $unit c $chr $(($unit * 64)) root:operator 640
743 rm -f r$name$unit
744 # Fake BSD partitions
745 for i in a b c d e f g h
747 ln -f $name$unit $name$unit$i
748 rm -f r$name$unit r$name$unit$i
749 done
750 # User-readable and programmer-readable name sets
752 mknod $name ${unit}.1720 c $chr $(($unit * 64 + 1)) \
753 root:operator 640
754 rm -f r${name}${unit}.1720
755 # ln -f $name${unit}.1720 ${name}${unit}135hs21
756 # rm -f r$name${unit}135hs21
758 mknod $name ${unit}.1480 c $chr $(($unit * 64 + 2)) \
759 root:operator 640
760 rm -f r$name${unit}.1480
761 # ln -f $name${unit}.1480 ${name}${unit}135hs18
762 # rm -f r$name${unit}135hs18
763 # ln -f $name${unit}.1480 ${name}${unit}96hs18
764 # rm -f r$name${unit}96hs18
766 mknod $name ${unit}.1440 c $chr $(($unit * 64 + 3)) \
767 root:operator 640
768 rm -f r$name${unit}.1440
769 # ln -f $name${unit}.1440 $name${unit}135
770 # rm -f r$name${unit}135
771 # ln -f $name${unit}.1440 $name${unit}135ds18
772 # rm -f r$name${unit}135ds18
773 # ln -f $name${unit}.1440 $name${unit}96ds18
774 # rm -f r$name${unit}96ds18
776 mknod $name ${unit}.1200 c $chr $(($unit * 64 + 4)) \
777 root:operator 640
778 rm -f r$name${unit}.1200
779 # ln -f $name${unit}.1200 $name${unit}96
780 # rm -f r$name${unit}96
781 # ln -f $name${unit}.1200 $name${unit}96ds15
782 # rm -f r$name${unit}96ds15
783 # ln -f $name${unit}.1200 $name${unit}135ds15
784 # rm -f r$name${unit}135ds15
786 mknod $name ${unit}.820 c $chr $(($unit * 64 + 5)) \
787 root:operator 640
788 rm -f r$name${unit}.820
789 # ln -f $name${unit}.820 $name${unit}96hs10
790 # rm -f r$name${unit}96hs10
791 # ln -f $name${unit}.820 $name${unit}135hs10
792 # rm -f r$name${unit}135hs10
794 mknod $name ${unit}.800 c $chr $(($unit * 64 + 6)) \
795 root:operator 640
796 rm -f r$name${unit}.800
797 # ln -f $name${unit}.800 $name${unit}96ds10
798 # rm -f r$name${unit}96ds10
799 # ln -f $name${unit}.800 $name${unit}135ds10
800 # rm -f r$name${unit}135ds10
802 mknod $name ${unit}.720 c $chr $(($unit * 64 + 7)) \
803 root:operator 640
804 rm -f r$name${unit}.720
805 # ln -f $name${unit}.720 $name${unit}96ds9
806 # rm -f r$name${unit}96ds9
807 # ln -f $name${unit}.720 $name${unit}135ds9
808 # rm -f r$name${unit}135ds9
810 mknod $name ${unit}.360 c $chr $(($unit * 64 + 8)) \
811 root:operator 640
812 rm -f r$name${unit}.360
813 # ln -f $name${unit}.360 $name${unit}48
814 # rm -f r$name${unit}48
815 # ln -f $name${unit}.360 $name${unit}48ds9
816 # rm -f r$name${unit}48ds9
818 mknod $name ${unit}.640 c $chr $(($unit * 64 + 9)) \
819 root:operator 640
820 rm -f r$name${unit}.640
821 # ln -f $name${unit}.640 $name${unit}96ds8
822 # rm -f r$name${unit}96ds8
823 # ln -f $name${unit}.640 $name${unit}135ds8
824 # rm -f r$name${unit}135ds8
826 mknod $name ${unit}.1232 c $chr $(($unit * 64 + 10)) \
827 root:operator 640
828 rm -f r$name${unit}.1232
829 # ln -f $name${unit}.1232 $name${unit}96ds8
830 # rm -f r$name${unit}96ds8
831 # ln -f $name${unit}.1232 $name${unit}135ds8
832 # rm -f r$name${unit}135ds8
835 echo bad unit for disk in: $i
837 esac
840 #-----------------------------------------------------------------------------
842 aacd*|ad*|ar*|afd*|amrd*|da*|fla*|idad*|ipsd*|md*|mlxd*|pst*|twed*|vn*)
843 case $i in
844 aacd*) name=aacd; chr=151;;
845 ad*) name=ad; chr=116;;
846 ar*) name=ar; chr=157;;
847 afd*) name=afd; chr=118;;
848 amrd*) name=amrd; chr=133;;
849 da*) name=da; chr=13;;
850 fla*) name=fla; chr=102;;
851 idad*) name=idad; chr=109;;
852 ipsd*) name=ipsd; chr=176;;
853 md*) name=md; chr=95;;
854 mlxd*) name=mlxd; chr=131;;
855 pst*) name=pst; chr=168;;
856 twed*) name=twed; chr=147;;
857 vn*) name=vn; chr=43;;
858 esac
860 case $i in
861 aacd*|amrd*|idad*|ipsd*|mlxd*|twed*)
862 unit=`expr $i : '....\(.*\)'`
864 afd*|fla*|pst*|wfd*)
865 unit=`expr $i : '...\(.*\)'`
868 unit=`expr $i : '..\(.*\)'`
870 esac
872 case $unit in
873 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
874 for slicepartname in s0h s1h s2 s3 s4
876 sh MAKEDEV $name$unit$slicepartname
877 done
880 echo bad unit for disk in: $i
882 esac
885 #-----------------------------------------------------------------------------
887 ccd*)
888 name=ccd
889 chr=74
890 unit=`expr $i : '...\(.*\)'`
892 case $unit in
893 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
894 for part in 0 1 2 3 4 5 6 7
896 minor=`dkminor 0 $unit 0 $part`
897 partname=`dkitop $part`
898 mknod $name $unit$partname c $chr $minor \
899 root:operator 640
900 rm -f r$name$unit$partname
901 done
905 echo bad unit for disk in: $i
907 esac
910 #-----------------------------------------------------------------------------
912 pt[0-9]*)
913 chr=61
914 name=pt
915 unit=`expr $i : 'pt\([0-9][0-9]*\)'`
917 [ "$unit" ] || unit=0
919 unit=$(($unit + 1 - 1))
920 mknod $name $unit c $chr `unit2minor $unit`
923 #-----------------------------------------------------------------------------
925 ses[0-9]*)
926 chr=110
927 name=ses
928 unit=`expr $i : 'ses\([0-9][0-9]*\)'`
930 [ "$unit" ] || unit=0
932 unit=$(($unit + 1 - 1))
933 mknod $name $unit c $chr `unit2minor $unit`
936 #-----------------------------------------------------------------------------
938 targ[0-9]*)
939 chr=65
940 name=targ
941 unit=`expr $i : 'targ\([0-9][0-9]*\)'`
943 [ "$unit" ] || unit=0
945 unit=$(($unit + 1 - 1))
947 mknod $name $unit c $chr `unit2minor $unit`
948 mknod ${name}.ctl "" c $chr 0xffff00ff
951 #-----------------------------------------------------------------------------
953 # CAM transport layer device
954 xpt*)
955 # This major number is temporary
956 chr=104
957 name=xpt
958 units=`expr $i : 'xpt\(.*\)'`
960 [ "$units" ] || units=1
963 while [ $i -lt $units ]
965 rm -rf $name$i
967 mknod $name $i c $chr `unit2minor $i` root:operator
969 i=$(($i + 1))
970 done
973 #-----------------------------------------------------------------------------
975 pass*)
976 # This major number is temporary
977 chr=31
978 name=pass
979 units=`expr $i : 'pass\(.*\)'`
981 [ "$units" ] || units=1
984 while [ $i -lt $units ]
986 rm -rf $name$i
988 mknod $name $i c $chr `unit2minor $i` root:operator
990 i=$(($i + 1))
991 done
994 #-----------------------------------------------------------------------------
996 pty*)
997 class=`expr $i : 'pty\(.*\)'`
998 case $class in
999 0) offset=0 name=p;;
1000 1) offset=32 name=q;;
1001 2) offset=64 name=r;;
1002 3) offset=96 name=s;;
1003 4) offset=128 name=P;; # Note that xterm (at least) only look at p-s.
1004 5) offset=160 name=Q;;
1005 6) offset=192 name=R;;
1006 7) offset=224 name=S;;
1007 *) echo bad unit for pty in: $i;;
1008 esac
1010 case $class in
1011 0|1|2|3|4|5|6|7)
1013 while [ $i -lt 32 ]
1015 c=$(echo 0123456789abcdefghijklmnopqrstuv |
1016 dd bs=1 skip=$i count=1 2>/dev/null)
1018 mknod tty$name $c c 5 $(($offset + $i)) root:wheel 666
1019 mknod pty$name $c c 6 $(($offset + $i)) root:wheel 666
1021 i=$(($i + 1))
1022 done
1024 esac
1027 #-----------------------------------------------------------------------------
1029 sa*)
1030 unit=`expr $i : '..\(.*\)'`
1031 chr=14
1033 case $unit in
1034 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
1035 mknod sa ${unit}.ctl c $chr `saminor 1 ${unit} 0 0` \
1036 root:wheel 660
1037 ln -f sa${unit}.ctl rsa${unit}.ctl
1039 for m in 0 1 2 3
1041 mknod sa ${unit}.$m c $chr \
1042 `saminor 0 $unit $m 0` root:operator 660
1043 ln -f sa${unit}.$m rsa${unit}.$m
1045 mknod nsa ${unit}.$m c $chr \
1046 `saminor 0 $unit $m 1` root:operator 660
1047 ln -f nsa${unit}.$m nrsa${unit}.$m
1049 mknod esa ${unit}.$m c $chr \
1050 `saminor 0 $unit $m 2` root:operator 660
1051 ln -f esa${unit}.$m ersa${unit}.$m
1052 done
1054 ln -f sa${unit}.0 sa$unit
1055 ln -f sa${unit}.0 rsa${unit}.0
1056 ln -f sa${unit}.0 rsa$unit
1057 ln -f nsa${unit}.0 nsa$unit
1058 ln -f nsa${unit}.0 nrsa${unit}.0
1059 ln -f nsa${unit}.0 nrsa$unit
1060 ln -f esa${unit}.0 esa$unit
1061 ln -f esa${unit}.0 ersa${unit}.0
1062 ln -f esa${unit}.0 ersa$unit
1065 echo bad unit for tape in: $i
1067 esac
1070 #-----------------------------------------------------------------------------
1072 ch*)
1073 unit=`expr $i : '..\(.*\)'`
1075 case $i in
1076 ch*) name=ch; chr=17;;
1077 esac
1079 case $unit in
1080 0|1|2|3|4|5|6)
1081 mknod $name $unit c $chr $unit root:operator 640
1084 echo bad unit for media changer in: $i
1086 esac
1089 #-----------------------------------------------------------------------------
1091 ata)
1092 mknod ata "" c 159 0 root:operator
1095 #-----------------------------------------------------------------------------
1097 ast*)
1098 unit=`expr $i : '...\(.*\)'`
1099 chr=119
1101 case $unit in
1102 0|1|2|3)
1103 mknod ast $unit c $chr $(($unit * 8 + 0)) root:operator 640
1104 mknod nast $unit c $chr $(($unit * 8 + 1)) root:operator 640
1107 echo bad unit for tape in: $i
1109 esac
1112 #-----------------------------------------------------------------------------
1114 acd*t*)
1115 units=`expr $i : '...\(.*\)t'`;
1116 tracks=`expr $i : '.*t\(.*\)'`;
1117 name=acd;
1118 chr=117;
1120 [ "$units" ] || units=0
1121 [ "$tracks" ] || tracks=100
1123 if [ "$units" -le 31 -a "$tracks" -le 169 ]
1124 then
1126 while [ $i -le $units ]
1128 dname=$name$i
1129 rm -rf ${dname}t*
1132 while [ $j -le $tracks ]
1134 mknod ${dname}t $j c $chr \
1135 $((($i * 8) + (65536 * $j))) \
1136 root:operator 640
1138 j=$(($j + 1))
1139 done
1141 i=$(($i + 1))
1142 done
1143 else
1144 echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
1148 #-----------------------------------------------------------------------------
1150 acd*|cd*|mcd*|scd*)
1151 case $i in
1152 acd*) units=`expr $i : '...\(.*\)'`; name=acd; chr=117;;
1153 cd*) units=`expr $i : '..\(.*\)'` ; name=cd; chr=15;;
1154 mcd*) units=`expr $i : '...\(.*\)'`; name=mcd; chr=29;;
1155 scd*) units=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
1156 esac
1158 [ "$units" ] || units=0
1160 if [ "$units" -le 31 ]
1161 then
1163 while [ $i -le $units ]
1165 dname=$name$i
1166 rm -rf ${dname}*
1167 mknod $name ${i}a c $chr $(($i * 8)) root:operator 640
1169 case $name in
1170 acd) ln -f ${dname}a ${dname}c;;
1171 *) mknod $name ${i}c c $chr $(($i * 8 + 2)) \
1172 root:operator 640;;
1173 esac
1175 rm -f r${dname}a
1176 rm -f r${dname}c
1178 i=$(($i + 1))
1179 done
1180 else
1181 echo "$i is invalid -- can't have more than 32 cd devices"
1185 #-----------------------------------------------------------------------------
1187 iic*)
1188 unit=`expr $i : 'iic\(.*\)'`
1190 mknod iic $unit c 105 `unit2minor $unit`
1193 #-----------------------------------------------------------------------------
1195 smb*)
1196 unit=`expr $i : 'smb\(.*\)'`
1198 mknod smb $unit c 106 `unit2minor $unit`
1201 #-----------------------------------------------------------------------------
1203 pcfclock*)
1204 unit=`expr $i : 'pcfclock\(.*\)'`
1206 mknod pcfclock $unit c 140 `unit2minor $unit`
1209 #-----------------------------------------------------------------------------
1211 ppi*)
1212 unit=`expr $i : 'ppi\(.*\)'`
1214 mknod ppi $unit c 82 `unit2minor $unit`
1217 #-----------------------------------------------------------------------------
1219 pps*)
1220 unit=`expr $i : 'pps\(.*\)'`
1222 mknod pps $unit c 89 `unit2minor $unit`
1225 #-----------------------------------------------------------------------------
1227 usb)
1228 mknod usb "" c 108 255 root:operator 0660
1231 #-----------------------------------------------------------------------------
1233 usb*)
1234 unit=`expr $i : 'usb\(.*\)'`
1236 mknod usb $unit c 108 `unit2minor $unit` root:operator 660
1239 #-----------------------------------------------------------------------------
1241 ucom*)
1242 unit=`expr $i : 'ucom\(.*\)'`
1244 minor=$(($unit + 128))
1245 minor=`unit2minor $(($unit + 128))`
1247 mknod ucom $unit c 138 $minor uucp:dialer 660
1250 #-----------------------------------------------------------------------------
1252 uhid*)
1253 unit=`expr $i : 'uhid\(.*\)'`
1255 mknod uhid $unit c 122 `unit2minor $unit` root:operator 660
1258 #-----------------------------------------------------------------------------
1260 ums*)
1261 unit=`expr $i : 'ums\(.*\)'`
1263 mknod ums $unit c 111 `unit2minor $unit` root:operator 660
1266 #-----------------------------------------------------------------------------
1268 ulpt*)
1269 unit=`expr $i : 'ulpt\(.*\)'`
1271 minor=`unit2minor $unit`
1272 mknod ulpt $unit c 113 $minor
1274 minor=`unit2minor $(($unit + 64))`
1275 mknod unlpt $unit c 113 $minor # and the 'no prime' version
1278 #-----------------------------------------------------------------------------
1280 ugen*)
1281 unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
1282 endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
1284 [ "$unit" ] || echo $i - Invalid unit number
1286 if [ -z "${endpoint}" ] # ugen0 & ugen0.1 - ugen0.15
1287 then
1288 mknod ugen $unit c 114 `unit2minor $(($unit * 16))` \
1289 root:operator 660
1291 while [ $i -lt 16 ]
1293 mknod ugen $unit.$i c 114 `unit2minor \
1294 $(($unit * 16 + $i))` root:operator 660
1296 i=$(($i + 1))
1297 done
1298 else
1299 minor=`unit2minor $(($unit * 16 + $endpoint))`
1300 mknod ugen $unit.$endpoint c 114 $minor root:operator 660
1304 #-----------------------------------------------------------------------------
1306 urio*)
1307 unit=`expr $i : 'urio\(.*\)'`
1309 mknod urio $unit c 143 `unit2minor $unit` root:operator 660
1312 #-----------------------------------------------------------------------------
1314 uscanner*)
1315 unit=`expr $i : 'uscanner\(.*\)'`
1317 mknod uscanner $unit c 156 `unit2minor $unit` root:operator 660
1320 #-----------------------------------------------------------------------------
1322 umodem*)
1323 unit=`expr $i : 'umodem\(.*\)'`
1325 mknod umodem $unit c 124 `unit2minor $unit` uucp:dialer 660
1328 #-----------------------------------------------------------------------------
1330 lpt*)
1331 unit=`expr $i : 'lpt\(.*\)'`
1333 mknod lpt $unit c 16 `unit2minor $unit`
1334 mknod lpctl $unit c 16 `unit2minor $(($unit + 128))`
1337 #-----------------------------------------------------------------------------
1339 vty*)
1340 chr=12
1341 units=`expr $i : 'vty\(.*\)'`
1344 while [ $i -lt $units ]
1346 mknod ttyv $(printf %01x $i) c $chr `unit2minor $i`
1348 i=$(($i + 1))
1349 done
1351 ln -fs ttyv0 vga
1354 #-----------------------------------------------------------------------------
1356 nmdm*)
1357 units=`expr $i : 'nmdm\(.*\)'`
1358 chr=18
1361 while [ $i -lt $units ]
1363 minor=`unit2minor $i`
1364 minor=$(($minor + $minor))
1365 mknod nmdm ${i}A c $chr $minor
1366 mknod nmdm ${i}B c $chr $(($minor + 1))
1368 i=$(($i + 1))
1369 done
1372 #-----------------------------------------------------------------------------
1374 bpf*)
1375 nbpf=`expr $i : 'bpf\(.*\)$'`
1377 unit=0
1378 while [ $unit -le $nbpf ]
1380 mknod bpf $unit c 23 `unit2minor $unit`
1382 unit=$(($unit + 1))
1383 done
1386 #-----------------------------------------------------------------------------
1388 speaker)
1389 mknod speaker "" c 26 0
1392 #-----------------------------------------------------------------------------
1394 cua?|cuaa?|cuaa??)
1395 unit_low=`expr $i : 'cua.*\(.\)$'`
1397 case $i in
1398 cua?|cuaa?)
1399 unit_high=""
1400 m_high=0
1402 cuaa??)
1403 unit_high=`expr $i : 'cuaa\(.\).$'`
1404 m_high=`ttyminor $unit_high`
1406 esac
1408 unit=$unit_high$unit_low
1409 m=$(($m_high << 16 | `ttyminor $unit_low`))
1411 mknod cuaa $unit c 28 $(($m | 128)) uucp:dialer 660
1412 mknod cuaia $unit c 28 $(($m | 32 | 128)) uucp:dialer 660
1413 mknod cuala $unit c 28 $(($m | 64 | 128)) uucp:dialer 660
1416 #-----------------------------------------------------------------------------
1418 crypto)
1419 mknod crypto "" c 70 0 root:operator 666
1422 #-----------------------------------------------------------------------------
1425 mknod pf "" c 73 0 root:operator 600
1428 #-----------------------------------------------------------------------------
1430 fw?)
1431 unit=`expr $i : 'fw\(.\)$'`
1433 for sub in 0 1 2 3
1435 minor=$(($unit << 16 | $sub))
1436 mknod fw $unit.$sub c 127 $minor root:operator 660
1437 mknod fwmem $unit.$sub c 127 $((1<<24 | $minor)) \
1438 root:operator 660
1439 done
1441 ln -sf fw$unit.0 fw$unit
1442 ln -sf fwmem$unit.0 fwmem$unit
1445 #-----------------------------------------------------------------------------
1447 dcons)
1448 mknod dcons "" c 184 0 root:wheel 600
1451 #-----------------------------------------------------------------------------
1453 tty?|tty0?|ttyd?|ttyd??)
1454 unit_low=`expr $i : 'tty.*\(.\)$'`
1456 case $i in
1457 tty?|tty0?|ttyd?)
1458 unit_high=""
1459 m_high=0
1461 ttyd??)
1462 unit_high=`expr $i : 'ttyd\(.\).$'`
1463 m_high=`ttyminor $unit_high`
1465 esac
1467 unit=$unit_high$unit_low
1468 m=$(($m_high << 16 | `ttyminor $unit_low`))
1470 mknod ttyd $unit c 28 $m
1471 mknod ttyid $unit c 28 $(($m | 32))
1472 mknod ttyld $unit c 28 $(($m | 64))
1475 #-----------------------------------------------------------------------------
1477 cuac?)
1478 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1479 g h i j k l m n o p q r s t u v"
1480 major=48
1481 card=`expr $i : 'cua.*\(.\)$'`
1483 for unit in $portlist
1485 minor=`ttyminor $unit`
1486 minor=$(($card * 65536 + $minor))
1487 name=$card$unit
1489 mknod cuac $name c $major $(($minor + 128)) uucp:dialer 660
1490 mknod cuaic $name c $major $(($minor + 32 + 128)) \
1491 uucp:dialer 660
1492 mknod cualc $name c $major $(($minor + 64 + 128)) \
1493 uucp:dialer 660
1494 done
1497 #-----------------------------------------------------------------------------
1499 ttyc?)
1500 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1501 g h i j k l m n o p q r s t u v"
1502 major=48
1503 card=`expr $i : 'tty.*\(.\)$'`
1505 for unit in $portlist
1507 minor=`ttyminor $unit`
1508 minor=$(($card * 65536 + $minor))
1509 name=$card$unit
1511 mknod ttyc $name c $major $minor
1512 mknod ttyic $name c $major $(($minor + 32))
1513 mknod ttylc $name c $major $(($minor + 64))
1514 done
1517 #-----------------------------------------------------------------------------
1519 cuam?)
1520 unit=`expr $i : 'cua.*\(.\)$'`
1522 m=`ttyminor $unit`
1524 mknod cuam $unit c 63 $(($m + 128)) uucp:dialer 660
1527 #-----------------------------------------------------------------------------
1529 ttym?)
1530 unit=`expr $i : 'tty.*\(.\)$'`
1532 m=`ttyminor $unit`
1534 mknod ttym $unit c 63 $m
1537 #-----------------------------------------------------------------------------
1539 ttyA*)
1540 major=68
1541 nports=`expr $i : 'ttyA\(.*\)$'`
1542 port=1
1544 while [ $port -le $nports ]
1546 minor=$(($port - 1))
1547 name=$(printf %02d $port)
1549 mknod ttyA $name c $major $minor
1550 mknod ttyiA $name c $major $(($minor + 65536))
1551 mknod ttylA $name c $major $(($minor + 131072))
1553 port=$(($port + 1))
1554 done
1556 # For the user-mode control program, 'sicontrol'
1557 mknod si_control "" c 68 262144
1560 #-----------------------------------------------------------------------------
1562 cuaA*)
1563 major=68
1564 nports=`expr $i : 'cuaA\(.*\)$'`
1565 port=1
1567 while [ $port -le $nports ]
1569 minor=$(($port - 1))
1570 name=$(printf %02d $port)
1572 mknod cuaA $name c $major $(($minor + 128)) uucp:dialer 660
1573 mknod cuaiA $name c $major $(($minor + 128 + 65536)) \
1574 uucp:dialer 660
1575 mknod cualA $name c $major $(($minor + 128 + 131072)) \
1576 uucp:dialer 660
1578 port=$(($port + 1))
1579 done
1582 #-----------------------------------------------------------------------------
1584 zs?)
1585 unit=`expr $i : 'zs.*\(.\)$'`
1587 m=`ttyminor $unit`
1589 mknod zs $unit c 135 $m
1592 #-----------------------------------------------------------------------------
1594 ttyD?)
1595 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1596 major=58
1597 card=`expr $i : 'tty.*\(.\)$'`
1599 for unit in $portlist
1601 minor=`ttyminor $unit`
1602 minor=$(($card * 65536 + $minor))
1603 name=$card$unit
1605 mknod ttyD $name c $major $minor
1606 mknod ttyiD $name c $major $(($minor + 32))
1607 mknod ttylD $name c $major $(($minor + 64))
1608 done
1611 #-----------------------------------------------------------------------------
1613 cuaD?)
1614 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1615 major=58
1616 card=`expr $i : 'cua.*\(.\)$'`
1618 for unit in $portlist
1620 minor=`ttyminor $unit`
1621 minor=$(($card * 65536 + $minor))
1622 name=$card$unit
1624 mknod cuaD $name c $major $(($minor + 128)) uucp:dialer 660
1625 mknod cuaiD $name c $major $(($minor + 32 + 128)) \
1626 uucp:dialer 660
1627 mknod cualD $name c $major $(($minor + 64 + 128)) \
1628 uucp:dialer 660
1629 done
1632 #-----------------------------------------------------------------------------
1634 ttyE*)
1635 stallion 72 E `expr $i : 'tty.*\(.\)$'` 0
1637 cuaE*)
1638 stallion 72 E `expr $i : 'cua.*\(.\)$'` 1
1640 stl*)
1641 card=`expr $i : 'stl\(.\)$'`
1642 stallion 72 E $card 0
1643 stallion 72 E $card 1
1646 ttyF*)
1647 stallion 75 F `expr $i : 'tty.*\(.\)$'` 0
1649 cuaF*)
1650 stallion 75 F `expr $i : 'cua.*\(.\)$'` 1
1652 stli*)
1653 card=`expr $i : 'stl\(.\)$'`
1654 stallion 75 F $card 0
1655 stallion 75 F $card 1
1658 ttyM*)
1659 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1660 modulelist="a b c d"
1661 major=101
1662 card=`expr $i : 'tty.*\(.\)$'`
1664 for unit in $modulelist
1666 moduleminor=`ttyminor $unit`
1667 moduleminor=$(($moduleminor % 10 * 16))
1668 modulename=$unit
1670 for unit in $portlist
1672 minor=`ttyminor $unit`
1673 minor=$(($card * 65536 + $minor + $moduleminor))
1674 name=$card$modulename$unit
1676 rm -f tty*M$name
1678 mknod ttyM $name c $major $minor
1679 mknod ttyiM $name c $major $(($minor + 64))
1680 mknod ttylM $name c $major $(($minor + 128))
1681 done
1682 done
1685 cuaM?)
1686 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1687 modulelist="a b c d"
1688 major=101
1689 card=`expr $i : 'cua.*\(.\)$'`
1691 for unit in $modulelist
1693 moduleminor=`ttyminor $unit`
1694 moduleminor=$(($moduleminor % 10 * 16))
1695 modulename=$unit
1697 for unit in $portlist
1699 minor=`ttyminor $unit`
1700 minor=$(($card * 65536 + $minor + $moduleminor))
1701 name=$card$modulename$unit
1703 rm -f cua*M$name
1705 mknod cuaM $name c $major $(($minor + 262144)) \
1706 uucp:dialer 660
1707 mknod cuaiM $name c $major $(($minor + 64 + 262144)) \
1708 uucp:dialer 660
1709 mknod cualM $name c $major $(($minor + 128 + 262144)) \
1710 uucp:dialer 660
1711 done
1712 done
1715 ttyR?)
1716 major=81
1717 BOARD=1; Rnum=0
1718 MINOR=$(($BOARD * 65536))
1719 controllers=$(
1720 dmesg | while read first rest
1722 case "$first" in
1723 RocketPort[0-4]) echo "$first"
1725 esac
1726 done)
1728 rm -f ttyR* ttyiR* ttylR*
1730 for i in $controllers
1732 ndevices=$(
1733 dmesg | while read first bar ports rest
1735 case "$first" in
1736 $i*) echo "$ports"
1738 esac
1739 done)
1741 echo -n "Creating $ndevices devices for $i: "
1742 dev=0
1744 while [ $dev -lt $ndevices ]
1746 mknod ttyR $Rnum c $major $MINOR
1747 mknod ttyiR $Rnum c $major $(($MINOR + 32))
1748 mknod ttylR $Rnum c $major $(($MINOR + 64))
1750 Rnum=$(($Rnum + 1))
1751 MINOR=$(($MINOR + 1))
1753 dev=$(($dev + 1))
1754 done
1756 BOARD=$(($BOARD + 1))
1757 MINOR=$(($BOARD * 65536))
1758 echo " "
1759 done
1762 cuaR?)
1763 major=81
1764 BOARD=1; Rnum=0
1765 MINOR=$(($BOARD * 65536))
1766 controllers=$(
1767 dmesg | while read first rest
1769 case "$first" in
1770 RocketPort[0-4]) echo "$first"
1772 esac
1773 done)
1775 rm -f cuaR* cuaiR* cualR*
1777 for i in $controllers
1779 ndevices=$(
1780 dmesg | while read first bar ports rest
1782 case "$first" in
1783 $i*) echo "$ports"
1785 esac
1786 done)
1788 echo -n "Creating $ndevices devices for $i: "
1789 dev=0
1791 while [ $dev -lt $ndevices ]
1793 mknod cuaR $Rnum c $major $(($MINOR + 128)) \
1794 uucp:dialer 660
1795 mknod cuaiR $Rnum c $major $(($MINOR + 128 + 32)) \
1796 uucp:dialer 660
1797 mknod cualR $Rnum c $major $(($MINOR + 128 + 64)) \
1798 uucp:dialer 660
1800 Rnum=$(($Rnum + 1))
1801 MINOR=$(($MINOR + 1))
1803 dev=$(($dev + 1))
1804 done
1806 BOARD=$(($BOARD + 1))
1807 MINOR=$(($BOARD * 65536))
1808 echo " "
1809 done
1812 #-----------------------------------------------------------------------------
1814 mse*)
1815 unit=`expr $i : 'mse\(.*\)'`
1816 chr=27
1818 # Non-blocking for X11
1819 mknod mse $unit c $chr `unit2minor $(($unit * 2 + 1))`
1822 #-----------------------------------------------------------------------------
1824 psm*)
1825 unit=`expr $i : 'psm\(.*\)'`
1826 chr=21
1828 # Non-blocking for X11
1829 mknod psm $unit c $chr `unit2minor $(($unit * 2 + 1))`
1832 #-----------------------------------------------------------------------------
1834 mouse*)
1835 name=`expr $i : 'mouse\(.*\)'`
1837 [ -c $name ] || $0 $name # Make the appropriate device
1839 ln -fs $name mouse
1842 #-----------------------------------------------------------------------------
1844 pcaudio)
1845 mknod pcaudio "" c 24 0
1846 mknod pcaudioctl "" c 24 128
1849 #-----------------------------------------------------------------------------
1851 socksys)
1852 mknod socksys "" c 41 0 root:wheel 666
1853 mknod spx "" c 41 1 root:wheel 666
1855 ln -fs socksys nfsd
1858 #-----------------------------------------------------------------------------
1860 snd*)
1862 unit=`expr $i : 'snd\(.*\)'`
1863 chr=30
1865 ln -fs mixer$unit mixer
1866 ln -fs sequencer$unit sequencer
1867 ln -fs dsp$unit dsp
1868 ln -fs audio$unit audio
1869 ln -fs dspW$unit dspW
1870 ln -fs music$unit music
1871 ln -fs pss$unit pss
1872 ln -fs dsp$unit.0 dsp$unit
1873 ln -fs audio$unit.0 audio$unit
1874 ln -fs dspW$unit.0 dspW$unit
1876 mknod mixer $unit c $chr `unit2minor $(($unit * 16 + 0))` \
1877 root:wheel 666
1878 mknod sequencer $unit c $chr `unit2minor $(($unit * 16 + 1))` \
1879 root:wheel 666
1880 mknod midi $unit c $chr `unit2minor $(($unit * 16 + 2))` \
1881 root:wheel 666
1883 for chn in 0 1 2 3
1885 minor=$(($chn * 65536 + $unit * 16))
1887 mknod dsp $unit.$chn c $chr $(($minor + 3)) root:wheel 666
1888 mknod audio $unit.$chn c $chr $(($minor + 4)) root:wheel 666
1889 mknod dspW $unit.$chn c $chr $(($minor + 5)) root:wheel 666
1890 done
1892 mknod sndstat "" c $chr 6 root:wheel 666
1893 mknod music $unit c $chr `unit2minor $(($unit * 16 + 8))` root:wheel 666
1894 mknod pss $unit c $chr `unit2minor $(($unit * 16 + 9))` root:wheel 666
1897 #-----------------------------------------------------------------------------
1899 vat)
1900 mknod vatio "" c 25 128 root:wheel 660
1903 #-----------------------------------------------------------------------------
1905 gsc*)
1906 unit=`expr $i : 'gsc\(.*\)'`
1908 mknod gsc $unit c 47 `unit2minor $unit` root:wheel 666
1909 mknod gsc ${unit}p c 47 `unit2minor $(($unit + 8))` root:wheel 666
1910 mknod gsc ${unit}d c 47 `unit2minor $(($unit + 32))` root:wheel 666
1911 mknod gsc ${unit}pd c 47 `unit2minor $(($unit + 40))` root:wheel 666
1914 #-----------------------------------------------------------------------------
1916 acpi)
1917 mknod acpi "" c 152 0 root:operator 664
1920 #-----------------------------------------------------------------------------
1922 apm)
1923 mknod apm "" c 39 0 root:operator 664
1926 #-----------------------------------------------------------------------------
1928 apmctl)
1929 mknod apmctl "" c 39 8 root:operator 660
1932 #-----------------------------------------------------------------------------
1934 card*)
1935 unit=`expr $i : 'card\(.*\)'`
1936 chr=50
1938 mknod card $unit c $chr `unit2minor $unit` root:wheel 644
1941 #-----------------------------------------------------------------------------
1943 ttyx?|ttyy?|ttyz?)
1944 case $i in
1945 *0) unit=0;; *1) unit=1;; *2) unit=2;; *3) unit=3;;
1946 *4) unit=4;; *5) unit=5;; *6) unit=6;; *7) unit=7;;
1947 *8) unit=8;; *9) unit=9;; *a) unit=10;; *b) unit=11;;
1948 *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1949 esac
1951 case $i in
1952 ttyy?) unit=$(($unit + 16));;
1953 ttyz?) unit=$(($unit + 32));;
1954 esac
1956 mknod $i "" c 42 $unit
1959 #-----------------------------------------------------------------------------
1961 cronyx)
1962 mknod cronyx "" c 42 63
1965 #-----------------------------------------------------------------------------
1967 joy)
1968 mknod joy 0 c 51 0 root:operator 640
1969 mknod joy 1 c 51 1 root:operator 640
1972 #-----------------------------------------------------------------------------
1974 spigot)
1975 mknod spigot "" c 11 0 root:wheel 444
1978 #-----------------------------------------------------------------------------
1980 ctx?)
1981 unit=`expr $i : 'ctx\(.*\)'`
1983 mknod ctx $unit c 40 `unit2minor $unit` root:wheel 444
1986 #-----------------------------------------------------------------------------
1988 meteor?)
1989 unit=`expr $i : 'meteor\(.*\)'`
1991 mknod meteor $unit c 67 `unit2minor $unit` root:wheel 444
1994 #-----------------------------------------------------------------------------
1996 bktr?)
1997 unit=`expr $i : 'bktr\(.*\)'`
1999 mknod bktr $unit c 92 `unit2minor $unit` root:wheel 444
2000 mknod tuner $unit c 92 `unit2minor $((16 + $unit))` root:wheel 444
2001 mknod vbi $unit c 92 `unit2minor $((32 + $unit))` root:wheel 444
2004 #-----------------------------------------------------------------------------
2006 tun*)
2007 ntun=`expr $i : 'tun\(.*\)$'`
2008 unit=0
2010 while [ $unit -le $ntun ]
2012 mknod tun $unit c 52 `unit2minor $unit`
2014 unit=$(($unit + 1))
2015 done
2018 #-----------------------------------------------------------------------------
2020 tap*)
2021 ntap=`expr $i : 'tap\(.*\)$'`
2022 unit=0
2024 while [ $unit -le $ntap ]
2026 mknod tap $unit c 149 `unit2minor $unit` root:network
2028 unit=$(($unit + 1))
2029 done
2032 #-----------------------------------------------------------------------------
2034 sysmouse)
2035 mknod sysmouse "" c 12 128
2036 mknod consolectl "" c 12 255
2039 #-----------------------------------------------------------------------------
2041 jogdial)
2042 mknod jogdial "" c 160 0
2045 #-----------------------------------------------------------------------------
2047 snp?)
2048 unit=`expr $i : 'snp\(.*\)'`
2050 mknod snp $unit c 53 `unit2minor $unit`
2053 #-----------------------------------------------------------------------------
2055 labpc*)
2056 case $i in
2057 labpcaio*)
2058 name=labpcaio
2059 unit=`expr $i : 'labpcaio\(.*\)'`
2060 all="0 1 2 3 4 5 6 7"
2061 offset=0
2064 labpcdio*)
2065 name=labpcdio
2066 unit=`expr $i : 'labpcdio\(.*\)'`
2067 all="0 1 2 3"
2068 offset=8
2072 die 3 "Don't know LabPC type $i"
2074 esac
2076 [ "${unit}" ] || unit=all
2078 case $unit in
2079 0|1|2|3|4|5|6|7)
2080 mknod $name $unit c 66 $(($offset + $unit)) \
2081 root:wheel 660
2084 all)
2085 for i in $all
2087 mknod $name $i c 66 $(($offset + $i)) \
2088 root:wheel 660
2089 done
2093 echo "No such LabPC unit: $unit"
2095 esac
2098 #-----------------------------------------------------------------------------
2100 perfmon)
2101 mknod perfmon "" c 2 32 root:kmem 640
2104 #-----------------------------------------------------------------------------
2106 ipl)
2107 mknod ipl "" c 79 0
2108 mknod ipnat "" c 79 1
2109 mknod ipstate "" c 79 2
2110 mknod ipauth "" c 79 3
2113 #-----------------------------------------------------------------------------
2115 elan*)
2116 mknod elan-mmcr "" c 100 0 root:wheel 600
2119 #-----------------------------------------------------------------------------
2121 kbd*)
2122 unit=`expr $i : 'kbd\(.*\)'`
2123 chr=112
2125 mknod kbd $unit c $chr `unit2minor $unit`
2128 #-----------------------------------------------------------------------------
2130 i4b)
2131 mknod i4b "" c 60 0
2134 i4bctl)
2135 mknod i4bctl "" c 55 0
2138 i4brbch*)
2139 unit=`expr $i : 'i4brbch\(.*\)'`
2141 mknod i4brbch $unit c 57 `unit2minor $unit`
2144 i4bteld*)
2145 offset=64
2146 unit=`expr $i : 'i4bteld\(.*\)'`
2148 mknod i4bteld $unit c 56 `unit2minor $(($offset + $unit))`
2151 i4btel*)
2152 unit=`expr $i : 'i4btel\(.*\)'`
2154 mknod i4btel $unit c 56 `unit2minor $unit`
2157 i4btrc*)
2158 unit=`expr $i : 'i4btrc\(.*\)'`
2160 mknod i4btrc $unit c 59 `unit2minor $unit`
2163 #-----------------------------------------------------------------------------
2165 aac*)
2166 unit=`expr $i : 'aac\(.*\)'`
2168 mknod aac $unit c 150 `unit2minor $unit`
2170 ln -fs aac$unit afa$unit
2171 ln -fs aac$unit hpn$unit
2174 #-----------------------------------------------------------------------------
2176 mlx*)
2177 unit=`expr $i : 'mlx\(.*\)'`
2179 mknod mlx $unit c 130 `unit2minor $unit`
2182 #-----------------------------------------------------------------------------
2184 amr*)
2185 unit=`expr $i : 'amr\(.*\)'`
2187 mknod amr $unit c 132 `unit2minor $unit`
2190 #-----------------------------------------------------------------------------
2192 ips*)
2193 unit=`expr $i : 'ips\(.*\)'`
2195 mknod mlx $unit c 175 `unit2minor $unit`
2198 #-----------------------------------------------------------------------------
2200 ciss*)
2201 unit=`expr $i : 'ciss\(.*\)'`
2203 mknod ciss $unit c 166 `unit2minor $unit`
2206 #-----------------------------------------------------------------------------
2208 agpgart)
2209 mknod agpgart "" c 148 0
2212 #-----------------------------------------------------------------------------
2214 twe*)
2215 unit=`expr $i : 'twe\(.*\)'`
2217 mknod twe $unit c 146 `unit2minor $unit`
2220 #-----------------------------------------------------------------------------
2222 tw*)
2223 unit=`expr $i : 'tw\(.*\)'`
2225 mknod tw $unit c 19 `unit2minor $unit` root:operator
2228 #-----------------------------------------------------------------------------
2230 cfs*)
2231 unit=`expr $i : 'cfs\(.*\)'`
2233 mknod cfs $unit c 93 $unit root:operator
2236 #-----------------------------------------------------------------------------
2238 nsmb*)
2239 unit=`expr $i : 'nsmb\(.*\)'`
2241 mknod nsmb $unit c 144 $unit
2244 #-----------------------------------------------------------------------------
2246 local)
2247 umask 0
2248 sh MAKEDEV.local
2249 umask 77
2252 #-----------------------------------------------------------------------------
2255 echo $i - no such device name
2258 esac
2259 done