MAKEDEV.tmpl revision 1.98
1#!/bin/sh - 2# $NetBSD: MAKEDEV.tmpl,v 1.98 2007/12/15 21:33:13 apb Exp $ 3# 4# Copyright (c) 2003,2007 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# 1. Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. 12# 2. Redistributions in binary form must reproduce the above copyright 13# notice, this list of conditions and the following disclaimer in the 14# documentation and/or other materials provided with the distribution. 15# 3. All advertising materials mentioning features or use of this software 16# must display the following acknowledgement: 17# This product includes software developed by the NetBSD 18# Foundation, Inc. and its contributors. 19# 4. Neither the name of The NetBSD Foundation nor the names of its 20# contributors may be used to endorse or promote products derived 21# from this software without specific prior written permission. 22# 23# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 24# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 27# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33# POSSIBILITY OF SUCH DAMAGE. 34# 35# 36########################################################################### 37# 38# PLEASE RUN "cd ../share/man/man8 ; make makedevs" 39# AFTER CHANGING THIS FILE, AND COMMIT THE UPDATED MANPAGE! 40# 41########################################################################### 42# 43# Device "make" file. Valid special arguments: 44# all makes all known devices, including local devices. 45# Tries to make the 'standard' number of each type. 46# init A set of devices that is used for MFS /dev by init. 47# May be equal to "all". 48# floppy devices to be put on install floppies 49# ramdisk devices to be put into INSTALL kernel ramdisks. 50# std standard devices 51# local configuration specific devices 52# wscons make wscons devices 53# usbs make USB devices 54# isdns make ISDN devices 55# 56# Tapes: 57# st* SCSI tapes 58# wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape 59# ht* MASSBUS TM03 and TU?? 60# mt* MSCP tapes (e.g. TU81, TK50) 61# tm* UNIBUS TM11 and TE10 emulations (e.g. Emulex TC-11) 62# ts* UNIBUS TS11 63# ut* UNIBUS TU45 emulations (e.g. si 9700) 64# uu* TU58 cassettes on DL11 controller 65# 66# Disks: 67# ccd* concatenated disk devices 68# cd* SCSI or ATAPI CD-ROM 69# cgd* cryptographic disk devices 70# raid* RAIDframe disk devices 71# sd* SCSI disks 72# wd* "winchester" disk drives (ST506,IDE,ESDI,RLL,...) 73# bmd* Nereid bank memory disks 74# ed* IBM PS/2 ESDI disk devices 75# fd* "floppy" disk drives (3 1/2", 5 1/4") 76# fss* Files system snapshot devices 77# gdrom* Dreamcast "gigadisc" CD-ROM drive 78# hk* UNIBUS RK06 and RK07 79# hp* MASSBUS RM?? 80# ld* Logical disk devices (e.g., hardware RAID) 81# mcd* Mitsumi CD-ROM 82# md* memory pseudo-disk devices 83# ofdisk* OpenFirmware disk devices 84# ra* MSCP disks (RA??, RD??) 85# rb* 730 IDC w/ RB80 and/or RB02 86# rd* HDC9224 RD disks on VS2000 87# rl* UNIBUS RL02 88# rx* MSCP floppy disk (RX33/50/...) 89# up* other UNIBUS devices (e.g. on Emulex SC-21V controller) 90# vnd* "file" pseudo-disks 91# xbd* Xen virtual disks 92# xd* Xylogic 753/7053 disks 93# xy* Xylogic 450/451 disks 94# 95# Pointing devices: 96# wsmouse* wscons mouse events 97# lms* Logitech bus mouse 98# mms* Microsoft bus mouse 99# qms* "quadrature mouse" 100# pms* PS/2 mouse 101# mouse mouse (provides events, for X11) 102# 103# Keyboard devices: 104# wskbd* wscons keyboard events 105# kbd raw keyboard (provides events, for X11) 106# kbdctl keyboard control 107# 108# Terminals/Console ports: 109# tty[01]* standard serial ports 110# tty0* SB1250 ("sbscn") serial ports (sbmips) 111# ttyE* wscons - Workstation console ("wscons") glass-tty emulators 112# ttyCZ? Cyclades-Z multiport serial boards. Each "unit" 113# makes 64 ports. 114# ttyCY? Cyclom-Y multiport serial boards. Each "unit" makes 115# 32 ports. 116# ttye* ITE bitmapped consoles 117# ttyv0 pccons 118# ttyC? NS16550 ("com") serial ports 119# ttyS* SA1110 serial port (hpcarm) 120# ttyTX? TX39 internal serial ports (hpcmips) 121# ttyB? DEC 3000 ZS8530 ("scc") serial ports (alpha) 122# ttyA* mfc serial ports (amiga) 123# ttyB* msc serial ports (amiga) 124# ttyC* com style serial ports (DraCo, HyperCom) (amiga) 125# On the DraCo, units 0 and 1 are the built-in "modem" and 126# "mouse" ports, if configured. 127# ttyA0 8530 Channel A (formerly ser02) (atari) 128# ttyA1 8530 Channel B (formerly mdm02) (atari) 129# ttyB0 UART on first 68901 (formerly mdm01) (atari) 130# ixpcom IXP12x0 COM ports 131# epcom EP93xx COM ports 132# ttyM? HP200/300 4 port serial mux interface (hp300) 133# ttya "ttya" system console (luna68k) 134# ttyb second system serial port (luna68k) 135# tty* Onboard serial ports (mvme68k) 136# On the mvme147 these are: ttyZ1, ttyZ2 and ttyZ3. 137# On the mvme167, and '177: ttyC1, ttyC2 and ttyC3. 138# Note that tty[CZ]0 is grabbed by the console device 139# so is not created by default 140# dc* PMAX 4 channel serial interface (kbd, mouse, modem, printer) 141# scc* 82530 serial interface (pmax) 142# ttyZ* Zilog 8530 ("zstty") serial ports 143# tty[abcd] Built-in serial ports (sparc) 144# tty* Z88530 serial controllers (sparc64) 145# ttyh* SAB82532 serial controllers (sparc64) 146# tty[a-j] Built-in serial ports (sun2, sun3) 147# ttyC? pccons (arc) 148# dz* UNIBUS DZ11 and DZ32 (vax) 149# dh* UNIBUS DH11 and emulations (e.g. Able DMAX, Emulex CS-11) (vax) 150# dmf* UNIBUS DMF32 (vax) 151# dhu* UNIBUS DHU11 (vax) 152# dmz* UNIBUS DMZ32 (vax) 153# dl* UNIBUS DL11 (vax) 154# xencons Xen virtual console 155# 156# Terminal multiplexors: 157# dc* 4 channel serial interface (keyboard, mouse, modem, printer) 158# dh* UNIBUS DH11 and emulations (e.g. Able DMAX, Emulex CS-11) 159# dhu* UNIBUS DHU11 160# dl* UNIBUS DL11 161# dmf* UNIBUS DMF32 162# dmz* UNIBUS DMZ32 163# dz* UNIBUS DZ11 and DZ32 164# scc* 82530 serial interface 165# 166# Call units: 167# dn* UNIBUS DN11 and emulations (e.g. Able Quadracall) 168# 169# Pseudo terminals: 170# ptm pty multiplexor device. 171# pty* set of 16 master and slave pseudo terminals 172# opty first 16 ptys, to save inodes on install media 173# ipty first 2 ptys, for install media use only 174# 175# Printers: 176# arcpp* Archimedes parallel port 177# lpt* stock lp 178# lpa* interruptless lp 179# par* Amiga motherboard parallel port 180# 181# USB devices: 182# usb* USB control devices 183# uhid* USB generic HID devices 184# ulpt* USB printer devices 185# ugen* USB generic devices 186# urio* USB Diamond Rio 500 devices 187# uscanner* USB scanners 188# ttyU* USB modems 189# ttyY* USB serial adapters 190# 191# ISDN devices: 192# isdn communication between userland isdnd and kernel 193# isdnctl control device 194# isdnbchan* raw b-channel access 195# isdntel* telephony device 196# isdnteld* telephony dialout device 197# isdntrc* trace device 198# 199# Video devices: 200# bwtwo* monochromatic frame buffer 201# cgtwo* 8-bit color frame buffer 202# cgthree* 8-bit color frame buffer 203# cgfour* 8-bit color frame buffer 204# cgsix* accelerated 8-bit color frame buffer 205# cgeight* 24-bit color frame buffer 206# etvme Tseng et-compatible cards on VME (atari) 207# ik* UNIBUS interface to Ikonas frame buffer 208# leo Circad Leonardo VME-bus true color (atari) 209# ps* UNIBUS interface to Picture System 2 210# qv* QVSS (MicroVAX) display 211# tcx* accelerated 8/24-bit color frame buffer 212# 213# Maple bus devices: 214# maple Maple bus control devices 215# mlcd* Maple bus LCD devices 216# mmem* Maple bus storage devices 217# 218# IEEE1394 bus devices: 219# fw* IEEE1394 bus generic node access devices 220# fwmem* IEEE1394 bus physical memory of the remote node access devices 221# 222# Special purpose devices: 223# ad* UNIBUS interface to Data Translation A/D converter 224# agp* AGP GART devices 225# altq ALTQ control interface 226# amr* AMI MegaRaid control device 227# apm power management device 228# audio* audio devices 229# bell* OPM bell device (x68k) 230# bktr Brooktree 848/849/878/879 based TV cards 231# bpf packet filter 232# bthub Bluetooth Device Hub control interface 233# cfs* Coda file system device 234# ch* SCSI media changer 235# cir* Consumer IR 236# clockctl clock control for non root users 237# cpuctl CPU control 238# crypto hardware crypto access driver 239# dmoverio hardware-assisted data movers 240# dpt* DPT/Adaptec EATA RAID management interface 241# dpti* DPT/Adaptec I2O RAID management interface 242# fb* PMAX generic framebuffer pseudo-device 243# fd file descriptors 244# grf* graphics frame buffer device 245# hil HP300 HIL input devices 246# icp ICP-Vortex/Intel RAID control interface 247# iic* IIC bus device 248# io x86 IOPL access for COMPAT_10, COMPAT_FREEBSD 249# iop* I2O IOP control interface 250# ipl IP Filter 251# irframe* IrDA physical frame 252# ite* terminal emulator interface to HP300 graphics devices 253# joy* joystick device 254# kttcp kernel ttcp helper device 255# lkm loadable kernel modules interface 256# lockstat kernel locking statistics 257# magma* Magma multiport serial/parallel cards 258# midi* MIDI 259# mlx* Mylex DAC960 control interface 260# mly* Mylex AcceleRAID/eXtremeRAID control interface 261# np* UNIBUS Ethernet co-processor interface, for downloading. 262# nsmb* SMB requester 263# openfirm OpenFirmware accessor 264# pad* Pseudo-audio device driver 265# pci* PCI bus access devices 266# pf PF packet filter 267# pow* power management device (x68k) 268# putter Pass-to-Userspace Transporter 269# px* PixelStamp Xserver access 270# radio* radio devices 271# random Random number generator 272# rtc* RealTimeClock 273# satlink* PlanetConnect satellite receiver driver 274# scsibus* SCSI busses 275# se* SCSI Ethernet 276# ses* SES/SAF-TE SCSI Devices 277# speaker PC speaker (XXX - installed) 278# sram battery backuped memory (x68k) 279# ss* SCSI scanner 280# stic* PixelStamp interface chip 281# sysmon System Monitoring hardware 282# systrace syscall tracer 283# tap* virtual Ethernet device 284# tun* network tunnel driver 285# twa 3ware Apache control interface 286# twe 3ware Escalade control interface 287# uk* unknown SCSI device 288# veriexec verified executable fingerprint loader 289# vmegen* generic VME access 290# view* generic interface to graphic displays (Amiga) 291# wsfont* console font control 292# wsmux* wscons event multiplexor 293# xenevt Xen event interface 294 295 296# 297# Apart from a few lines right at the end, this file should consist 298# entirely of function definitions. 299# 300# This file is used both as a standalone script (via "sh ./MAKEDEV all" 301# or similar), and as a function library (via "MAKEDEV_AS_LIBRARY=1 . 302# MAKEDEV" from MAKEDEV.local). 303# 304 305usage() 306{ 307 cat 1>&2 << _USAGE_ 308Usage: ${0##*/} [-fMs] [-m mknod] [-p pax] special [...] 309 Create listed special devices. Options: 310 -f Force permissions to be updated on existing devices. 311 -M Create memory file system. 312 -m mknod Name of mknod(8) program. [\$TOOL_MKNOD or mknod] 313 -p pax Name of pax(2) program. [\$TOOL_PAX or pax] 314 -s Generate mtree(8) specfile instead of creating devices. 315 316_USAGE_ 317 exit 1 318} 319 320# zeropad width number 321# display number with a zero (`0') padding of width digits. 322# 323zeropad() 324{ 325 case $(($1 - ${#2})) in 326 5) echo 00000$2;; 327 4) echo 0000$2;; 328 3) echo 000$2;; 329 2) echo 00$2;; 330 1) echo 0$2;; 331 0) echo $2;; 332 *) echo "$0: bad padding" 1>&2; exit 1;; 333 esac 334} 335 336# hexprint number 337# display (base10) number as hexadecimal 338# 339hexprint() 340{ 341 val="$(($1 + 0))" 342 hex= 343 set -- 0 1 2 3 4 5 6 7 8 9 a b c d e f 344 while [ "$val" -gt 0 ]; do 345 eval hex=\$$(($val % 16 + 1))\$hex 346 val="$(($val / 16))" 347 done 348 echo "${hex:-0}" 349} 350 351# linecount multiline_string 352# count the number of lines in the string 353# 354linecount() 355{ 356 local IFS=' 357' # just a newline, no other white space between the quotes 358 set -- $1 359 echo $# 360} 361 362# nooutput -12 cmd [args...] 363# run a command with stdout and/or stderr ignored. 364# "nooutput -2 cmd" is like "cmd 2>/dev/null", 365# except it should work even if /dev/null doesn't [yet] exist. 366# 367nooutput() 368{ 369 local flags="$1" ; shift 370 local junk 371 case "$flags" in 372 "-1") junk="$( "$@" )" ;; 373 "-2") exec 4>&1 ; junk="$( "$@" 2>&1 1>&4 )" ; exec 4>&- ;; 374 "-12") junk="$( "$@" 2>&1 )" ;; 375 *) warn "Incorrect use of nooutput" ;; 376 esac 377} 378 379# check_pax path_to_pax 380# Check whether pax supports the command line options we 381# will want to use. 382# 383check_pax() 384{ 385 local pax="$1" 386 echo ". type=dir optional" | nooutput -12 "${pax}" -r -w -M -pe . 387} 388 389# setup args... 390# Parse command line arguments, exit on error. 391# Callers should shift $((OPTIND - 1)) afterwards. 392# 393setup() 394{ 395 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/rescue 396 397 do_create_mfs=false 398 do_force=false 399 do_mknod=false 400 do_pax=false 401 do_redirect=false 402 do_specfile=false 403 opts= 404 while getopts Mfm:p:s ch; do 405 # Options that should not be passed through to 406 # MAKEDEV.local are not added to $opts. 407 case ${ch} in 408 M) 409 # "-M" sets do_create_mfs; 410 # "-M -M" is for use from init(8), and sets do_redirect 411 do_redirect=$do_create_mfs 412 do_create_mfs=true 413 ;; 414 f) do_force=true 415 opts="${opts} -f" 416 ;; 417 m) TOOL_MKNOD=${OPTARG} 418 do_mknod=true 419 opts="${opts} -m ${OPTARG}" 420 ;; 421 p) TOOL_PAX="${OPTARG}" 422 if check_pax "${TOOL_PAX}"; then 423 do_pax=true 424 # do not add this to $opts; we will later 425 # add "-s" instead. 426 else 427 warn "Ignored -p option:" \ 428 "${TOOL_PAX} is missing or broken" 429 do_mknod=true 430 fi 431 ;; 432 s) do_specfile=true 433 opts="${opts} -s" 434 ;; 435 *) usage ;; 436 esac 437 done 438 439 shift $((${OPTIND} - 1)) 440 [ $# -gt 0 ] || usage 441 442 u_root="%uid_root%" 443 u_uucp="%uid_uucp%" 444 g_kmem="%gid_kmem%" 445 g_ntpd="%gid_ntpd%" 446 g_operator="%gid_operator%" 447 g_wheel="%gid_wheel%" 448 dialin=0 449 dialout=524288 450 callunit=262144 451 452 # only allow read&write for owner by default 453 umask 077 454 455 # Check if we have fdesc mounted 456 if [ -d fd ]; then 457 case "$(df fd)" in 458 *fdesc*) nofdesc=false;; 459 *) nofdesc=true;; 460 esac 461 else 462 nofdesc=true 463 fi 464 465 # do_force requires mknod 466 if $do_force; then 467 if $do_pax || $do_specfile; then 468 warn "-f option works only with mknod" 469 exit 1 470 fi 471 do_mknod=true 472 fi 473 474 # If no other options take precedence, then default to 475 # using pax, if it appears to work. 476 if ! $do_mknod && ! $do_specfile && ! $do_pax; then 477 : ${TOOL_PAX:=pax} 478 if check_pax "${TOOL_PAX}"; then 479 do_pax=true 480 else 481 do_mknod=true 482 fi 483 fi 484 485 # Now we need exactly one of do_pax, do_mknod, or do_specfile. 486 case $(( $($do_pax && echo 1 || echo 0) + \ 487 $($do_mknod && echo 1 || echo 0) + \ 488 $($do_specfile && echo 1 || echo 0) )) 489 in 490 1) : OK ;; 491 *) 492 warn "-m, -p, and -s options are mutually exclusive" 493 exit 1 494 ;; 495 esac 496 497 # If we are using mknod, then decide what options to pass it. 498 if $do_mknod; then 499 MKNOD="${TOOL_MKNOD:-mknod} -F netbsd" 500 if $do_force; then 501 MKNOD="${MKNOD} -R" 502 else 503 MKNOD="${MKNOD} -r" 504 fi 505 fi 506 507 # do_pax internally implies do_specfile. This happens after 508 # checking for mutually-exclusive options. 509 if $do_pax && ! $do_specfile; then 510 do_specfile=true 511 opts="${opts} -s" 512 fi 513} 514 515# wrap_makedev makedev_name ... 516# Invoke a makedev-like function, with additional processing 517# as appropriate for use from the outer level. 518# 519wrap_makedev() 520{ 521 if $do_specfile; then 522 # "optional" tells pax(1) not to create the directory itself. 523 echo ". type=dir optional" 524 fi 525 "$@" 526} 527 528# makedev_main makedev_name args... 529# Perform most of the work of the main program. makedev_name is 530# the name of a makedev-like function, and the other args are 531# command line args with which the MAKEDEV (or MAKEDEV.local) 532# script was invoked. 533# 534makedev_main() 535{ 536 local makedev="$1" ; shift 537 538 # Parse command line args 539 setup ${1+"$@"} 540 shift $((${OPTIND}-1)) 541 542 if $do_create_mfs; then 543 # Count inodes and create mfs file system. 544 # The makedev call merely updates $count_nodes. 545 count_nodes=0 546 $makedev ${1+"$@"} 547 create_mfs_dev $count_nodes 548 unset count_nodes 549 fi 550 551 if $do_pax ; then 552 # wrap_makedev will print an mtree specification because 553 # do_pax implies do_specfile. pax will create device nodes. 554 wrap_makedev $makedev ${1+"$@"} | ${TOOL_PAX} -r -w -M -pe . 555 else 556 wrap_makedev $makedev ${1+"$@"} 557 fi 558} 559 560# 561# functions available to create nodes: 562# 563# mkdev name [b|c] major minor [mode{=600} [gid{=0} [uid{=0}]]] 564# create device node `name' with the appropriate permissions 565# 566# lndev src target 567# create a symlink from src to target 568# 569# makedir dir mode 570# create directory with appropriate mode 571# 572 573mkdev() 574{ 575 if [ -n "$count_nodes" ]; then 576 count_nodes=$((count_nodes + 1)) 577 return 578 fi 579 if $do_specfile; then 580 case $2 in 581 b) type=block ;; 582 c) type=char ;; 583 esac 584 echo "./$1 type=${type} device=netbsd,$3,$4 mode=${5:-600} gid=${6:-$g_wheel} uid=${7:-$u_root}" 585 else 586 ${MKNOD} -m ${5:-600} -g \#${6:-$g_wheel} -u \#${7:-$u_root} $1 $2 $3 $4 587 fi 588} 589 590lndev() 591{ 592 if [ -n "$count_nodes" ]; then 593 count_nodes=$((count_nodes + 1)) 594 return 595 fi 596 if $do_specfile; then 597 echo "./$2 type=link link=$1 mode=0700 gid=$g_wheel uid=$u_root" 598 else 599 ln -f -s $1 $2 600 fi 601} 602 603makedir() 604{ 605 if [ -n "$count_nodes" ]; then 606 count_nodes=$((count_nodes + 1)) 607 return 608 fi 609 if $do_specfile; then 610 echo "./$1 type=dir mode=$2 gid=$g_wheel uid=$u_root" 611 else 612 nooutput -2 mkdir $1 613 chmod $2 $1 614 fi 615} 616 617warn() 618{ 619 echo 1>&2 "$0: $*" 620} 621 622# makedev special [...] 623# the main loop 624# 625makedev() 626{ 627 628for i 629do 630 631case $i in 632 633%MD_DEVICES% 634 635all) 636 makedev all_md 637 makedev std fd ptm pty0 pty1 pty2 pty3 638 makedev ccd0 ccd1 ccd2 ccd3 639 makedev cgd0 cgd1 cgd2 cgd3 640 makedev fss0 fss1 fss2 fss3 641 makedev md0 md1 642 makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7 643 makedev vnd0 vnd1 vnd2 vnd3 644 makedev bpf 645 makedev tun0 tun1 tun2 tun3 646 makedev ipl pf crypto random systrace 647 makedev lkm lockstat clockctl cpuctl 648 makedev atabus0 atabus1 atabus2 atabus3 649 makedev tap tap0 tap1 tap2 tap3 650 makedev gpio gpio0 gpio1 gpio2 gpio3 gpio4 gpio5 gpio6 gpio7 651 makedev pad pad0 pad1 pad2 pad3 652 makedev bthub 653 makedev cfs 654 makedev putter 655 makedev local # do this last 656 ;; 657 658init) 659 # unless overridden by MD entry, this is equal to 'all' 660 makedev all 661 ;; 662 663%MI_DEVICES_BEGIN% 664audio) 665 makedev audio0 audio1 audio2 audio3 666 lndev sound0 sound 667 lndev audio0 audio 668 lndev mixer0 mixer 669 lndev audioctl0 audioctl 670 ;; 671 672gpio) 673 makedev gpio0 gpio1 gpio2 gpio3 gpio4 gpio5 gpio6 gpio7 674 lndev gpio0 gpio 675 ;; 676 677pad) 678 makedev pad0 pad1 pad2 pad3 679 lndev pad0 pad 680 ;; 681 682radio) 683 makedev radio0 radio1 684 lndev radio0 radio 685 ;; 686 687ramdisk) 688 makedev floppy md0 689 ;; 690 691usbs) 692 makedev usb usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7 693 makedev uhid0 uhid1 uhid2 uhid3 694 makedev ulpt0 ulpt1 695 makedev ttyU0 ttyU1 696 makedev ttyY0 ttyY1 697 makedev urio0 698 makedev uscanner0 uscanner1 699 makedev utoppy0 utoppy1 700 makedev ugen0 701 ;; 702 703isdns) 704 makedev isdn isdnctl isdnbchan0 isdnbchan1 isdntel0 isdntel1 isdnteld0 isdnteld1 isdntrc0 isdntrc1 705 ;; 706 707std) 708 mkdev console c %cons_chr% 0 600 709 mkdev constty c %cons_chr% 1 600 710 mkdev drum c %swap_chr% 0 640 $g_kmem 711 mkdev kmem c %mem_chr% 1 640 $g_kmem 712 mkdev mem c %mem_chr% 0 640 $g_kmem 713 mkdev null c %mem_chr% 2 666 714 mkdev zero c %mem_chr% 12 666 715 mkdev klog c %log_chr% 0 600 716 mkdev ksyms c %ksyms_chr% 0 444 717 if $nofdesc; then 718 mkdev tty c %ctty_chr% 0 666 719 mkdev stdin c %filedesc_chr% 0 666 720 mkdev stdout c %filedesc_chr% 1 666 721 mkdev stderr c %filedesc_chr% 2 666 722 fi 723 ;; 724 725usb) 726 mkdev usb c %usb_chr% 255 444 727 ;; 728 729usb*) 730 unit=${i#usb} 731 usb=usb$unit 732 mkdev usb$unit c %usb_chr% $unit 733 ;; 734 735uhid*) 736 unit=${i#uhid} 737 mkdev uhid$unit c %uhid_chr% $unit 666 738 ;; 739 740ulpt*) 741 unit=${i#ulpt} 742 mkdev ulpt$unit c %ulpt_chr% $unit 743 mkdev ulpn$unit c %ulpt_chr% $(($unit + 64)) 744 ;; 745 746urio*) 747 unit=${i#urio} 748 mkdev urio$unit c %urio_chr% $unit 666 749 ;; 750 751uscanner*) 752 unit=${i#uscanner} 753 mkdev uscanner$unit c %uscanner_chr% $unit 754 ;; 755 756utoppy*) 757 unit=${i#utoppy} 758 mkdev utoppy$unit c %utoppy_chr% $unit 759 ;; 760 761ttyY*) 762 unit=${i#ttyY} 763 mkdev ttyY$unit c %ucycom_chr% $(($unit + $dialin )) "" "" $u_uucp 764 mkdev dtyY$unit c %ucycom_chr% $(($unit + $dialout )) "" "" $u_uucp 765 mkdev ctyY$unit c %ucycom_chr% $(($unit + $callunit)) "" "" $u_uucp 766 ;; 767 768ttyU*) 769 unit=${i#ttyU} 770 mkdev ttyU$unit c %ucom_chr% $(($unit + $dialin )) "" "" $u_uucp 771 mkdev dtyU$unit c %ucom_chr% $(($unit + $dialout )) "" "" $u_uucp 772 mkdev ctyU$unit c %ucom_chr% $(($unit + $callunit)) "" "" $u_uucp 773 ;; 774 775ugen*) 776 unit=${i#ugen} 777 for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 778 do 779 mkdev ugen$unit.$j c %ugen_chr% $(($unit * 16 + ${j#0})) 780 done 781 ;; 782 783wscons) 784 makedev ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 ttyE6 ttyE7 785 makedev wsmouse0 wsmouse1 wsmouse2 wsmouse3 786 makedev wskbd0 wskbd1 wskbd2 wskbd3 787 makedev wsmux0 wsmux1 wsmux2 wsmux3 788 makedev wsmouse wskbd 789 makedev ttyEcfg ttyEstat 790 makedev wsfont 791 ;; 792 793wsmouse) 794 mkdev wsmouse c %wsmux_chr% 0 795 ;; 796 797wskbd) 798 mkdev wskbd c %wsmux_chr% 1 799 ;; 800 801wsmux*) 802 unit=${i#wsmux} 803 mkdev wsmux$unit c %wsmux_chr% $unit 804 mkdev wsmuxctl$unit c %wsmux_chr% $(($unit + 128)) 200 805 ;; 806 807xenevt) 808 mkdev xenevt c %xenevt_chr% 0 809 ;; 810 811xsd_kva) 812 mkdev xsd_kva c %xenevt_chr% 1 813 ;; 814 815xencons) 816 mkdev xencons c %xencons_chr% 0 817 ;; 818 819ttyEstat) 820 mkdev ttyEstat c %wsdisplay_chr% 254 821 ;; 822 823ttyEcfg) 824 mkdev ttyEcfg c %wsdisplay_chr% 255 825 ;; 826 827ttyE*) 828 unit=${i#ttyE} 829 mkdev ttyE$unit c %wsdisplay_chr% $unit 830 ;; 831 832wsmouse*) 833 unit=${i#wsmouse} 834 mkdev wsmouse$unit c %wsmouse_chr% $unit 835 ;; 836 837wskbd*) 838 unit=${i#wskbd} 839 mkdev wskbd$unit c %wskbd_chr% $unit 840 ;; 841 842fd) 843 if $nofdesc; then 844 makedir fd 755 845 n=0 846 while [ $n -lt 64 ] 847 do 848 mkdev fd/$n c %filedesc_chr% $n 666 849 n=$(($n + 1)) 850 done 851 fi 852 ;; 853 854wt*) 855 case $i in 856 wt*) name=wt; unit=${i#wt}; chr=%wt_chr%; blk=%wt_blk%;; 857 esac 858 for sub in $unit $(($unit+8)) $(($unit+16)) 859 do 860 mkdev $name$sub b $blk $(($sub + 0)) 660 $g_operator 861 mkdev n$name$sub b $blk $(($sub + 4)) 660 $g_operator 862 mkdev r$name$sub c $chr $(($sub + 0)) 660 $g_operator 863 mkdev nr$name$sub c $chr $(($sub + 4)) 660 $g_operator 864 done 865 ;; 866 867md*) 868 makedisk_minimal md ${i#md} %md_blk% %md_chr% 869 ;; 870 871fss*) 872 case $i in 873 fss*) name=fss; unit=${i#fss}; blk=%fss_blk%; chr=%fss_chr% 874 esac 875 mkdev $name$unit b $blk $unit 660 $g_operator 876 mkdev r$name$unit c $chr $unit 660 $g_operator 877 ;; 878 879ss*) 880 case $i in 881 ss*) name=ss; unit=${i#ss}; chr=%ss_chr%;; 882 esac 883 mkdev $name$unit c $chr $(($unit * 16 + 0)) 640 $g_operator 884 mkdev n$name$unit c $chr $(($unit * 16 + 1)) 640 $g_operator 885 mkdev en$name$unit c $chr $(($unit * 16 + 3)) 640 $g_operator 886 ;; 887 888ccd*|cgd*|raid*|vnd*) 889 case $i in 890 ccd*) name=ccd; unit=${i#ccd}; blk=%ccd_blk%; chr=%ccd_chr%;; 891 cgd*) name=cgd; unit=${i#cgd}; blk=%cgd_blk%; chr=%cgd_chr%;; 892 raid*) name=raid; unit=${i#raid}; blk=%raid_blk%; chr=%raid_chr%;; 893 vnd*) name=vnd; unit=${i#vnd}; blk=%vnd_blk%; chr=%vnd_chr%;; 894 esac 895 %MKDISK% $name $unit $blk $chr 896 ;; 897 898sd*) 899 name=sd; unit=${i#sd}; blk=%sd_blk%; chr=%sd_chr% 900 %MKDISK% $name $unit $blk $chr 901 ;; 902 903wd*) 904 name=wd; unit=${i#wd}; blk=%wd_blk%; chr=%wd_chr% 905 %MKDISK% $name $unit $blk $chr 906 ;; 907 908fd*) 909 name=fd; unit=${i#fd}; blk=%fd_blk%; chr=%fd_chr% 910 %MKDISK% $name $unit $blk $chr 911 ;; 912 913ld*) 914 name=ld; unit=${i#ld}; blk=%ld_blk%; chr=%ld_chr% 915 %MKDISK% $name $unit $blk $chr 916 ;; 917 918bio) 919 mkdev bio c %bio_chr% 0 920 ;; 921 922ed*) 923 name=ed; unit=${i#ed}; blk=%ed_blk%; chr=%ed_chr% 924 %MKDISK% $name $unit $blk $chr 925 ;; 926 927ofdisk*) 928 name=ofdisk; unit=${i#ofdisk}; blk=%ofdisk_blk%; chr=%ofdisk_chr% 929 %MKDISK% $name $unit $blk $chr 930 ;; 931 932xbd*) 933 name=xbd; unit=${i#xbd}; blk=%xbd_blk%; chr=%xbd_chr% 934 %MKDISK% $name $unit $blk $chr 935 ;; 936 937dk*) 938 name=dk; unit=${i#dk}; blk=%dk_blk%; chr=%dk_chr% 939 minor=0 940 while [ $minor -le ${i#dk} ] 941 do 942 mkdev r$name$minor c $chr $minor 0640 $g_operator 943 mkdev $name$minor b $blk $minor 0640 $g_operator 944 minor=$(($minor + 1)) 945 done 946 ;; 947 948ttyCY*) 949 name=tyCY; chr=%cy_chr%; off=32 950 unit=${i#t${name}} 951 minor=$(($unit * $off)) 952 eminor=$(($minor + $off)) 953 while [ $minor -lt $eminor ] 954 do 955 nminor=000$minor 956 nminor=${nminor#${nminor%???}} 957 mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp 958 mkdev d$name$nminor c $chr $(($minor + $dialout)) "" "" $u_uucp 959 minor=$(($minor + 1)) 960 done 961 ;; 962 963ttyCZ*) 964 name=tyCZ; chr=%cz_chr%; off=64 965 unit=${i#t${name}} 966 minor=$(($unit * $off)) 967 eminor=$(($minor + $off)) 968 while [ $minor -lt $eminor ] 969 do 970 nminor=0000$minor 971 nminor=${nminor#${nminor%????}} 972 mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp 973 mkdev d$name$nminor c $chr $(($minor + $dialout)) "" "" $u_uucp 974 minor=$(($minor + 1)) 975 done 976 ;; 977 978 979tty[0-9]|tty0[0-9]) 980 # some archs have built-in zstty (major %zstty_chr%) instead 981 # of NS16550; create ttyZ* and hardlink as [dt]ty0*; this 982 # needs to be before com entry, for archs which have both 983 unit=${i#tty} 984 unit=$(($unit + 0)) 985 makedev ttyZ${unit} 986 lndev ttyZ$unit tty0${unit} 987 lndev dtyZ$unit dty0${unit} 988 ;; 989 990tty0*|tty1*|tty[0-9]) 991 unit=${i#tty} 992 ounit=00$unit 993 ounit=${ounit#${ounit%??}} 994 mkdev tty$ounit c %com_chr% $(($unit + $dialin )) "" "" $u_uucp 995 mkdev dty$ounit c %com_chr% $(($unit + $dialout)) "" "" $u_uucp 996 ;; 997 998ttyC*) 999 # some archs call com_chr ttyC traditionally 1000 unit=${i#ttyC}; name=ttyC; dname=dtyC; chr=%com_chr% 1001 mkdev $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp 1002 mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp 1003 ;; 1004 1005ttyh*) 1006 unit=${i#ttyh}; name=ttyh; dname=dtyh; chr=%sabtty_chr% 1007 mkdev $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp 1008 mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp 1009 ;; 1010 1011ttyTX*) 1012 unit=${i#ttyTX}; name=ttyTX0; dname=dtyTX0; chr=%txcom_chr% 1013 mkdev $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp 1014 mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp 1015 ;; 1016 1017ttyZ*) 1018 unit=${i#ttyZ}; name=ttyZ; dname=dtyZ; chr=%zstty_chr% 1019 mkdev $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp 1020 mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp 1021 ;; 1022 1023opty) 1024 for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f 1025 do 1026 case $j in 1027 [0-9]) jn=$j ;; 1028 a) jn=10 ;; 1029 b) jn=11 ;; 1030 c) jn=12 ;; 1031 d) jn=13 ;; 1032 e) jn=14 ;; 1033 f) jn=15 ;; 1034 esac 1035 mkdev ttyp$j c %pts_chr% $jn 666 1036 mkdev ptyp$j c %ptc_chr% $jn 666 1037 done 1038 ;; 1039 1040pty*) 1041 class=${i#pty} 1042 d1="p q r s t u v w x y z P Q R S T" 1043 if [ "$class" -ge 64 ] 1044 then 1045 warn "$i: pty unit must be between 0 and 63" 1046 continue 1047 elif [ "$class" -lt 16 ] 1048 then 1049 offset=0 1050 mult=0 1051 d2="0 1 2 3 4 5 6 7 8 9 a b c d e f" 1052 else 1053 class=$(($class - 16)) 1054 offset=256 1055 mult=2 1056 d2="g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" 1057 fi 1058 start=$(($class * 16)) 1059 set -- $d2 1060 nt=$# 1061 s1=$(($start / $nt)) 1062 set -- $d1 1063 shift $s1 1064 t1=$1 1065 if [ "$t1" = v ]; then 1066 warn "$i: pty unit conflicts with console ttyv0 device" 1067 continue 1068 fi 1069 s2=$(($start % ($nt - $s1 * $mult))) 1070 set -- $d2 1071 shift $s2 1072 t2=$1 1073 unit=$(($start + $offset - $s1 * $mult)) 1074 end=$(($unit + 16)) 1075 while [ "$unit" -lt "$end" ] 1076 do 1077 mkdev tty$t1$t2 c %pts_chr% $unit 666 1078 mkdev pty$t1$t2 c %ptc_chr% $unit 666 1079 shift 1080 t2=$1 1081 if [ -z "$t2" ] 1082 then 1083 break 1084 fi 1085 unit=$(($unit + 1)) 1086 done 1087 ;; 1088 1089stic*) 1090 unit=${i#stic} 1091 mkdev stic$unit c %stic_chr% $unit 1092 ;; 1093 1094st*) 1095 case $i in 1096 st*) name=st; unit=${i#st}; chr=%st_chr%; blk=%st_blk%;; 1097 esac 1098 mkdev $name$unit b $blk $(($unit * 16 + 0)) 660 $g_operator 1099 mkdev n$name$unit b $blk $(($unit * 16 + 1)) 660 $g_operator 1100 mkdev e$name$unit b $blk $(($unit * 16 + 2)) 660 $g_operator 1101 mkdev en$name$unit b $blk $(($unit * 16 + 3)) 660 $g_operator 1102 mkdev r$name$unit c $chr $(($unit * 16 + 0)) 660 $g_operator 1103 mkdev nr$name$unit c $chr $(($unit * 16 + 1)) 660 $g_operator 1104 mkdev er$name$unit c $chr $(($unit * 16 + 2)) 660 $g_operator 1105 mkdev enr$name$unit c $chr $(($unit * 16 + 3)) 660 $g_operator 1106 ;; 1107 1108ses*|ch*|uk*) 1109 case $i in 1110 ch*) name=ch; unit=${i#ch}; chr=%ch_chr%;; 1111 uk*) name=uk; unit=${i#uk}; chr=%uk_chr%;; 1112 ses*) name=ses; unit=${i#ses}; chr=%ses_chr%;; 1113 esac 1114 mkdev $name$unit c $chr $unit 640 $g_operator 1115 ;; 1116 1117cd*) 1118 makedisk_minimal cd ${i#cd} %cd_blk% %cd_chr% % 1119 ;; 1120 1121mcd*) 1122 makedisk_minimal mcd ${i#mcd} %mcd_blk% %mcd_chr% 1123 ;; 1124 1125gdrom*) 1126 makedisk_minimal gdrom ${i#gdrom} %gdrom_blk% %gdrom_chr% 1127 ;; 1128 1129lpt*|lpa*) 1130 case $i in 1131 lpt*) name=lpt; unit=${i#lpt}; chr=%lpt_chr%; flags=0;; 1132 lpa*) name=lpa; unit=${i#lpa}; chr=%lpt_chr%; flags=128;; 1133 esac 1134 mkdev $name$unit c $chr $(($unit + $flags)) 1135 mkdev lpt${unit}ctl c $chr $(($unit + 256)) 1136 ;; 1137 1138bpf) 1139 mkdev bpf c %bpf_chr% 0 1140 lndev bpf bpf0 1141 ;; 1142 1143bthub) 1144 mkdev bthub c %bthub_chr% 0 1145 ;; 1146 1147tun*) 1148 unit=${i#tun} 1149 mkdev tun$unit c %tun_chr% $unit 1150 ;; 1151 1152joy*) 1153 unit=${i#joy} 1154 mkdev joy$unit c %joy_chr% $unit 1155 ;; 1156 1157ipl) 1158 mkdev ipl c %ipl_chr% 0 1159 mkdev ipnat c %ipl_chr% 1 1160 mkdev ipstate c %ipl_chr% 2 1161 mkdev ipauth c %ipl_chr% 3 1162 mkdev ipsync c %ipl_chr% 4 1163 mkdev ipscan c %ipl_chr% 5 1164 mkdev iplookup c %ipl_chr% 6 1165 ;; 1166 1167pf) 1168 mkdev pf c %pf_chr% 0 1169 ;; 1170 1171crypto) 1172 mkdev crypto c %crypto_chr% 0 666 1173 ;; 1174 1175cmos) 1176 mkdev cmos c %cmos_chr% 0 644 1177 ;; 1178 1179speaker) 1180 mkdev speaker c %spkr_chr% 0 1181 ;; 1182 1183lkm) 1184 mkdev lkm c %lkm_chr% 0 640 $g_kmem 1185 ;; 1186 1187lockstat) 1188 mkdev lockstat c %lockstat_chr% 0 1189 ;; 1190 1191cpuctl) 1192 mkdev cpuctl c %cpuctl_chr% 0 666 1193 ;; 1194 1195audio*) 1196 unit=${i#audio} 1197 audio=audio$unit 1198 sound=sound$unit 1199 mixer=mixer$unit 1200 audioctl=audioctl$unit 1201 : ${unit:-0} 1202 mkdev $sound c %audio_chr% $(($unit + 0)) 666 1203 mkdev $audio c %audio_chr% $(($unit + 128)) 666 1204 mkdev $mixer c %audio_chr% $(($unit + 16)) 666 1205 mkdev $audioctl c %audio_chr% $(($unit + 192)) 666 1206 ;; 1207 1208gpio*) 1209 unit=${i#gpio} 1210 mkdev gpio$unit c %gpio_chr% $unit 644 1211 ;; 1212 1213rmidi*) 1214 unit=${i#rmidi} 1215 mkdev rmidi$unit c %midi_chr% $unit 666 1216 ;; 1217 1218music*) 1219 unit=${i#music} 1220 : ${unit:-0} 1221 mkdev music$unit c %sequencer_chr% $(($unit + 0)) 666 1222 mkdev sequencer$unit c %sequencer_chr% $(($unit + 128)) 666 1223 ;; 1224 1225radio*) 1226 unit=${i#radio} 1227 : ${unit:-0} 1228 mkdev radio$unit c %radio_chr% $unit 666 1229 ;; 1230 1231amr*) 1232 unit=${i#amr} 1233 mkdev amr$unit c %amr_chr% $unit 1234 ;; 1235 1236apm) 1237 mkdev apm c %apm_chr% 0 644 1238 mkdev apmctl c %apm_chr% 8 644 1239 ;; 1240 1241apm) 1242 # hpcmips uses `apmdev_chr' instead of `apm_chr' 1243 mkdev apm c %apmdev_chr% 0 644 1244 mkdev apmctl c %apmdev_chr% 8 644 1245 ;; 1246 1247satlink*) 1248 unit=${i#satlink} 1249 mkdev satlink$unit c %satlink_chr% $unit 444 1250 ;; 1251 1252random) 1253 mkdev random c %rnd_chr% 0 444 1254 mkdev urandom c %rnd_chr% 1 644 1255 ;; 1256 1257cfs) 1258 makedev cfs0 1259 ;; 1260 1261cfs*) 1262 unit=${i#cfs} 1263 mkdev cfs$unit c %vcoda_chr% $unit 1264 ;; 1265 1266sysmon) 1267 mkdev sysmon c %sysmon_chr% 0 644 1268 mkdev watchdog c %sysmon_chr% 1 644 1269 mkdev power c %sysmon_chr% 2 640 1270 ;; 1271 1272scsibus*) 1273 unit=${i#scsibus} 1274 mkdev scsibus$unit c %scsibus_chr% $unit 644 1275 ;; 1276 1277bktr) 1278 makedev bktr0 bktr1 1279 lndev bktr0 bktr 1280 lndev tuner0 tuner 1281 lndev vbi0 vbi 1282 ;; 1283 1284bktr*) 1285 unit=${i#bktr} 1286 mkdev bktr$unit c %bktr_chr% $(($unit + 0)) 444 1287 mkdev tuner$unit c %bktr_chr% $(($unit + 16)) 444 1288 mkdev vbi$unit c %bktr_chr% $(($unit + 32)) 444 1289 ;; 1290 1291io) 1292 mkdev io c %mem_chr% 14 600 1293 ;; 1294 1295iop*) 1296 unit=${i#iop} 1297 mkdev iop$unit c %iop_chr% $unit 1298 ;; 1299 1300mlx*) 1301 unit=${i#mlx} 1302 mkdev mlx$unit c %mlx_chr% $unit 1303 ;; 1304 1305mly*) 1306 unit=${i#mly} 1307 mkdev mly$unit c %mly_chr% $unit 1308 ;; 1309 1310twa*) 1311 unit=${i#twa} 1312 mkdev twa$unit c %twa_chr% $unit 1313 ;; 1314 1315twe*) 1316 unit=${i#twe} 1317 mkdev twe$unit c %twe_chr% $unit 1318 ;; 1319 1320icp*) 1321 unit=${i#icp} 1322 mkdev icp$unit c %icp_chr% $unit 1323 ;; 1324 1325agp*) 1326 unit=${i#agp} 1327 mkdev agp$unit c %agp_chr% $unit 644 1328 if [ "$unit" = "0" ]; then 1329 lndev agp$unit agpgart 1330 fi 1331 ;; 1332 1333pci*) 1334 unit=${i#pci} 1335 mkdev pci$unit c %pci_chr% $unit 644 1336 ;; 1337 1338dpti*) 1339 unit=${i#dpti} 1340 mkdev dpti$unit c %dpti_chr% $unit 1341 ;; 1342 1343dpt*) 1344 unit=${i#dpt} 1345 mkdev dpt$unit c %dpt_chr% $unit 1346 ;; 1347 1348altq) 1349 makedir altq 755 1350 unit=0 1351 for dev in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq 1352 do 1353 mkdev altq/$dev c %altq_chr% $unit 644 1354 unit=$(($unit + 1)) 1355 done 1356 ;; 1357 1358isdn) 1359 mkdev isdn c %isdn_chr% 0 1360 ;; 1361 1362isdnctl) 1363 mkdev isdnctl c %isdnctl_chr% 0 1364 ;; 1365 1366isdnbchan*) 1367 unit=${i#isdnbchan} 1368 mkdev isdnbchan$unit c %isdnbchan_chr% $unit 1369 ;; 1370 1371isdnteld*) 1372 unit=${i#isdnteld} 1373 mkdev isdnteld$unit c %isdntel_chr% $(($unit + 64)) 1374 ;; 1375 1376isdntel*) 1377 unit=${i#isdntel} 1378 mkdev isdntel$unit c %isdntel_chr% $unit 1379 ;; 1380 1381isdntrc*) 1382 unit=${i#isdntrc} 1383 mkdev isdntrc$unit c %isdntrc_chr% $unit 1384 ;; 1385 1386vmegen) 1387 makedev vmegen0 vmegen1 vmegen2 vmegen3 1388 ;; 1389 1390vmegen*) 1391 unit=${i#vmegen} 1392 mkdev vmegen$unit c %vmegeneric_chr% $(($unit * 16 + 0)) 1393 ;; 1394 1395wsfont) 1396 mkdev wsfont c %wsfont_chr% 0 1397 ;; 1398 1399cir*) 1400 unit=${i#cir} 1401 mkdev cir$unit c %cir_chr% $unit 666 1402 ;; 1403 1404irframe*) 1405 unit=${i#irframe} 1406 mkdev irframe$unit c %irframe_chr% $unit 1407 ;; 1408 1409fcom*) 1410 unit=${i#fcom} 1411 mkdev fcom$unit c %fcom_chr% $unit "" "" $u_uucp 1412 ;; 1413 1414openfirm) 1415 mkdev openfirm c %openfirm_chr% 0 444 1416 ;; 1417 1418pad*) 1419 unit=${i#pad} 1420 mkdev pad$unit c %pad_chr% $unit 444 1421 ;; 1422 1423nvram) 1424 mkdev nvram c %nvram_chr% 0 644 1425 ;; 1426 1427rtc) 1428 mkdev rtc c %rtc_chr% 0 644 1429 ;; 1430 1431clockctl) 1432 mkdev clockctl c %clockctl_chr% 0 660 $g_ntpd 1433 ;; 1434 1435nsmb) 1436 makedev nsmb0 nsmb1 nsmb2 nsmb3 1437 ;; 1438 1439nsmb*) 1440 unit=${i#nsmb} 1441 mkdev nsmb$unit c %nsmb_chr% $unit 644 1442 ;; 1443 1444systrace) 1445 mkdev systrace c %systrace_chr% 0 644 1446 ;; 1447 1448kttcp) 1449 mkdev kttcp c %kttcp_chr% 0 1450 ;; 1451 1452dmoverio) 1453 mkdev dmoverio c %dmoverio_chr% 0 644 1454 ;; 1455 1456veriexec) 1457 mkdev veriexec c %veriexec_chr% 0 600 1458 ;; 1459 1460ttyv*) 1461 unit=${i#ttyv} 1462 mkdev ttyv$unit c %pc_chr% $unit 1463 ;; 1464 1465# arm, acorn32 1466ttyv*) 1467 unit=${i#ttyv} 1468 mkdev ttyv$unit c %physcon_chr% $unit 1469 ;; 1470 1471arcpp*) 1472 unit=${i#arcpp} 1473 mkdev arcpp$unit c %arcpp_chr% $unit 1474 ;; 1475 1476par*) 1477 unit=${i#par} 1478 case $unit in 1479 0) 1480 mkdev par$unit c %par_chr% $unit 1481 ;; 1482 *) 1483 warn "bad unit for par in: $i" 1484 ;; 1485 esac 1486 ;; 1487 1488ite*|ttye*) 1489 case $i in 1490 ite*) unit=${i#ite};; 1491 ttye*) unit=${i#ttye};; 1492 esac 1493 mkdev ttye$unit c %ite_chr% $unit 1494 ;; 1495 1496pms*) 1497 unit=${i#pms} 1498 mkdev pms$unit c %opms_chr% $unit 1499 ;; 1500 1501qms*) 1502 unit=${i#qms} 1503 mkdev qms$unit c %qms_chr% $unit 1504 ;; 1505 1506lms*) 1507 unit=${i#lms} 1508 mkdev lms$unit c %lms_chr% $unit 1509 ;; 1510 1511mms*) 1512 unit=${i#mms} 1513 mkdev mms$unit c %mms_chr% $unit 1514 ;; 1515 1516mouse-*) 1517 case $i in 1518 mouse-pms*) name=pms ;; 1519 mouse-qms*) name=qms ;; 1520 esac 1521 unit=${i#mouse-${name}} 1522 lndev $name$unit mouse 1523 ;; 1524 1525kbd) 1526 mkdev kbd c %kbd_chr% 0 1527 ;; 1528 1529kbdctl) 1530 mkdev kbdctl c %kbd_chr% 1 1531 ;; 1532 1533vidcconsole0) 1534 mkdev vidcconsole0 c %vidcconsole_chr% 0 640 1535 ;; 1536 1537view*) 1538 unit=${i#view} 1539 mkdev view$unit c %view_chr% $unit 666 1540 ;; 1541 1542mouse*) 1543 unit=${i#mouse} 1544 case $unit in 1545 0|1) 1546 mkdev mouse$unit c %ms_chr% $unit 666 1547 if [ $unit = 0 ]; then 1548 lndev mouse$unit mouse 1549 fi 1550 ;; 1551 *) 1552 warn "bad unit for mouse in: $i" 1553 ;; 1554 esac 1555 ;; 1556 1557panel) 1558 mkdev panel0 c %panel_chr% 0 660 1559 ;; 1560 1561tslcd) 1562 mkdev tslcd0 c %tslcd_chr% 0 660 1563 ;; 1564 1565ipty) 1566 mkdev ttyp0 c %pts_chr% 0 666 1567 mkdev ttyp1 c %pts_chr% 1 666 1568 mkdev ptyp0 c %ptc_chr% 0 666 1569 mkdev ptyp1 c %ptc_chr% 1 666 1570 ;; 1571 1572ptm) 1573 mkdev ptmx c %ptm_chr% 0 666 1574 mkdev ptm c %ptm_chr% 1 666 1575 ;; 1576 1577grf*) 1578 unit=${i#grf} 1579 mkdev grf$unit c %grf_chr% $unit 666 1580 ;; 1581 1582etvme) 1583 mkdev etvme c %et_chr% 0 1584 ;; 1585 1586leo*) 1587 unit=${i#leo} 1588 mkdev leo$unit c %leo_chr% $unit 1589 ;; 1590 1591scif*) 1592 unit=${i#scif} 1593 mkdev scif$unit c %scif_chr% $unit "" "" $u_uucp 1594 ;; 1595 1596sci*) 1597 unit=${i#sci} 1598 mkdev sci$unit c %sci_chr% $unit "" "" $u_uucp 1599 ;; 1600 1601maple*) 1602 case $i in 1603 mapleA*) name="mapleA"; unit=0;; 1604 mapleB*) name="mapleB"; unit=1;; 1605 mapleC*) name="mapleC"; unit=2;; 1606 mapleD*) name="mapleD"; unit=3;; 1607 esac 1608 subunit=${i#$name} 1609 mkdev $name$subunit c %maple_chr% $(($unit * 8 + 0$subunit)) 1610 ;; 1611 1612mmem*) 1613 unit=${i#mmem} 1614 for pt in 0 # 1 2 3 4 ... 255 1615 do 1616# mkdev mmem${unit}.${pt}a b %mmem_blk% $(($unit * 4096 + $pt * 16 + 0)) 640 $g_operator 1617 mkdev mmem${unit}.${pt}c b %mmem_blk% $(($unit * 4096 + $pt * 16 + 2)) 640 $g_operator 1618# mkdev rmmem${unit}.${pt}a c %mmem_chr% $(($unit * 4096 + $pt * 16 + 0)) 640 $g_operator 1619 mkdev rmmem${unit}.${pt}c c %mmem_chr% $(($unit * 4096 + $pt * 16 + 2)) 640 $g_operator 1620 done 1621 ;; 1622 1623mlcd*) 1624 unit=${i#mlcd} 1625 for pt in 0 # 1 2 3 4 ... 255 1626 do 1627 mkdev mlcd${unit}.${pt} c %mlcd_chr% $(($unit * 256 + $pt)) 640 $g_operator 1628 done 1629 ;; 1630 1631ixpcom*) 1632 unit=${i#ixpcom} 1633 mkdev ixpcom$unit c %ixpcom_chr% $unit "" "" $u_uucp 1634 ;; 1635 1636epcom*) 1637 unit=${i#epcom} 1638 mkdev epcom$unit c %epcom_chr% $unit "" "" $u_uucp 1639 ;; 1640 1641ucbsnd) 1642 mkdev ucbsnd c %ucbsnd_chr% 0 666 1643 ;; 1644 1645adb) 1646 mkdev adb c %aed_chr% 0 666 1647 ;; 1648 1649asc*) 1650 unit=${i#asc} 1651 mkdev asc$unit c %asc_chr% $unit 666 1652 ;; 1653 1654bwtwo*) 1655 unit=${i#bwtwo} 1656 mkdev bwtwo$unit c %bwtwo_chr% $unit 666 1657 ;; 1658 1659cgtwo*) 1660 unit=${i#cgtwo} 1661 mkdev cgtwo$unit c %cgtwo_chr% $unit 666 1662 ;; 1663 1664cgthree*) 1665 unit=${i#cgthree} 1666 mkdev cgthree$unit c %cgthree_chr% $unit 666 1667 ;; 1668 1669cgfour*) 1670 unit=${i#cgfour} 1671 mkdev cgfour$unit c %cgfour_chr% $unit 666 1672 ;; 1673 1674cgsix*) 1675 unit=${i#cgsix} 1676 mkdev cgsix$unit c %cgsix_chr% $unit 666 1677 ;; 1678 1679cgeight*) 1680 unit=${i#cgeight} 1681 mkdev cgeight$unit c %cgeight_chr% $unit 666 1682 ;; 1683 1684tcx*) 1685 unit=${i#tcx} 1686 mkdev tcx$unit c %tcx_chr% $unit 666 1687 ;; 1688 1689xd*|xy*) 1690 case $i in 1691 xd*) name=xd; unit=${i#xd}; blk=%xd_blk%; chr=%xd_chr%;; 1692 xy*) name=xy; unit=${i#xy}; blk=%xy_blk%; chr=%xy_chr%;; 1693 esac 1694 %MKDISK% $name $unit $blk $chr 1695 ;; 1696 1697magma*) 1698 unit=${i#magma} 1699 if [ 0$unit -gt 3 ]; then 1700 warn "bad unit for $i: $unit" 1701 break 1702 fi 1703 for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f 1704 do 1705 case $j in 1706 [0-9]) jn=$j ;; 1707 a) jn=10 ;; 1708 b) jn=11 ;; 1709 c) jn=12 ;; 1710 d) jn=13 ;; 1711 e) jn=14 ;; 1712 f) jn=15 ;; 1713 esac 1714 mkdev tty$unit$j c %mtty_chr% $(($unit * 64 + $jn)) 1715 done 1716 mkdev bpp${unit}0 c %mbpp_chr% $(($unit * 64 + 0)) 1717 mkdev bpp${unit}1 c %mbpp_chr% $(($unit * 64 + 1)) 1718 ;; 1719 1720clcd*) 1721 unit=${i#clcd} 1722 if [ 0$unit -gt 7 ]; then 1723 warn "bad unit for $i: $unit" 1724 break 1725 fi 1726 for j in 0 1 2 3 4 5 6 7 1727 do 1728 mkdev ttyA$unit$j c %clcd_chr% $(($unit * 8 + $j + $dialin)) "" "" $u_uucp 1729 mkdev dtyA$unit$j c %clcd_chr% $(($unit * 8 + $j + $dialout)) "" "" $u_uucp 1730 done 1731 ;; 1732 1733spif*) 1734 unit=${i#spif} 1735 if [ 0$unit -gt 3 ]; then 1736 warn "bad unit for $i: $unit" 1737 break 1738 fi 1739 for j in 0 1 2 3 4 5 6 7; do 1740 mkdev ttyS$unit$j c 102 $(($unit * 64 + $j)) "" "" $u_uucp 1741 done 1742 mkdev bppS${unit}0 c 103 $(($unit * 64 + 0)) 1743 mkdev bppS${unit}1 c 103 $(($unit * 64 + 1)) 1744 ;; 1745 1746bpp*) 1747 unit=${i#bpp} 1748 mkdev bpp$unit c %bpp_chr% $(($unit + 0)) 1749 ;; 1750 1751tctrl*) 1752 unit=${i#tctrl} 1753 mkdev tctrl$unit c %tctrl_chr% $unit 666 1754 ;; 1755 1756bmd*) 1757 unit=${i#bmd} 1758 mkdev bmd${unit}a b %bmd_blk% $(($unit * 8 + 0)) 640 $g_operator 1759 mkdev bmd${unit}c b %bmd_blk% $(($unit * 8 + 2)) 640 $g_operator 1760 mkdev rbmd${unit}a c %bmd_chr% $(($unit * 8 + 0)) 640 $g_operator 1761 mkdev rbmd${unit}c c %bmd_chr% $(($unit * 8 + 2)) 640 $g_operator 1762 ;; 1763 1764sram) 1765 mkdev sram c %sram_chr% 0 644 1766 ;; 1767 1768pow*) 1769 unit=${i#pow} 1770 case $unit in 1771 0|1) 1772 mkdev pow${unit} c %pow_chr% ${unit} 644 1773 if [ $unit = 0 ]; then 1774 lndev pow${unit} pow 1775 fi 1776 ;; 1777 *) 1778 warn "bad unit for pow in: $i" 1779 ;; 1780 esac 1781 ;; 1782 1783ttyS*) 1784 unit=${i#ttyS} 1785 mkdev ttyS$unit c %sacom_chr% $(($unit + $dialin )) "" "" $u_uucp 1786 mkdev dtyS$unit c %sacom_chr% $(($unit + $dialout)) "" "" $u_uucp 1787 ;; 1788 1789atabus*) 1790 unit=${i#atabus} 1791 mkdev atabus$unit c %atabus_chr% $unit 644 1792 ;; 1793 1794drvctl) 1795 mkdev drvctl c %drvctl_chr% 0 644 1796 ;; 1797 1798tap*) 1799 unit=${i#tap} 1800 case "$unit" in 1801 [0-9]*) 1802 mkdev tap${unit} c %tap_chr% ${unit} 600 1803 ;; 1804 *) 1805 mkdev tap c %tap_chr% 0xfffff 600 1806 ;; 1807 esac 1808 ;; 1809 1810fw*) 1811 unit=${i#fw} 1812 for j in 0 1 2 3 1813 do 1814 mkdev fw${unit}.${j} c %fw_chr% $((${unit} * 256 + ${j})) 660 ${g_operator} 1815 mkdev fwmem${unit}.${j} c %fw_chr% $((65536 + ${unit} * 256 + ${j})) 660 ${g_operator} 1816 done 1817 ;; 1818 1819# create putter device and symlinks for all subsystems using it 1820putter) 1821 mkdev putter c %putter_chr% 0 600 1822 mkdev pud c %putter_chr% 1 600 1823 lndev putter puffs 1824 ;; 1825 1826midevend) 1827%MI_DEVICES_END% 1828local) 1829 if [ -f "$0.local" ]; then 1830 umask 0 1831 if [ -n "$count_nodes" ]; then 1832 count_nodes=$((count_nodes + \ 1833 $(linecount "$(sh "$0.local" $opts -s all)") )) 1834 else 1835 sh "$0.local" $opts all 1836 fi 1837 umask 077 1838 else 1839 warn "missing $0.local" 1840 fi 1841 ;; 1842 1843*) 1844 warn "$i: unknown device" 1845 ;; 1846 1847esac 1848done 1849 1850} 1851 1852 1853# three variants of disk partitions - max 8, max 16, max 16 with highpartoffset 1854# hack; only the one used by port is retained in final MAKEDEV script 1855# routine is called as: 1856# makedisk name unit blk chr 1857makedisk_p8() 1858{ 1859 name="$1"; unit="$2"; blk="$3"; chr="$4" 1860 1861 mkdev ${name}${unit}a b $blk $(($unit * 8 + 0)) 640 $g_operator 1862 mkdev ${name}${unit}b b $blk $(($unit * 8 + 1)) 640 $g_operator 1863 mkdev ${name}${unit}c b $blk $(($unit * 8 + 2)) 640 $g_operator 1864 mkdev ${name}${unit}d b $blk $(($unit * 8 + 3)) 640 $g_operator 1865 mkdev ${name}${unit}e b $blk $(($unit * 8 + 4)) 640 $g_operator 1866 mkdev ${name}${unit}f b $blk $(($unit * 8 + 5)) 640 $g_operator 1867 mkdev ${name}${unit}g b $blk $(($unit * 8 + 6)) 640 $g_operator 1868 mkdev ${name}${unit}h b $blk $(($unit * 8 + 7)) 640 $g_operator 1869 mkdev r${name}${unit}a c $chr $(($unit * 8 + 0)) 640 $g_operator 1870 mkdev r${name}${unit}b c $chr $(($unit * 8 + 1)) 640 $g_operator 1871 mkdev r${name}${unit}c c $chr $(($unit * 8 + 2)) 640 $g_operator 1872 mkdev r${name}${unit}d c $chr $(($unit * 8 + 3)) 640 $g_operator 1873 mkdev r${name}${unit}e c $chr $(($unit * 8 + 4)) 640 $g_operator 1874 mkdev r${name}${unit}f c $chr $(($unit * 8 + 5)) 640 $g_operator 1875 mkdev r${name}${unit}g c $chr $(($unit * 8 + 6)) 640 $g_operator 1876 mkdev r${name}${unit}h c $chr $(($unit * 8 + 7)) 640 $g_operator 1877} 1878 1879makedisk_p16() 1880{ 1881 name="$1"; unit="$2"; blk="$3"; chr="$4" 1882 1883 mkdev ${name}${unit}a b $blk $(($unit * 16 + 0)) 640 $g_operator 1884 mkdev ${name}${unit}b b $blk $(($unit * 16 + 1)) 640 $g_operator 1885 mkdev ${name}${unit}c b $blk $(($unit * 16 + 2)) 640 $g_operator 1886 mkdev ${name}${unit}d b $blk $(($unit * 16 + 3)) 640 $g_operator 1887 mkdev ${name}${unit}e b $blk $(($unit * 16 + 4)) 640 $g_operator 1888 mkdev ${name}${unit}f b $blk $(($unit * 16 + 5)) 640 $g_operator 1889 mkdev ${name}${unit}g b $blk $(($unit * 16 + 6)) 640 $g_operator 1890 mkdev ${name}${unit}h b $blk $(($unit * 16 + 7)) 640 $g_operator 1891 mkdev ${name}${unit}i b $blk $(($unit * 16 + 8)) 640 $g_operator 1892 mkdev ${name}${unit}j b $blk $(($unit * 16 + 9)) 640 $g_operator 1893 mkdev ${name}${unit}k b $blk $(($unit * 16 + 10)) 640 $g_operator 1894 mkdev ${name}${unit}l b $blk $(($unit * 16 + 11)) 640 $g_operator 1895 mkdev ${name}${unit}m b $blk $(($unit * 16 + 12)) 640 $g_operator 1896 mkdev ${name}${unit}n b $blk $(($unit * 16 + 13)) 640 $g_operator 1897 mkdev ${name}${unit}o b $blk $(($unit * 16 + 14)) 640 $g_operator 1898 mkdev ${name}${unit}p b $blk $(($unit * 16 + 15)) 640 $g_operator 1899 mkdev r${name}${unit}a c $chr $(($unit * 16 + 0)) 640 $g_operator 1900 mkdev r${name}${unit}b c $chr $(($unit * 16 + 1)) 640 $g_operator 1901 mkdev r${name}${unit}c c $chr $(($unit * 16 + 2)) 640 $g_operator 1902 mkdev r${name}${unit}d c $chr $(($unit * 16 + 3)) 640 $g_operator 1903 mkdev r${name}${unit}e c $chr $(($unit * 16 + 4)) 640 $g_operator 1904 mkdev r${name}${unit}f c $chr $(($unit * 16 + 5)) 640 $g_operator 1905 mkdev r${name}${unit}g c $chr $(($unit * 16 + 6)) 640 $g_operator 1906 mkdev r${name}${unit}h c $chr $(($unit * 16 + 7)) 640 $g_operator 1907 mkdev r${name}${unit}i c $chr $(($unit * 16 + 8)) 640 $g_operator 1908 mkdev r${name}${unit}j c $chr $(($unit * 16 + 9)) 640 $g_operator 1909 mkdev r${name}${unit}k c $chr $(($unit * 16 + 10)) 640 $g_operator 1910 mkdev r${name}${unit}l c $chr $(($unit * 16 + 11)) 640 $g_operator 1911 mkdev r${name}${unit}m c $chr $(($unit * 16 + 12)) 640 $g_operator 1912 mkdev r${name}${unit}n c $chr $(($unit * 16 + 13)) 640 $g_operator 1913 mkdev r${name}${unit}o c $chr $(($unit * 16 + 14)) 640 $g_operator 1914 mkdev r${name}${unit}p c $chr $(($unit * 16 + 15)) 640 $g_operator 1915} 1916 1917makedisk_p16high() 1918{ 1919 ho=524280 # offset for partition 9 to 16 1920 name="$1"; unit="$2"; blk="$3"; chr="$4" 1921 1922 mkdev ${name}${unit}a b $blk $(($unit * 8 + 0)) 640 $g_operator 1923 mkdev ${name}${unit}b b $blk $(($unit * 8 + 1)) 640 $g_operator 1924 mkdev ${name}${unit}c b $blk $(($unit * 8 + 2)) 640 $g_operator 1925 mkdev ${name}${unit}d b $blk $(($unit * 8 + 3)) 640 $g_operator 1926 mkdev ${name}${unit}e b $blk $(($unit * 8 + 4)) 640 $g_operator 1927 mkdev ${name}${unit}f b $blk $(($unit * 8 + 5)) 640 $g_operator 1928 mkdev ${name}${unit}g b $blk $(($unit * 8 + 6)) 640 $g_operator 1929 mkdev ${name}${unit}h b $blk $(($unit * 8 + 7)) 640 $g_operator 1930 mkdev ${name}${unit}i b $blk $(($unit * 8 + $ho + 8)) 640 $g_operator 1931 mkdev ${name}${unit}j b $blk $(($unit * 8 + $ho + 9)) 640 $g_operator 1932 mkdev ${name}${unit}k b $blk $(($unit * 8 + $ho + 10)) 640 $g_operator 1933 mkdev ${name}${unit}l b $blk $(($unit * 8 + $ho + 11)) 640 $g_operator 1934 mkdev ${name}${unit}m b $blk $(($unit * 8 + $ho + 12)) 640 $g_operator 1935 mkdev ${name}${unit}n b $blk $(($unit * 8 + $ho + 13)) 640 $g_operator 1936 mkdev ${name}${unit}o b $blk $(($unit * 8 + $ho + 14)) 640 $g_operator 1937 mkdev ${name}${unit}p b $blk $(($unit * 8 + $ho + 15)) 640 $g_operator 1938 mkdev r${name}${unit}a c $chr $(($unit * 8 + 0)) 640 $g_operator 1939 mkdev r${name}${unit}b c $chr $(($unit * 8 + 1)) 640 $g_operator 1940 mkdev r${name}${unit}c c $chr $(($unit * 8 + 2)) 640 $g_operator 1941 mkdev r${name}${unit}d c $chr $(($unit * 8 + 3)) 640 $g_operator 1942 mkdev r${name}${unit}e c $chr $(($unit * 8 + 4)) 640 $g_operator 1943 mkdev r${name}${unit}f c $chr $(($unit * 8 + 5)) 640 $g_operator 1944 mkdev r${name}${unit}g c $chr $(($unit * 8 + 6)) 640 $g_operator 1945 mkdev r${name}${unit}h c $chr $(($unit * 8 + 7)) 640 $g_operator 1946 mkdev r${name}${unit}i c $chr $(($unit * 8 + $ho + 8)) 640 $g_operator 1947 mkdev r${name}${unit}j c $chr $(($unit * 8 + $ho + 9)) 640 $g_operator 1948 mkdev r${name}${unit}k c $chr $(($unit * 8 + $ho + 10)) 640 $g_operator 1949 mkdev r${name}${unit}l c $chr $(($unit * 8 + $ho + 11)) 640 $g_operator 1950 mkdev r${name}${unit}m c $chr $(($unit * 8 + $ho + 12)) 640 $g_operator 1951 mkdev r${name}${unit}n c $chr $(($unit * 8 + $ho + 13)) 640 $g_operator 1952 mkdev r${name}${unit}o c $chr $(($unit * 8 + $ho + 14)) 640 $g_operator 1953 mkdev r${name}${unit}p c $chr $(($unit * 8 + $ho + 15)) 640 $g_operator 1954} 1955 1956# make only the very few basic disk device nodes - 'a' partition 1957# and raw partition 1958makedisk_minimal() 1959{ 1960 name=$1; unit=$2; blk=$3; chr=$4 1961 doff=%DISKMINOROFFSET% 1962 ro=%RAWDISK_OFF% 1963 rn=%RAWDISK_NAME% 1964 1965 mkdev ${name}${unit}a b $blk $(($unit * $doff + 0)) 640 $g_operator 1966 mkdev ${name}${unit}$rn b $blk $(($unit * $doff + $ro)) 640 $g_operator 1967 mkdev r${name}${unit}a c $chr $(($unit * $doff + 0)) 640 $g_operator 1968 mkdev r${name}${unit}$rn c $chr $(($unit * $doff + $ro)) 640 $g_operator 1969} 1970 1971# create_mfs_dev nodes 1972# Create a memory file system for a given number of device nodes, 1973# and mount it. Attempts to use mount_tmpfs, or falls back to 1974# mount_mfs. 1975# 1976# If do_redirect, then also redirect output to the console. 1977# 1978create_mfs_dev() 1979{ 1980 ndevnodes=${1-1200} 1981 dev_mountpoint=${PWD:-/dev} 1982 1983 # Number of inodes is the specified number of device nodes, plus 1984 # a margin to allow for extra device nodes created later. 1985 ninode=$((ndevnodes * 11 / 10)) 1986 # Add 2 reserved inodes (needed for both mfs and tmpfs), and round 1987 # up to a multiple of 32 (needed for mfs, not needed for tmpfs). 1988 ninode=$(( (ninode + 2 + 31) / 32 * 32 )) 1989 # This file system size calculation is exact for mount_mfs(8) 1990 # with 512-byte sectors; it's larger than necessary 1991 # for mount_tmpfs(8). 40960 bytes (80 blocks) is the minimum size 1992 # allowed by mount_mfs. 1993 fs_bytes=$((8192 + 2 * 8192 + 4096 + ninode*(128+18) + 8192)) 1994 [ "$fs_bytes" -lt 40960 ] && fs_bytes=40960 1995 fs_blocks=$((fs_bytes/512)) 1996 1997 # Try tmpfs; if that fails try mfs. 1998 if mount_tmpfs -s $fs_bytes -n $ninode -m 07555 \ 1999 -o union tmpfs "$dev_mountpoint" 2000 then 2001 fstype=tmpfs 2002 elif mount_mfs -b 4096 -f 512 -s $fs_blocks -n $ninode -p 07555 \ 2003 -o union swap "$dev_mountpoint" 2004 then 2005 fstype=mfs 2006 else 2007 warn "Failed to create memory file system" 2008 exit 1 2009 fi 2010 2011 # Our current directory was in the lower file system; change it to 2012 # the newly mounted upper file system. 2013 cd "$dev_mountpoint" 2014 2015 if $do_redirect; then 2016 # Redirect stdout and stderr to console 2017 mknod -m 600 -g 0 -u 0 temp_console c 0 0 2018 exec >temp_console 2>&1 2019 rm temp_console 2020 fi 2021 2022 echo "Created $fstype $dev_mountpoint" \ 2023 "($fs_blocks blocks, $ninode inodes)" 2024} 2025 2026# 2027# MAIN: If MAKEDEV_AS_LIBRARY is set, then we are being used as a 2028# function library, so just return. Otherwise, do all the real work. 2029# 2030[ -n "${MAKEDEV_AS_LIBRARY}" ] && return 2031makedev_main makedev ${1+"$@"} 2032