Fix SYNOPSIS.
[dragonfly.git] / etc / MAKEDEV
blob9ced7531296994b9cecdb3345fbd931064f42124
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.36 2007/08/31 11:26:44 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 # 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 # idad* Compaq Smart-2 RAID arrays
51 # ips* IBM ServeRAID controller
52 # ipsd* IBM ServeRAID
53 # md* Memory (or malloc) disk
54 # mlx* Mylex DAC960 RAID controllers
55 # mlxd* Mylex DAC960 RAID disk volumes
56 # pst* Promise SuperTrak RAID disks
57 # vn* vnode disks
58 # vkd* virtual kernel disk
60 # Console ports:
61 # vty* virtual console devices for syscons
63 # Pointing devices:
64 # mse* Logitech and ATI Inport bus mouse
65 # psm* PS/2 mouse
66 # jogdial Sony VAIO Jogdial
67 # sysmouse Mousesystems mouse emulator for syscons
69 # Time devices:
70 # refclock-* serial ports used by xntpd parse refclocks
72 # Terminal ports:
73 # tty* general purpose serial ports
74 # cua* dialout serial ports
75 # ttyA* Specialix SI/XIO dialin ports ('*' = number of devices)
76 # cuaA* Specialix SI/XIO dialout ports
77 # ttyD* Digiboard - 16 dialin ports
78 # cuaD* Digiboard - 16 dialout ports
79 # ttyE* Stallion EasyIO (stl) dialin ports
80 # cuaE* Stallion EasyIO (stl) dialout ports
81 # ttyF* Stallion Brumby (stli) dialin ports
82 # cuaF* Stallion Brumby (stli) dialout ports
83 # ttyR* Rocketport dialin ports
84 # cuaR* Rocketport dialout ports
86 # stlN Stallion EasyIO board N dialin and dialout
87 # stliN Stallion Brumby board N dialin and dialout
89 # Pseudo terminals:
90 # pty* set of 32 master and slave pseudo terminals
91 # vty* virtual terminals using syscons console
93 # Parallel port:
94 # lpt* Printer
95 # ppi* Parallel port i/o
96 # pps* Pulse per second timing interface
97 # pcfclock* Parallel time sync interface
99 # I2C and SMBus:
100 # iic* I2C devices
101 # smb* SMBUS devices
103 # USB devices:
104 # usb* USB bus control device
105 # ucom* USB serial devices
106 # ugen* generic USB device
107 # uhid* Human Interface Device (HID)
108 # ulpt* printer
109 # umodem* modems
110 # ums* mouse
111 # urio* Diamond Rio 500
112 # uscanner* USB scanners
114 # SCSI devices (other than CD-ROM, tape and disk):
115 # ch* SCSI Media-Changer (juke box) driver
116 # pt* Processor Type (HP scanner, as one example)
117 # pass* CAM Passthrough device
118 # ses* SES (SCSI Environmental Services) and
119 # SAF-TE (Scsi Accessable Fault-Tolerant Enclosures) device
121 # PC-CARD (previously called PCMCIA) support
122 # card* PC-CARD slots
124 # ISDN devices:
125 # i4b isdnd call control device
126 # i4bctl debugging control device
127 # i4btrc* trace data interface(s), one per passive card
128 # i4btel* telephony interface(s)
129 # i4bteld* telephony dialout interface(s)
130 # i4brbch* raw b channel access device(s)
132 # Special purpose devices:
133 # acpi ACPI control device
134 # apm Advanced Power Management BIOS
135 # apmctl APM BIOS control device
136 # bpf* packet filter
137 # crypto crypto interface
138 # speaker pc speaker
139 # tw* xten power controller
140 # snd* various sound cards
141 # pcaudio PCM audio driver
142 # socksys iBCS2 socket system driver
143 # vat VAT compatibility audio driver (requires snd*)
144 # gsc Genius GS-4500 hand scanner
145 # joy pc joystick
146 # tun* Tunneling IP device
147 # tap* Ethernet Tunneling device
148 # snp* tty snoop devices
149 # spigot Video Spigot video acquisition card
150 # ctx* Cortex-I video acquisition card
151 # meteor* Matrox Meteor video acquisition card (pci)
152 # bktr* Bt848 based video acquisition card (pci)
153 # labpc* National Instrument's Lab-PC and LAB-PC+
154 # perfmon CPU performance-monitoring counters
155 # pci PCI configuration-space access from user mode
156 # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth)
157 # kbd keyboard devices
158 # elan-mmcr AMD Elan support (e.g. mmap MMCR)
159 # agpgart AGP interface
160 # nsmb* SMB/CIFS protocol interface
161 # pf PF packet filter
163 ##############################################################################
165 # To override the default ownership and/or permissions, you now have the
166 # /etc/devices.conf file (create it if it's not there). Entries in this file
167 # should look like:
169 # ad0s1c root:staff 666 # Override ad0s1c
170 # ad0* root:wheel 641 # Override the entire ad0 family
171 # sa0.ctl heinz:ketchup 444 # Override device control node
172 # sa*.ctl heinz:ketchup 666 # Override all sa* control nodes
173 # fd/4 ihate:floppies 000 # Override /dev/fd/4
175 # See the devices.conf(5) man page for further information.
177 # J.Anslik (joerg@anslik.de)
179 ##############################################################################
183 #-----------------------------------------------------------------------------
184 # Where all device special files are built.
185 #-----------------------------------------------------------------------------
187 DEVDIR=dev
190 #-----------------------------------------------------------------------------
191 # File containing local ownership and permissions override entries.
192 #-----------------------------------------------------------------------------
194 DEVPERMS_LOCAL="/etc/devices.conf"
197 #-----------------------------------------------------------------------------
198 # Some useful programs.
199 #-----------------------------------------------------------------------------
201 cut=/usr/bin/cut
202 grep=/usr/bin/grep
203 mknod=/sbin/mknod
204 sed=/usr/bin/sed
205 tr=/usr/bin/tr
208 #-----------------------------------------------------------------------------
209 # Set up a default search path.
210 #-----------------------------------------------------------------------------
212 if [ -n "$MAKEDEVPATH" ]
213 then
214 PATH="$MAKEDEVPATH"
215 else
216 PATH=/sbin:/bin
220 #-----------------------------------------------------------------------------
221 # Print error message $2 and exit this script, returning $1.
222 #-----------------------------------------------------------------------------
224 die()
226 echo $2
228 exit $1
232 #-----------------------------------------------------------------------------
233 # Convert integer to partition name.
234 #-----------------------------------------------------------------------------
236 dkitop()
238 local p
240 case $1 in
241 0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;;
242 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
243 8) p=i;; 9) p=j;; 10) p=k;; 11) p=l;;
244 12) p=m;; 13) p=n;; 14) p=o;; 15) p=p;;
245 *) p="?";;
246 esac
248 echo $p
252 #-----------------------------------------------------------------------------
253 # Convert integer to slice name.
254 #-----------------------------------------------------------------------------
256 dkitos()
258 local s
260 case $1 in
261 0) s="s0" ;;
262 1) s="" ;;
263 *) s=s$(($1-1)) ;;
264 esac
266 echo $s
269 #-----------------------------------------------------------------------------
270 # Convert unit, slice, partition to minor number.
271 #-----------------------------------------------------------------------------
273 # ndkminor(unit, slice, partition)
275 ndkminor()
277 echo $(( (($1 & 31) << 3) | (($1 & 480) << 16) | \
278 (($2 & 15) << 16) | (($2 & 112) << 25) | \
279 ($3 & 7) | (($3 & 8) << 17) | (($3 & 240) << 21) ))
283 #-----------------------------------------------------------------------------
284 # Create the device node.
285 #-----------------------------------------------------------------------------
287 mknod() {
289 local dev=$1
290 local unit=$2
292 #---------------------------------------------------------------------
293 # Remove old device node, if any.
294 #---------------------------------------------------------------------
296 rm -f "$dev$unit" || exit 1
299 #---------------------------------------------------------------------
300 # Supply default ownership and/or permissions according to the
301 # number of parameters passed to this function.
302 #---------------------------------------------------------------------
304 case $# in
305 5) owner=root:wheel; perms=600;;
306 6) owner=$6; perms=600;;
307 7) owner=$6; perms=$7;;
308 *) die 2 "Bad call: mknod $@";;
309 esac
312 #---------------------------------------------------------------------
313 # Get rid of first two parameters (no longer needed)
314 #---------------------------------------------------------------------
316 shift; shift
319 #---------------------------------------------------------------------
320 # If there's a /etc/devices.conf file, check for local overrides.
321 #---------------------------------------------------------------------
323 if [ -s $DEVPERMS_LOCAL ]
324 then
325 #-------------------------------------------------------------
326 # Temporarily prepend the device portion with a subdir name
327 # if we're not in $DEVDIR. We need to do this to distinguish
328 # between device nodes that live in /dev, and device nodes
329 # that live in /dev/subdir, like /dev/fd. This way, we can
330 # have "fd*" entries in the permission files, as well as
331 # "fd/*" stuff.
332 #-------------------------------------------------------------
334 tmpdev=$dev
335 pwd=`/usr/bin/basename $PWD`
337 [ "$pwd" = "$DEVDIR" ] || dev="${pwd}/$dev"
340 #-------------------------------------------------------------
341 # Check /etc/devices.conf for local overrides
342 #-------------------------------------------------------------
344 match=`$grep ^$dev$unit[[:space:]] $DEVPERMS_LOCAL | \
345 $sed 's/\*/\\\*/'`
347 [ "$match" ] ||
348 if [ `expr "$unit" : '\(.*\)\.ctl$'` ]
349 then
350 match=`$grep ^$dev\\\*\\\.ctl[[:space:]] \
351 $DEVPERMS_LOCAL | $sed 's/\*/\\\*/'`
352 else
353 match=`$grep ^$dev\\\*[[:space:]] $DEVPERMS_LOCAL | \
354 $sed 's/\*/\\\*/'`
357 if [ "$match" ]
358 then
359 # Separate each field by one space character...
360 match=`echo $match | $tr -s "[:space:]" " "`
362 # ...and extract owenership and permissions.
363 owner=`echo $match | $cut -d' ' -f2`
364 perms=`echo $match | $cut -d' ' -f3`
367 #-------------------------------------------------------------
368 # Restore "plain" device name (no prepending subdir name).
369 #-------------------------------------------------------------
371 dev=$tmpdev
374 #---------------------------------------------------------------------
375 # Finally, set ownership and permissions.
376 #---------------------------------------------------------------------
378 $mknod $dev$unit $1 $2 $3 $owner
379 chmod $perms $dev$unit
383 #-----------------------------------------------------------------------------
384 # Convert tape (ctrl, unit, mode, access) to device minor number.
385 #-----------------------------------------------------------------------------
387 saminor()
389 echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
393 #-----------------------------------------------------------------------------
394 # Convert the last character of a tty name to a device minor number.
395 #-----------------------------------------------------------------------------
397 ttyminor()
399 case $1 in
400 [0-9]) m=$1;;
401 a) m=10;; b) m=11;; c) m=12;; d) m=13;;
402 e) m=14;; f) m=15;; g) m=16;; h) m=17;;
403 i) m=18;; j) m=19;; k) m=20;; l) m=21;;
404 m) m=22;; n) m=23;; o) m=24;; p) m=25;;
405 q) m=26;; r) m=27;; s) m=28;; t) m=29;;
406 u) m=30;; v) m=31;;
407 *) m="?";;
408 esac
410 echo $m
414 #-----------------------------------------------------------------------------
415 # Convert a unit number to a device minor number.
416 #-----------------------------------------------------------------------------
418 unit2minor()
420 echo $(((($1 >> 8) << 16) | ($1 % 256)))
424 #-----------------------------------------------------------------------------
425 # Stallion devices need some (weird) special treatment.
426 #-----------------------------------------------------------------------------
428 stallion()
430 major=$1
431 letter=$2
432 card=$3
433 iscallout=$4
435 port=0
436 maxport=8
437 pref=tty
438 owner=
439 minorbase=0
441 if [ $iscallout -gt 0 ]
442 then
443 pref=cua
444 owner=uucp:dialer
445 minorbase=128
448 case "$card" in
449 [0-7]);;
450 *) die 1 "Invalid stl card number $card";;
451 esac
453 # Make the mem interface for extracting stats & loading microcode.
454 # 0x1000000 + card number
455 mknod staliomem $card c $major 0x0100000$card
457 while [ $port -lt $maxport ]
459 minor=$(($minorbase + $card * 1048576 + $port))
461 [ $port -lt 32 ] || minor=$(($minor + 65504))
463 unit=$(($card * 64 + $port))
465 mknod ${pref}${letter} $unit c $major $minor $owner
466 mknod ${pref}i${letter} $unit c $major $(($minor + 32)) $owner
467 mknod ${pref}l${letter} $unit c $major $(($minor + 64)) $owner
469 port=$(($port + 1))
470 done
474 #-----------------------------------------------------------------------------
475 # Do it.
476 #-----------------------------------------------------------------------------
478 for i in $*; do
479 case $i in
481 all)
482 rm -f *.compat
483 sh MAKEDEV std # standard
484 sh MAKEDEV fd0 fd1 # bdev, floppy disk
485 sh MAKEDEV da0 da1 da2 da3 da4 da5 da6 da7 # bdev, SCSI disk
486 sh MAKEDEV da8 da9 da10 da11 da12 da13 da14 # bdev, SCSI disk
487 sh MAKEDEV da15 # bdev, SCSI disk
488 sh MAKEDEV ccd0 ccd1 ccd2 ccd3 # ccd disk
489 sh MAKEDEV ata # cdev, ATA control
490 sh MAKEDEV ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 # bdev, ATA disk
491 sh MAKEDEV ar0 ar1 # bdev, ATA RAID disk
492 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
493 sh MAKEDEV vn0 # bdev, virtual disk
494 sh MAKEDEV vkd0 # bdev, virtual disk
495 sh MAKEDEV cd0 # bdev, cdrom
496 sh MAKEDEV sa0 wt0 # bdev, tape
497 sh MAKEDEV vty12 # cdev, virtual tty
498 sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3 # cdev, serial tty
499 sh MAKEDEV pty0 # cdev, pseudo tty
500 sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3 # cdev, serial tty
501 sh MAKEDEV kbd0 kbd1 # cdev, keyboard
502 sh MAKEDEV mse0 psm0 jogdial sysmouse # cdev, mouse
503 sh MAKEDEV pcaudio speaker snd0 # cdev, noise
504 sh MAKEDEV ipsd0 # cdev, ServeRAID disk
505 sh MAKEDEV lpt0 lpt1 lpt2 # cdev, printer
506 sh MAKEDEV ppi0 ppi1 ppi2 # cdev, parallel port
507 sh MAKEDEV iic0 iic1 # cdev, I2C device
508 sh MAKEDEV smb0 smb1 # cdev, SMBus device
509 sh MAKEDEV usb usb0 uhid0 ums0 ulpt0 ugen0 # cdev, USB devices
510 sh MAKEDEV usb1 uhid1 ums1 ulpt1 ugen1 # cdev, USB devices
511 sh MAKEDEV usb2 usb3 usb4 usb5 # cdev, USB devices
512 sh MAKEDEV urio0 uscanner0 umodem0 # cdev, USB devices too
513 sh MAKEDEV bpf0 bpf1 bpf2 bpf3 # cdev, network
514 sh MAKEDEV ipl tun0 tun1 tun2 tun3 # cdev, network
515 sh MAKEDEV tap0 tap1 tap2 tap3 # cdev, network
516 sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous
517 sh MAKEDEV acpi # cdev, laptop
518 sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop
519 sh MAKEDEV pass4 xpt2 # cdev, CAM
520 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
521 sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN
522 sh MAKEDEV i4brbch0 i4brbch1 # cdev, ISDN
523 sh MAKEDEV agpgart # cdev, AGP
524 sh MAKEDEV nsmb0 # cdev, SMB/CIFS
525 sh MAKEDEV twed0 # 3ware
526 sh MAKEDEV crypto # cdev, crypto
527 sh MAKEDEV fw0 # cdev, firewire
528 sh MAKEDEV dcons # cdev, dcons
529 sh MAKEDEV pf # pf
533 #-----------------------------------------------------------------------------
534 # A much restricted set of the above, to save precious i-nodes on the
535 # fixit floppy
536 #-----------------------------------------------------------------------------
538 fixit)
539 sh MAKEDEV std # standard
540 sh MAKEDEV fd0 # bdev, floppy disk
541 sh MAKEDEV da0 # bdev, SCSI disk
542 sh MAKEDEV ad0 # bdev, ATA disk
543 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
544 sh MAKEDEV vn0 # bdev, virtual disk
545 sh MAKEDEV vkd0 # bdev, virtual disk
546 sh MAKEDEV cd0 # bdev, cdrom
547 sh MAKEDEV sa0 # bdev, tape
548 sh MAKEDEV vty2 # cdev, virtual tty
549 sh MAKEDEV cuaa0 # cdev, serial tty
550 sh MAKEDEV pty0 # cdev, pseudo tty
551 sh MAKEDEV ttyd0 # cdev, serial tty
552 sh MAKEDEV kbd0 # cdev, keyboard
553 sh MAKEDEV mse0 psm0 sysmouse # cdev, mouse
554 sh MAKEDEV lpt0 # cdev, printer
555 sh MAKEDEV ppi0 # cdev, parallel port
556 sh MAKEDEV iic0 # cdev, I2C device
557 sh MAKEDEV smb0 # cdev, SMBus device
558 sh MAKEDEV ums0 # cdev, USB devices
559 sh MAKEDEV tun0 # cdev, network
560 sh MAKEDEV tap0 # cdev, network
561 sh MAKEDEV ch0 # cdev, miscellaneous
562 sh MAKEDEV apm apmctl card0 # cdev, laptop
563 sh MAKEDEV pass1 xpt1 # cdev, CAM
564 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
565 sh MAKEDEV i4btel0 i4bteld0 # cdev, ISDN
566 sh MAKEDEV i4brbch0 # cdev, ISDN
567 rm -f fd/[1-9]?
570 #-----------------------------------------------------------------------------
571 # Upgrade existing node set.
573 # 1.9 - disk devices have changed
574 #-----------------------------------------------------------------------------
575 upgrade)
576 echo -n "upgrading... "
577 for i in aacd ad ar afd amrd ccd da fd idad ipsd md \
578 mlxd pst twed vn vkd
580 for j in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
582 if [ -c $i$j ]; then
583 rm -f $i$j
584 rm -f $i${j}[a-p]
585 echo -n " $i$j $i${j}s0[a-p] $i${j}s1[a-p]"
586 sh MAKEDEV $i$j
587 # s0 and s1 handled by base
588 for k in s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 \
589 s12 s13 s14 s15
591 if [ -c $i$j${k}c ]; then
592 rm -f ${i}${j}${k}*
593 echo -n " $i$j$k"
594 sh MAKEDEV $i$j$k
595 echo -n " $i$j$k[a-p]"
596 sh MAKEDEV $i$j${k}a
597 elif [ -c $i$j$k ]; then
598 rm -f ${i}${j}${k}*
599 echo -n " $i$j$k"
600 sh MAKEDEV $i$j$k
602 done
604 done
605 done
606 for i in acd cd vcd
608 for j in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
610 if [ -c $i$j ]; then
611 rm -f ${i}${j}*
612 echo -n " $i$j $i${j}s0 $i${j}[a-p]"
613 sh MAKEDEV $i$j
614 elif [ -c $i${j}c ]; then
615 rm -f ${i}${j}*
616 echo -n " $i$j $i${j}s0 $i${j}[a-p]"
617 sh MAKEDEV $i$j
619 done
620 done
621 echo ""
624 #-----------------------------------------------------------------------------
625 # Basic device node set.
626 #-----------------------------------------------------------------------------
628 std)
629 mknod console "" c 0 0
630 mknod kmem "" c 2 1 root:kmem 640
631 mknod mem "" c 2 0 root:kmem 640
632 mknod null "" c 2 2 root:wheel 666
633 mknod random "" c 2 3 root:wheel 644
634 mknod urandom "" c 2 4 root:wheel 644
635 mknod zero "" c 2 12 root:wheel 666
636 mknod io "" c 2 14
637 mknod tty "" c 1 0 root:wheel 666
638 mknod klog "" c 7 0
639 mknod stdin "" c 22 0 root:wheel 666
640 mknod stdout "" c 22 1 root:wheel 666
641 mknod stderr "" c 22 2 root:wheel 666
642 mknod pci "" c 78 0 root:wheel 644
645 #---------------------------------------------------------------------
646 # Create floppy disk nodes in /dev/fd
647 #---------------------------------------------------------------------
649 mkdir -p fd
651 (cd fd &&
652 i=0 &&
653 while [ $i -lt 64 ]
655 mknod $i "" c 22 $i root:wheel 666
657 i=$(($i + 1))
658 done)
660 chmod 555 fd
663 #-----------------------------------------------------------------------------
665 jail)
666 sh MAKEDEV std pty0
668 rm mem kmem pci io klog console
670 ln -sf null mem
671 ln -sf null kmem
672 ln -sf null console
675 #-----------------------------------------------------------------------------
677 mach-4)
678 mknod iopl "" c 22 0
679 mknod kbd "" c 23 0
680 mknod mouse "" c 24 0
681 mknod time "" c 25 0
682 mknod timezone "" c 26 0
685 #-----------------------------------------------------------------------------
687 wt*)
688 u=`expr $i : '..\(.*\)'`
690 [ "$u" ] || u=0
692 # Default density, 512b blocks
693 mknod rwt $u c 10 $((0 + $u)) root:operator 660
694 mknod nrwt $u c 10 $((4 + $u)) root:operator 660
696 # Default density, 1024b blocks
697 # mknod rWt $u c 10 $((64 + $u)) root:operator 660
698 # mknod nrWt $u c 10 $((68 + $u)) root:operator 660
699 mknod rwt ${u}b c 10 $((16 + $u)) root:operator 660 # 60 MB
700 mknod nrwt ${u}b c 10 $((20 + $u)) root:operator 660
701 mknod rwt ${u}c c 10 $((24 + $u)) root:operator 660 # 120 MB
702 mknod nrwt ${u}c c 10 $((28 + $u)) root:operator 660
703 mknod rwt ${u}d c 10 $((32 + $u)) root:operator 660 # 150 MB
704 mknod nrwt ${u}d c 10 $((36 + $u)) root:operator 660
705 # mknod rwt ${u}e c 10 $((40 + $u)) root:operator 660 # 300 MB?
706 # mknod nrwt ${u}e c 10 $((44 + $u)) root:operator 660
707 # mknod rwt ${u}f c 10 $((48 + $u)) root:operator 660 # 600 MB?
708 # mknod nrwt ${u}f c 10 $((52 + $u)) root:operator 660
711 #-----------------------------------------------------------------------------
713 aacd*s*|acd*s*|ad*s*|ar*s*|afd*s*|amrd*s*|ccd*s*|da*s*|fd*s*|idad*s*|ipsd*s*|md*s*|mlxd*s*|pst*s*|twed*s*|vn*s*|vkd*s*)
714 case $i in
715 aacd*s*) name=aacd; chr=151;;
716 acd*s*) name=acd; chr=117;;
717 ad*s*) name=ad; chr=116;;
718 ar*s*) name=ar; chr=157;;
719 afd*s*) name=afd; chr=118;;
720 amrd*s*) name=amrd; chr=133;;
721 ccd*s*) name=ccd; chr=74;;
722 da*s*) name=da; chr=13;;
723 fd*s*) name=fd; chr=9;;
724 idad*s*) name=idad; chr=109;;
725 ipsd*s*) name=ipsd; chr=176;;
726 md*s*) name=md; chr=95;;
727 mlxd*s*) name=mlxd; chr=131;;
728 pst*s*) name=pst; chr=168;;
729 twed*s*) name=twed; chr=147;;
730 vn*s*) name=vn; chr=43;;
731 vkd*s*) name=vkd; chr=97;;
732 esac
734 case $i in
735 aacd*s*|amrd*s*|idad*s*|ipsd*s*|mlxd*s*|twed*s*)
736 unit=`expr $i : '....\([0-9]*\)s'`
737 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
738 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
741 acd*s*|afd*s*|ccd*s*|pst*s*|wfd*s*|vkd*s*)
742 unit=`expr $i : '...\([0-9]*\)s'`
743 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
744 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
747 unit=`expr $i : '..\([0-9]*\)s'`
748 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
749 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
751 esac
753 case $unit in
754 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
755 case $slice in
756 [0-9]|[1-2][0-9]|30)
757 # [no s*] == whole-disk slice (slice #1 in minor)
758 # s0 == slice #0 in minor (compatibility slice)
759 # s1 == slice #2 in minor
760 # s2 == slice #3 in minor
761 # etc..
763 # set slice to slice-in-minor-number
764 oldslice=$slice
765 if [ $oldslice -eq 0 ]; then
766 slice=$(($oldslice))
767 else
768 slice=$(($slice+1))
770 slicename=`dkitos $slice`
771 minor=`ndkminor $unit $slice 255`
772 mknod ${name} $unit$slicename c $chr $minor \
773 root:operator 640
775 # raw device names are extinct
776 rm -f r$name$unit$slicename
778 # get rid of old compatibility devices, the new
779 # ones use 's0', e.g. da0s0a
780 for i in a b c d e f g h i j k l m n o p
782 rm -f $name$unit$i
783 done
785 case $part in [a-p])
787 for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
789 minor=`ndkminor $unit $slice $part`
790 partname=`dkitop $part`
791 mknod $name $unit$slicename$partname \
792 c $chr $minor root:operator 640
793 rm -f r$name$unit$slicename$partname
794 done
797 "") ;;
798 *) echo bad partition for disk in: $i
800 esac
803 echo bad slice for disk in: $i
805 esac
808 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
810 esac
813 #-----------------------------------------------------------------------------
815 control-fd*)
816 unit=`expr $i : '..........\(.*\)'`
817 name=fd; chr=9
819 case $unit in
820 0|1|2|3)
821 minor=`ndkminor $unit 1 129`
822 mknod $name ${unit}.1720 c $chr $minor
823 rm -f r${name}${unit}.1720
825 minor=`ndkminor $unit 1 130`
826 mknod $name ${unit}.1480 c $chr $minor
827 rm -f r${name}${unit}.1480
829 minor=`ndkminor $unit 1 131`
830 mknod $name ${unit}.1440 c $chr $minor
831 rm -f r${name}${unit}.1440
833 minor=`ndkminor $unit 1 132`
834 mknod $name ${unit}.1200 c $chr $minor
835 rm -f r${name}${unit}.1200
837 minor=`ndkminor $unit 1 133`
838 mknod $name ${unit}.820 c $chr $minor
839 rm -f r${name}${unit}.820
841 minor=`ndkminor $unit 1 134`
842 mknod $name ${unit}.800 c $chr $minor
843 rm -f r${name}${unit}.800
845 minor=`ndkminor $unit 1 135`
846 mknod $name ${unit}.720 c $chr $minor
847 rm -f r${name}${unit}.720
849 minor=`ndkminor $unit 1 136`
850 mknod $name ${unit}.360 c $chr $minor
851 rm -f r${name}${unit}.360
853 minor=`ndkminor $unit 1 137`
854 mknod $name ${unit}.640 c $chr $minor
855 rm -f r${name}${unit}.640
857 minor=`ndkminor $unit 1 138`
858 mknod $name ${unit}.1232 c $chr $minor
859 rm -f r${name}${unit}.1232
862 echo bad unit for disk in: $i
864 esac
867 #-----------------------------------------------------------------------------
869 acd*t*)
870 units=`expr $i : '...\(.*\)t'`;
871 tracks=`expr $i : '.*t\(.*\)'`;
872 name=acd;
873 chr=117;
875 [ "$units" ] || units=0
876 [ "$tracks" ] || tracks=100
878 if [ "$units" -le 31 -a "$tracks" -le 169 ]
879 then
881 while [ $i -le $units ]
883 dname=$name$i
884 rm -rf ${dname}t*
887 while [ $j -le $tracks ]
889 # cd unit tracks use the compatibility slice
890 # and partition numbers 129+ for tracks 1+.
892 minor=`ndkminor $i 1 $(($j + 128))`
893 mknod ${dname}t $j c $chr $minor \
894 root:operator 640
895 j=$(($j + 1))
896 done
898 i=$(($i + 1))
899 done
900 else
901 echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
905 #-----------------------------------------------------------------------------
907 aacd*|acd*|ad*|ar*|afd*|amrd*|cd*|ccd*|da*|fd*|idad*|ipsd*|md*|mlxd*|pst*|twed*|vcd*|vn*|vkd*)
908 doslices=1
909 directraw=0
910 case $i in
911 aacd*) name=aacd; chr=151;;
912 acd*) name=acd; chr=117; doslices=0; directraw=1;;
913 ad*) name=ad; chr=116;;
914 ar*) name=ar; chr=157;;
915 afd*) name=afd; chr=118;;
916 amrd*) name=amrd; chr=133;;
917 cd*) name=cd; chr=15; doslices=0;;
918 da*) name=da; chr=13;;
919 fd*) name=fd; chr=9;;
920 ccd*) name=ccd; chr=74;;
921 idad*) name=idad; chr=109;;
922 ipsd*) name=ipsd; chr=176;;
923 md*) name=md; chr=95;;
924 mlxd*) name=mlxd; chr=131;;
925 pst*) name=pst; chr=168;;
926 twed*) name=twed; chr=147;;
927 vcd*) name=vcd; chr=98; doslices=0;;
928 vn*) name=vn; chr=43;;
929 vkd*) name=vkd; chr=97;;
930 esac
932 case $i in
933 aacd*|amrd*|idad*|ipsd*|mlxd*|twed*)
934 unit=`expr $i : '....\(.*\)'`
936 acd*|afd*|ccd*|pst*|wfd*|vcd*|vkd*)
937 unit=`expr $i : '...\(.*\)'`
940 unit=`expr $i : '..\(.*\)'`
942 esac
944 case $i in
945 fd*)
946 sh MAKEDEV control-$name$unit
948 esac
950 case $unit in
951 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
952 if [ "$doslices" -gt 0 ]; then
953 minor=`ndkminor $unit 1 255`
954 mknod ${name} ${unit} c $chr $minor \
955 root:operator 640
956 for slicepartname in s0h s1h s2 s3 s4
958 sh MAKEDEV $name$unit$slicepartname
959 done
960 else
961 if [ "$directraw" -gt 0 ]; then
962 minor=`ndkminor $unit 1 128`
963 mknod ${name} ${unit} c $chr $minor \
964 root:operator 640
965 else
966 minor=`ndkminor $unit 1 255`
967 mknod ${name} ${unit} c $chr $minor \
968 root:operator 640
970 minor=`ndkminor $unit 1 255`
971 mknod ${name} ${unit}s0 c $chr $minor \
972 root:operator 640
973 minor=`ndkminor $unit 0 0`
974 mknod ${name} ${unit}a c $chr $minor \
975 root:operator 640
976 minor=`ndkminor $unit 0 2`
977 mknod ${name} ${unit}c c $chr $minor \
978 root:operator 640
982 echo bad unit for disk in: $i
984 esac
987 #-----------------------------------------------------------------------------
989 pt[0-9]*)
990 chr=61
991 name=pt
992 unit=`expr $i : 'pt\([0-9][0-9]*\)'`
994 [ "$unit" ] || unit=0
996 unit=$(($unit + 1 - 1))
997 mknod $name $unit c $chr `unit2minor $unit`
1000 #-----------------------------------------------------------------------------
1002 ses[0-9]*)
1003 chr=110
1004 name=ses
1005 unit=`expr $i : 'ses\([0-9][0-9]*\)'`
1007 [ "$unit" ] || unit=0
1009 unit=$(($unit + 1 - 1))
1010 mknod $name $unit c $chr `unit2minor $unit`
1013 #-----------------------------------------------------------------------------
1015 targ[0-9]*)
1016 chr=65
1017 name=targ
1018 unit=`expr $i : 'targ\([0-9][0-9]*\)'`
1020 [ "$unit" ] || unit=0
1022 unit=$(($unit + 1 - 1))
1024 mknod $name $unit c $chr `unit2minor $unit`
1025 mknod ${name}.ctl "" c $chr 0xffff00ff
1028 #-----------------------------------------------------------------------------
1030 # CAM transport layer device
1031 xpt*)
1032 # This major number is temporary
1033 chr=104
1034 name=xpt
1035 units=`expr $i : 'xpt\(.*\)'`
1037 [ "$units" ] || units=1
1040 while [ $i -lt $units ]
1042 rm -rf $name$i
1044 mknod $name $i c $chr `unit2minor $i` root:operator
1046 i=$(($i + 1))
1047 done
1050 #-----------------------------------------------------------------------------
1052 pass*)
1053 # This major number is temporary
1054 chr=31
1055 name=pass
1056 units=`expr $i : 'pass\(.*\)'`
1058 [ "$units" ] || units=1
1061 while [ $i -lt $units ]
1063 rm -rf $name$i
1065 mknod $name $i c $chr `unit2minor $i` root:operator
1067 i=$(($i + 1))
1068 done
1071 #-----------------------------------------------------------------------------
1073 pty*)
1074 class=`expr $i : 'pty\(.*\)'`
1075 case $class in
1076 0) offset=0 name=p;;
1077 1) offset=32 name=q;;
1078 2) offset=64 name=r;;
1079 3) offset=96 name=s;;
1080 4) offset=128 name=P;; # Note that xterm (at least) only look at p-s.
1081 5) offset=160 name=Q;;
1082 6) offset=192 name=R;;
1083 7) offset=224 name=S;;
1084 *) echo bad unit for pty in: $i;;
1085 esac
1087 case $class in
1088 0|1|2|3|4|5|6|7)
1090 while [ $i -lt 32 ]
1092 c=$(echo 0123456789abcdefghijklmnopqrstuv |
1093 dd bs=1 skip=$i count=1 2>/dev/null)
1095 mknod tty$name $c c 5 $(($offset + $i)) root:wheel 666
1096 mknod pty$name $c c 6 $(($offset + $i)) root:wheel 666
1098 i=$(($i + 1))
1099 done
1101 esac
1104 #-----------------------------------------------------------------------------
1106 sa*)
1107 unit=`expr $i : '..\(.*\)'`
1108 chr=14
1110 case $unit in
1111 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
1112 mknod sa ${unit}.ctl c $chr `saminor 1 ${unit} 0 0` \
1113 root:wheel 660
1114 ln -f sa${unit}.ctl rsa${unit}.ctl
1116 for m in 0 1 2 3
1118 mknod sa ${unit}.$m c $chr \
1119 `saminor 0 $unit $m 0` root:operator 660
1120 ln -f sa${unit}.$m rsa${unit}.$m
1122 mknod nsa ${unit}.$m c $chr \
1123 `saminor 0 $unit $m 1` root:operator 660
1124 ln -f nsa${unit}.$m nrsa${unit}.$m
1126 mknod esa ${unit}.$m c $chr \
1127 `saminor 0 $unit $m 2` root:operator 660
1128 ln -f esa${unit}.$m ersa${unit}.$m
1129 done
1131 ln -f sa${unit}.0 sa$unit
1132 ln -f sa${unit}.0 rsa${unit}.0
1133 ln -f sa${unit}.0 rsa$unit
1134 ln -f nsa${unit}.0 nsa$unit
1135 ln -f nsa${unit}.0 nrsa${unit}.0
1136 ln -f nsa${unit}.0 nrsa$unit
1137 ln -f esa${unit}.0 esa$unit
1138 ln -f esa${unit}.0 ersa${unit}.0
1139 ln -f esa${unit}.0 ersa$unit
1142 echo bad unit for tape in: $i
1144 esac
1147 #-----------------------------------------------------------------------------
1149 ch*)
1150 unit=`expr $i : '..\(.*\)'`
1152 case $i in
1153 ch*) name=ch; chr=17;;
1154 esac
1156 case $unit in
1157 0|1|2|3|4|5|6)
1158 mknod $name $unit c $chr $unit root:operator 640
1161 echo bad unit for media changer in: $i
1163 esac
1166 #-----------------------------------------------------------------------------
1168 ata)
1169 mknod ata "" c 159 0 root:operator
1172 #-----------------------------------------------------------------------------
1174 ast*)
1175 unit=`expr $i : '...\(.*\)'`
1176 chr=119
1178 case $unit in
1179 0|1|2|3)
1180 mknod ast $unit c $chr $(($unit * 8 + 0)) root:operator 640
1181 mknod nast $unit c $chr $(($unit * 8 + 1)) root:operator 640
1184 echo bad unit for tape in: $i
1186 esac
1189 #-----------------------------------------------------------------------------
1191 iic*)
1192 unit=`expr $i : 'iic\(.*\)'`
1194 mknod iic $unit c 105 `unit2minor $unit`
1197 #-----------------------------------------------------------------------------
1199 smb*)
1200 unit=`expr $i : 'smb\(.*\)'`
1202 mknod smb $unit c 106 `unit2minor $unit`
1205 #-----------------------------------------------------------------------------
1207 pcfclock*)
1208 unit=`expr $i : 'pcfclock\(.*\)'`
1210 mknod pcfclock $unit c 140 `unit2minor $unit`
1213 #-----------------------------------------------------------------------------
1215 ppi*)
1216 unit=`expr $i : 'ppi\(.*\)'`
1218 mknod ppi $unit c 82 `unit2minor $unit`
1221 #-----------------------------------------------------------------------------
1223 pps*)
1224 unit=`expr $i : 'pps\(.*\)'`
1226 mknod pps $unit c 89 `unit2minor $unit`
1229 #-----------------------------------------------------------------------------
1231 usb)
1232 mknod usb "" c 108 255 root:operator 0660
1235 #-----------------------------------------------------------------------------
1237 usb*)
1238 unit=`expr $i : 'usb\(.*\)'`
1240 mknod usb $unit c 108 `unit2minor $unit` root:operator 660
1243 #-----------------------------------------------------------------------------
1245 ucom*)
1246 unit=`expr $i : 'ucom\(.*\)'`
1248 minor=$(($unit + 128))
1249 minor=`unit2minor $(($unit + 128))`
1251 mknod ucom $unit c 138 $minor uucp:dialer 660
1254 #-----------------------------------------------------------------------------
1256 uhid*)
1257 unit=`expr $i : 'uhid\(.*\)'`
1259 mknod uhid $unit c 122 `unit2minor $unit` root:operator 660
1262 #-----------------------------------------------------------------------------
1264 ums*)
1265 unit=`expr $i : 'ums\(.*\)'`
1267 mknod ums $unit c 111 `unit2minor $unit` root:operator 660
1270 #-----------------------------------------------------------------------------
1272 ulpt*)
1273 unit=`expr $i : 'ulpt\(.*\)'`
1275 minor=`unit2minor $unit`
1276 mknod ulpt $unit c 113 $minor
1278 minor=`unit2minor $(($unit + 64))`
1279 mknod unlpt $unit c 113 $minor # and the 'no prime' version
1282 #-----------------------------------------------------------------------------
1284 ugen*)
1285 unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
1286 endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
1288 [ "$unit" ] || echo $i - Invalid unit number
1290 if [ -z "${endpoint}" ] # ugen0 & ugen0.1 - ugen0.15
1291 then
1292 mknod ugen $unit c 114 `unit2minor $(($unit * 16))` \
1293 root:operator 660
1295 while [ $i -lt 16 ]
1297 mknod ugen $unit.$i c 114 `unit2minor \
1298 $(($unit * 16 + $i))` root:operator 660
1300 i=$(($i + 1))
1301 done
1302 else
1303 minor=`unit2minor $(($unit * 16 + $endpoint))`
1304 mknod ugen $unit.$endpoint c 114 $minor root:operator 660
1308 #-----------------------------------------------------------------------------
1310 urio*)
1311 unit=`expr $i : 'urio\(.*\)'`
1313 mknod urio $unit c 143 `unit2minor $unit` root:operator 660
1316 #-----------------------------------------------------------------------------
1318 uscanner*)
1319 unit=`expr $i : 'uscanner\(.*\)'`
1321 mknod uscanner $unit c 156 `unit2minor $unit` root:operator 660
1324 #-----------------------------------------------------------------------------
1326 umodem*)
1327 unit=`expr $i : 'umodem\(.*\)'`
1329 mknod umodem $unit c 124 `unit2minor $unit` uucp:dialer 660
1332 #-----------------------------------------------------------------------------
1334 lpt*)
1335 unit=`expr $i : 'lpt\(.*\)'`
1337 mknod lpt $unit c 16 `unit2minor $unit`
1338 mknod lpctl $unit c 16 `unit2minor $(($unit + 128))`
1341 #-----------------------------------------------------------------------------
1343 vty*)
1344 chr=12
1345 units=`expr $i : 'vty\(.*\)'`
1348 while [ $i -lt $units ]
1350 mknod ttyv $(printf %01x $i) c $chr `unit2minor $i`
1352 i=$(($i + 1))
1353 done
1355 ln -fs ttyv0 vga
1358 #-----------------------------------------------------------------------------
1360 nmdm*)
1361 units=`expr $i : 'nmdm\(.*\)'`
1362 chr=18
1365 while [ $i -lt $units ]
1367 minor=`unit2minor $i`
1368 minor=$(($minor + $minor))
1369 mknod nmdm ${i}A c $chr $minor
1370 mknod nmdm ${i}B c $chr $(($minor + 1))
1372 i=$(($i + 1))
1373 done
1376 #-----------------------------------------------------------------------------
1378 bpf*)
1379 nbpf=`expr $i : 'bpf\(.*\)$'`
1381 unit=0
1382 while [ $unit -le $nbpf ]
1384 mknod bpf $unit c 23 `unit2minor $unit`
1386 unit=$(($unit + 1))
1387 done
1390 #-----------------------------------------------------------------------------
1392 speaker)
1393 mknod speaker "" c 26 0
1396 #-----------------------------------------------------------------------------
1398 cua?|cuaa?|cuaa??)
1399 unit_low=`expr $i : 'cua.*\(.\)$'`
1401 case $i in
1402 cua?|cuaa?)
1403 unit_high=""
1404 m_high=0
1406 cuaa??)
1407 unit_high=`expr $i : 'cuaa\(.\).$'`
1408 m_high=`ttyminor $unit_high`
1410 esac
1412 unit=$unit_high$unit_low
1413 m=$(($m_high << 16 | `ttyminor $unit_low`))
1415 mknod cuaa $unit c 28 $(($m | 128)) uucp:dialer 660
1416 mknod cuaia $unit c 28 $(($m | 32 | 128)) uucp:dialer 660
1417 mknod cuala $unit c 28 $(($m | 64 | 128)) uucp:dialer 660
1420 #-----------------------------------------------------------------------------
1422 crypto)
1423 mknod crypto "" c 70 0 root:operator 666
1426 #-----------------------------------------------------------------------------
1429 mknod pf "" c 73 0 root:operator 600
1432 #-----------------------------------------------------------------------------
1434 fw?)
1435 unit=`expr $i : 'fw\(.\)$'`
1437 for sub in 0 1 2 3
1439 minor=$(($unit << 16 | $sub))
1440 mknod fw $unit.$sub c 127 $minor root:operator 660
1441 mknod fwmem $unit.$sub c 127 $((1<<24 | $minor)) \
1442 root:operator 660
1443 done
1445 ln -sf fw$unit.0 fw$unit
1446 ln -sf fwmem$unit.0 fwmem$unit
1449 #-----------------------------------------------------------------------------
1451 dcons)
1452 mknod dcons "" c 184 0 root:wheel 600
1455 #-----------------------------------------------------------------------------
1457 tty?|tty0?|ttyd?|ttyd??)
1458 unit_low=`expr $i : 'tty.*\(.\)$'`
1460 case $i in
1461 tty?|tty0?|ttyd?)
1462 unit_high=""
1463 m_high=0
1465 ttyd??)
1466 unit_high=`expr $i : 'ttyd\(.\).$'`
1467 m_high=`ttyminor $unit_high`
1469 esac
1471 unit=$unit_high$unit_low
1472 m=$(($m_high << 16 | `ttyminor $unit_low`))
1474 mknod ttyd $unit c 28 $m
1475 mknod ttyid $unit c 28 $(($m | 32))
1476 mknod ttyld $unit c 28 $(($m | 64))
1479 #-----------------------------------------------------------------------------
1481 cuac?)
1482 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1483 g h i j k l m n o p q r s t u v"
1484 major=48
1485 card=`expr $i : 'cua.*\(.\)$'`
1487 for unit in $portlist
1489 minor=`ttyminor $unit`
1490 minor=$(($card * 65536 + $minor))
1491 name=$card$unit
1493 mknod cuac $name c $major $(($minor + 128)) uucp:dialer 660
1494 mknod cuaic $name c $major $(($minor + 32 + 128)) \
1495 uucp:dialer 660
1496 mknod cualc $name c $major $(($minor + 64 + 128)) \
1497 uucp:dialer 660
1498 done
1501 #-----------------------------------------------------------------------------
1503 ttyc?)
1504 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1505 g h i j k l m n o p q r s t u v"
1506 major=48
1507 card=`expr $i : 'tty.*\(.\)$'`
1509 for unit in $portlist
1511 minor=`ttyminor $unit`
1512 minor=$(($card * 65536 + $minor))
1513 name=$card$unit
1515 mknod ttyc $name c $major $minor
1516 mknod ttyic $name c $major $(($minor + 32))
1517 mknod ttylc $name c $major $(($minor + 64))
1518 done
1521 #-----------------------------------------------------------------------------
1523 cuam?)
1524 unit=`expr $i : 'cua.*\(.\)$'`
1526 m=`ttyminor $unit`
1528 mknod cuam $unit c 63 $(($m + 128)) uucp:dialer 660
1531 #-----------------------------------------------------------------------------
1533 ttym?)
1534 unit=`expr $i : 'tty.*\(.\)$'`
1536 m=`ttyminor $unit`
1538 mknod ttym $unit c 63 $m
1541 #-----------------------------------------------------------------------------
1543 ttyA*)
1544 major=68
1545 nports=`expr $i : 'ttyA\(.*\)$'`
1546 port=1
1548 while [ $port -le $nports ]
1550 minor=$(($port - 1))
1551 name=$(printf %02d $port)
1553 mknod ttyA $name c $major $minor
1554 mknod ttyiA $name c $major $(($minor + 65536))
1555 mknod ttylA $name c $major $(($minor + 131072))
1557 port=$(($port + 1))
1558 done
1560 # For the user-mode control program, 'sicontrol'
1561 mknod si_control "" c 68 262144
1564 #-----------------------------------------------------------------------------
1566 cuaA*)
1567 major=68
1568 nports=`expr $i : 'cuaA\(.*\)$'`
1569 port=1
1571 while [ $port -le $nports ]
1573 minor=$(($port - 1))
1574 name=$(printf %02d $port)
1576 mknod cuaA $name c $major $(($minor + 128)) uucp:dialer 660
1577 mknod cuaiA $name c $major $(($minor + 128 + 65536)) \
1578 uucp:dialer 660
1579 mknod cualA $name c $major $(($minor + 128 + 131072)) \
1580 uucp:dialer 660
1582 port=$(($port + 1))
1583 done
1586 #-----------------------------------------------------------------------------
1588 ttyD?)
1589 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1590 major=58
1591 card=`expr $i : 'tty.*\(.\)$'`
1593 for unit in $portlist
1595 minor=`ttyminor $unit`
1596 minor=$(($card * 65536 + $minor))
1597 name=$card$unit
1599 mknod ttyD $name c $major $minor
1600 mknod ttyiD $name c $major $(($minor + 32))
1601 mknod ttylD $name c $major $(($minor + 64))
1602 done
1605 #-----------------------------------------------------------------------------
1607 cuaD?)
1608 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1609 major=58
1610 card=`expr $i : 'cua.*\(.\)$'`
1612 for unit in $portlist
1614 minor=`ttyminor $unit`
1615 minor=$(($card * 65536 + $minor))
1616 name=$card$unit
1618 mknod cuaD $name c $major $(($minor + 128)) uucp:dialer 660
1619 mknod cuaiD $name c $major $(($minor + 32 + 128)) \
1620 uucp:dialer 660
1621 mknod cualD $name c $major $(($minor + 64 + 128)) \
1622 uucp:dialer 660
1623 done
1626 #-----------------------------------------------------------------------------
1628 ttyE*)
1629 stallion 72 E `expr $i : 'tty.*\(.\)$'` 0
1631 cuaE*)
1632 stallion 72 E `expr $i : 'cua.*\(.\)$'` 1
1634 stl*)
1635 card=`expr $i : 'stl\(.\)$'`
1636 stallion 72 E $card 0
1637 stallion 72 E $card 1
1640 ttyF*)
1641 stallion 75 F `expr $i : 'tty.*\(.\)$'` 0
1643 cuaF*)
1644 stallion 75 F `expr $i : 'cua.*\(.\)$'` 1
1646 stli*)
1647 card=`expr $i : 'stl\(.\)$'`
1648 stallion 75 F $card 0
1649 stallion 75 F $card 1
1652 ttyM*)
1653 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1654 modulelist="a b c d"
1655 major=101
1656 card=`expr $i : 'tty.*\(.\)$'`
1658 for unit in $modulelist
1660 moduleminor=`ttyminor $unit`
1661 moduleminor=$(($moduleminor % 10 * 16))
1662 modulename=$unit
1664 for unit in $portlist
1666 minor=`ttyminor $unit`
1667 minor=$(($card * 65536 + $minor + $moduleminor))
1668 name=$card$modulename$unit
1670 rm -f tty*M$name
1672 mknod ttyM $name c $major $minor
1673 mknod ttyiM $name c $major $(($minor + 64))
1674 mknod ttylM $name c $major $(($minor + 128))
1675 done
1676 done
1679 cuaM?)
1680 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1681 modulelist="a b c d"
1682 major=101
1683 card=`expr $i : 'cua.*\(.\)$'`
1685 for unit in $modulelist
1687 moduleminor=`ttyminor $unit`
1688 moduleminor=$(($moduleminor % 10 * 16))
1689 modulename=$unit
1691 for unit in $portlist
1693 minor=`ttyminor $unit`
1694 minor=$(($card * 65536 + $minor + $moduleminor))
1695 name=$card$modulename$unit
1697 rm -f cua*M$name
1699 mknod cuaM $name c $major $(($minor + 262144)) \
1700 uucp:dialer 660
1701 mknod cuaiM $name c $major $(($minor + 64 + 262144)) \
1702 uucp:dialer 660
1703 mknod cualM $name c $major $(($minor + 128 + 262144)) \
1704 uucp:dialer 660
1705 done
1706 done
1709 ttyR?)
1710 major=81
1711 BOARD=1; Rnum=0
1712 MINOR=$(($BOARD * 65536))
1713 controllers=$(
1714 dmesg | while read first rest
1716 case "$first" in
1717 RocketPort[0-4]) echo "$first"
1719 esac
1720 done)
1722 rm -f ttyR* ttyiR* ttylR*
1724 for i in $controllers
1726 ndevices=$(
1727 dmesg | while read first bar ports rest
1729 case "$first" in
1730 $i*) echo "$ports"
1732 esac
1733 done)
1735 echo -n "Creating $ndevices devices for $i: "
1736 dev=0
1738 while [ $dev -lt $ndevices ]
1740 mknod ttyR $Rnum c $major $MINOR
1741 mknod ttyiR $Rnum c $major $(($MINOR + 32))
1742 mknod ttylR $Rnum c $major $(($MINOR + 64))
1744 Rnum=$(($Rnum + 1))
1745 MINOR=$(($MINOR + 1))
1747 dev=$(($dev + 1))
1748 done
1750 BOARD=$(($BOARD + 1))
1751 MINOR=$(($BOARD * 65536))
1752 echo " "
1753 done
1756 cuaR?)
1757 major=81
1758 BOARD=1; Rnum=0
1759 MINOR=$(($BOARD * 65536))
1760 controllers=$(
1761 dmesg | while read first rest
1763 case "$first" in
1764 RocketPort[0-4]) echo "$first"
1766 esac
1767 done)
1769 rm -f cuaR* cuaiR* cualR*
1771 for i in $controllers
1773 ndevices=$(
1774 dmesg | while read first bar ports rest
1776 case "$first" in
1777 $i*) echo "$ports"
1779 esac
1780 done)
1782 echo -n "Creating $ndevices devices for $i: "
1783 dev=0
1785 while [ $dev -lt $ndevices ]
1787 mknod cuaR $Rnum c $major $(($MINOR + 128)) \
1788 uucp:dialer 660
1789 mknod cuaiR $Rnum c $major $(($MINOR + 128 + 32)) \
1790 uucp:dialer 660
1791 mknod cualR $Rnum c $major $(($MINOR + 128 + 64)) \
1792 uucp:dialer 660
1794 Rnum=$(($Rnum + 1))
1795 MINOR=$(($MINOR + 1))
1797 dev=$(($dev + 1))
1798 done
1800 BOARD=$(($BOARD + 1))
1801 MINOR=$(($BOARD * 65536))
1802 echo " "
1803 done
1806 #-----------------------------------------------------------------------------
1808 mse*)
1809 unit=`expr $i : 'mse\(.*\)'`
1810 chr=27
1812 # Non-blocking for X11
1813 mknod mse $unit c $chr `unit2minor $(($unit * 2 + 1))`
1816 #-----------------------------------------------------------------------------
1818 psm*)
1819 unit=`expr $i : 'psm\(.*\)'`
1820 chr=21
1822 # Non-blocking for X11
1823 mknod psm $unit c $chr `unit2minor $(($unit * 2 + 1))`
1826 #-----------------------------------------------------------------------------
1828 mouse*)
1829 name=`expr $i : 'mouse\(.*\)'`
1831 [ -c $name ] || $0 $name # Make the appropriate device
1833 ln -fs $name mouse
1836 #-----------------------------------------------------------------------------
1838 pcaudio)
1839 mknod pcaudio "" c 24 0
1840 mknod pcaudioctl "" c 24 128
1843 #-----------------------------------------------------------------------------
1845 socksys)
1846 mknod socksys "" c 41 0 root:wheel 666
1847 mknod spx "" c 41 1 root:wheel 666
1849 ln -fs socksys nfsd
1852 #-----------------------------------------------------------------------------
1854 snd*)
1856 unit=`expr $i : 'snd\(.*\)'`
1857 chr=30
1859 ln -fs mixer$unit mixer
1860 ln -fs sequencer$unit sequencer
1861 ln -fs dsp$unit dsp
1862 ln -fs audio$unit audio
1863 ln -fs dspW$unit dspW
1864 ln -fs music$unit music
1865 ln -fs pss$unit pss
1866 ln -fs dsp$unit.0 dsp$unit
1867 ln -fs audio$unit.0 audio$unit
1868 ln -fs dspW$unit.0 dspW$unit
1870 mknod mixer $unit c $chr `unit2minor $(($unit * 16 + 0))` \
1871 root:wheel 666
1872 mknod sequencer $unit c $chr `unit2minor $(($unit * 16 + 1))` \
1873 root:wheel 666
1874 mknod midi $unit c $chr `unit2minor $(($unit * 16 + 2))` \
1875 root:wheel 666
1877 for chn in 0 1 2 3
1879 minor=$(($chn * 65536 + $unit * 16))
1881 mknod dsp $unit.$chn c $chr $(($minor + 3)) root:wheel 666
1882 mknod audio $unit.$chn c $chr $(($minor + 4)) root:wheel 666
1883 mknod dspW $unit.$chn c $chr $(($minor + 5)) root:wheel 666
1884 done
1886 mknod sndstat "" c $chr 6 root:wheel 666
1887 mknod music $unit c $chr `unit2minor $(($unit * 16 + 8))` root:wheel 666
1888 mknod pss $unit c $chr `unit2minor $(($unit * 16 + 9))` root:wheel 666
1891 #-----------------------------------------------------------------------------
1893 vat)
1894 mknod vatio "" c 25 128 root:wheel 660
1897 #-----------------------------------------------------------------------------
1899 gsc*)
1900 unit=`expr $i : 'gsc\(.*\)'`
1902 mknod gsc $unit c 47 `unit2minor $unit` root:wheel 666
1903 mknod gsc ${unit}p c 47 `unit2minor $(($unit + 8))` root:wheel 666
1904 mknod gsc ${unit}d c 47 `unit2minor $(($unit + 32))` root:wheel 666
1905 mknod gsc ${unit}pd c 47 `unit2minor $(($unit + 40))` root:wheel 666
1908 #-----------------------------------------------------------------------------
1910 acpi)
1911 mknod acpi "" c 152 0 root:operator 664
1914 #-----------------------------------------------------------------------------
1916 apm)
1917 mknod apm "" c 39 0 root:operator 664
1920 #-----------------------------------------------------------------------------
1922 apmctl)
1923 mknod apmctl "" c 39 8 root:operator 660
1926 #-----------------------------------------------------------------------------
1928 card*)
1929 unit=`expr $i : 'card\(.*\)'`
1930 chr=50
1932 mknod card $unit c $chr `unit2minor $unit` root:wheel 644
1935 #-----------------------------------------------------------------------------
1937 ttyx?|ttyy?|ttyz?)
1938 case $i in
1939 *0) unit=0;; *1) unit=1;; *2) unit=2;; *3) unit=3;;
1940 *4) unit=4;; *5) unit=5;; *6) unit=6;; *7) unit=7;;
1941 *8) unit=8;; *9) unit=9;; *a) unit=10;; *b) unit=11;;
1942 *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1943 esac
1945 case $i in
1946 ttyy?) unit=$(($unit + 16));;
1947 ttyz?) unit=$(($unit + 32));;
1948 esac
1950 mknod $i "" c 42 $unit
1953 #-----------------------------------------------------------------------------
1955 cronyx)
1956 mknod cronyx "" c 42 63
1959 #-----------------------------------------------------------------------------
1961 joy)
1962 mknod joy 0 c 51 0 root:operator 640
1963 mknod joy 1 c 51 1 root:operator 640
1966 #-----------------------------------------------------------------------------
1968 spigot)
1969 mknod spigot "" c 11 0 root:wheel 444
1972 #-----------------------------------------------------------------------------
1974 ctx?)
1975 unit=`expr $i : 'ctx\(.*\)'`
1977 mknod ctx $unit c 40 `unit2minor $unit` root:wheel 444
1980 #-----------------------------------------------------------------------------
1982 meteor?)
1983 unit=`expr $i : 'meteor\(.*\)'`
1985 mknod meteor $unit c 67 `unit2minor $unit` root:wheel 444
1988 #-----------------------------------------------------------------------------
1990 bktr?)
1991 unit=`expr $i : 'bktr\(.*\)'`
1993 mknod bktr $unit c 92 `unit2minor $unit` root:wheel 444
1994 mknod tuner $unit c 92 `unit2minor $((16 + $unit))` root:wheel 444
1995 mknod vbi $unit c 92 `unit2minor $((32 + $unit))` root:wheel 444
1998 #-----------------------------------------------------------------------------
2000 tun*)
2001 ntun=`expr $i : 'tun\(.*\)$'`
2002 unit=0
2004 while [ $unit -le $ntun ]
2006 mknod tun $unit c 52 `unit2minor $unit`
2008 unit=$(($unit + 1))
2009 done
2012 #-----------------------------------------------------------------------------
2014 tap*)
2015 ntap=`expr $i : 'tap\(.*\)$'`
2016 unit=0
2018 while [ $unit -le $ntap ]
2020 mknod tap $unit c 149 `unit2minor $unit` root:network
2022 unit=$(($unit + 1))
2023 done
2026 #-----------------------------------------------------------------------------
2028 sysmouse)
2029 mknod sysmouse "" c 12 128
2030 mknod consolectl "" c 12 255
2033 #-----------------------------------------------------------------------------
2035 jogdial)
2036 mknod jogdial "" c 160 0
2039 #-----------------------------------------------------------------------------
2041 snp?)
2042 unit=`expr $i : 'snp\(.*\)'`
2044 mknod snp $unit c 53 `unit2minor $unit`
2047 #-----------------------------------------------------------------------------
2049 labpc*)
2050 case $i in
2051 labpcaio*)
2052 name=labpcaio
2053 unit=`expr $i : 'labpcaio\(.*\)'`
2054 all="0 1 2 3 4 5 6 7"
2055 offset=0
2058 labpcdio*)
2059 name=labpcdio
2060 unit=`expr $i : 'labpcdio\(.*\)'`
2061 all="0 1 2 3"
2062 offset=8
2066 die 3 "Don't know LabPC type $i"
2068 esac
2070 [ "${unit}" ] || unit=all
2072 case $unit in
2073 0|1|2|3|4|5|6|7)
2074 mknod $name $unit c 66 $(($offset + $unit)) \
2075 root:wheel 660
2078 all)
2079 for i in $all
2081 mknod $name $i c 66 $(($offset + $i)) \
2082 root:wheel 660
2083 done
2087 echo "No such LabPC unit: $unit"
2089 esac
2092 #-----------------------------------------------------------------------------
2094 perfmon)
2095 mknod perfmon "" c 2 32 root:kmem 640
2098 #-----------------------------------------------------------------------------
2100 ipl)
2101 mknod ipl "" c 79 0
2102 mknod ipnat "" c 79 1
2103 mknod ipstate "" c 79 2
2104 mknod ipauth "" c 79 3
2107 #-----------------------------------------------------------------------------
2109 elan*)
2110 mknod elan-mmcr "" c 100 0 root:wheel 600
2113 #-----------------------------------------------------------------------------
2115 kbd*)
2116 unit=`expr $i : 'kbd\(.*\)'`
2117 chr=112
2119 mknod kbd $unit c $chr `unit2minor $unit`
2122 #-----------------------------------------------------------------------------
2124 i4b)
2125 mknod i4b "" c 60 0
2128 i4bctl)
2129 mknod i4bctl "" c 55 0
2132 i4brbch*)
2133 unit=`expr $i : 'i4brbch\(.*\)'`
2135 mknod i4brbch $unit c 57 `unit2minor $unit`
2138 i4bteld*)
2139 offset=64
2140 unit=`expr $i : 'i4bteld\(.*\)'`
2142 mknod i4bteld $unit c 56 `unit2minor $(($offset + $unit))`
2145 i4btel*)
2146 unit=`expr $i : 'i4btel\(.*\)'`
2148 mknod i4btel $unit c 56 `unit2minor $unit`
2151 i4btrc*)
2152 unit=`expr $i : 'i4btrc\(.*\)'`
2154 mknod i4btrc $unit c 59 `unit2minor $unit`
2157 #-----------------------------------------------------------------------------
2159 aac*)
2160 unit=`expr $i : 'aac\(.*\)'`
2162 mknod aac $unit c 150 `unit2minor $unit`
2164 ln -fs aac$unit afa$unit
2165 ln -fs aac$unit hpn$unit
2168 #-----------------------------------------------------------------------------
2170 mlx*)
2171 unit=`expr $i : 'mlx\(.*\)'`
2173 mknod mlx $unit c 130 `unit2minor $unit`
2176 #-----------------------------------------------------------------------------
2178 amr*)
2179 unit=`expr $i : 'amr\(.*\)'`
2181 mknod amr $unit c 132 `unit2minor $unit`
2184 #-----------------------------------------------------------------------------
2186 ips*)
2187 unit=`expr $i : 'ips\(.*\)'`
2189 mknod mlx $unit c 175 `unit2minor $unit`
2192 #-----------------------------------------------------------------------------
2194 ciss*)
2195 unit=`expr $i : 'ciss\(.*\)'`
2197 mknod ciss $unit c 166 `unit2minor $unit`
2200 #-----------------------------------------------------------------------------
2202 agpgart)
2203 mknod agpgart "" c 148 0
2206 #-----------------------------------------------------------------------------
2208 twe*)
2209 unit=`expr $i : 'twe\(.*\)'`
2211 mknod twe $unit c 146 `unit2minor $unit`
2214 #-----------------------------------------------------------------------------
2216 tw*)
2217 unit=`expr $i : 'tw\(.*\)'`
2219 mknod tw $unit c 19 `unit2minor $unit` root:operator
2222 #-----------------------------------------------------------------------------
2224 nsmb*)
2225 unit=`expr $i : 'nsmb\(.*\)'`
2227 mknod nsmb $unit c 144 $unit
2230 #-----------------------------------------------------------------------------
2232 local)
2233 umask 0
2234 sh MAKEDEV.local
2235 umask 77
2238 #-----------------------------------------------------------------------------
2241 echo $i - no such device name
2244 esac
2245 done