MAKEDEV.tmpl revision 1.87.2.2
1#!/bin/sh - 2# $NetBSD: MAKEDEV.tmpl,v 1.87.2.2 2008/01/09 01:29:49 matt 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# tap* virtual Ethernet device 283# tun* network tunnel driver 284# twa 3ware Apache control interface 285# twe 3ware Escalade control interface 286# uk* unknown SCSI device 287# veriexec verified executable fingerprint loader 288# vmegen* generic VME access 289# view* generic interface to graphic displays (Amiga) 290# wsfont* console font control 291# wsmux* wscons event multiplexor 292# xenevt Xen event interface 293 294 295# 296# Apart from a few lines right at the end, this file should consist 297# entirely of function definitions. 298# 299# This file is used both as a standalone script (via "sh ./MAKEDEV all" 300# or similar), and as a function library (via "MAKEDEV_AS_LIBRARY=1 . 301# MAKEDEV" from MAKEDEV.local). 302# 303 304usage() 305{ 306 cat 1>&2 << _USAGE_ 307Usage: ${0##*/} [-fMs] [-m mknod] [-p pax] special [...] 308 Create listed special devices. Options: 309 -f Force permissions to be updated on existing devices. 310 -M Create memory file system. 311 -m mknod Name of mknod(8) program. [\$TOOL_MKNOD or mknod] 312 -p pax Name of pax(2) program. [\$TOOL_PAX or pax] 313 -s Generate mtree(8) specfile instead of creating devices. 314 315_USAGE_ 316 exit 1 317} 318 319# zeropad width number 320# display number with a zero (`0') padding of width digits. 321# 322zeropad() 323{ 324 case $(($1 - ${#2})) in 325 5) echo 00000$2;; 326 4) echo 0000$2;; 327 3) echo 000$2;; 328 2) echo 00$2;; 329 1) echo 0$2;; 330 0) echo $2;; 331 *) echo "$0: bad padding" 1>&2; exit 1;; 332 esac 333} 334 335# hexprint number 336# display (base10) number as hexadecimal 337# 338hexprint() 339{ 340 val="$(($1 + 0))" 341 hex= 342 set -- 0 1 2 3 4 5 6 7 8 9 a b c d e f 343 while [ "$val" -gt 0 ]; do 344 eval hex=\$$(($val % 16 + 1))\$hex 345 val="$(($val / 16))" 346 done 347 echo "${hex:-0}" 348} 349 350# linecount multiline_string 351# count the number of lines in the string 352# 353linecount() 354{ 355 local IFS=' 356' # just a newline, no other white space between the quotes 357 set -- $1 358 echo $# 359} 360 361# nooutput -12 cmd [args...] 362# run a command with stdout and/or stderr ignored. 363# "nooutput -2 cmd" is like "cmd 2>/dev/null", 364# except it should work even if /dev/null doesn't [yet] exist. 365# 366nooutput() 367{ 368 local flags="$1" ; shift 369 local junk 370 case "$flags" in 371 "-1") junk="$( "$@" )" ;; 372 "-2") exec 4>&1 ; junk="$( "$@" 2>&1 1>&4 )" ; exec 4>&- ;; 373 "-12") junk="$( "$@" 2>&1 )" ;; 374 *) warn "Incorrect use of nooutput" ;; 375 esac 376} 377 378# check_pax path_to_pax 379# Check whether pax supports the command line options we 380# will want to use. 381# 382check_pax() 383{ 384 local pax="$1" 385 echo ". type=dir optional" | nooutput -12 "${pax}" -r -w -M -pe . 386} 387 388# setup args... 389# Parse command line arguments, exit on error. 390# Callers should shift $((OPTIND - 1)) afterwards. 391# 392setup() 393{ 394 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/rescue 395 396 do_create_mfs=false 397 do_force=false 398 do_mknod=false 399 do_pax=false 400 do_redirect=false 401 do_specfile=false 402 opts= 403 while getopts Mfm:p:s ch; do 404 # Options that should not be passed through to 405 # MAKEDEV.local are not added to $opts. 406 case ${ch} in 407 M) 408 # "-M" sets do_create_mfs; 409 # "-M -M" is for use from init(8), and sets do_redirect 410 do_redirect=$do_create_mfs 411 do_create_mfs=true 412 ;; 413 f) do_force=true 414 opts="${opts} -f" 415 ;; 416 m) TOOL_MKNOD=${OPTARG} 417 do_mknod=true 418 opts="${opts} -m ${OPTARG}" 419 ;; 420 p) TOOL_PAX="${OPTARG}" 421 if check_pax "${TOOL_PAX}"; then 422 do_pax=true 423 # do not add this to $opts; we will later 424 # add "-s" instead. 425 else 426 warn "Ignored -p option:" \ 427 "${TOOL_PAX} is missing or broken" 428 do_mknod=true 429 fi 430 ;; 431 s) do_specfile=true 432 opts="${opts} -s" 433 ;; 434 *) usage ;; 435 esac 436 done 437 438 shift $((${OPTIND} - 1)) 439 [ $# -gt 0 ] || usage 440 441 u_root="%uid_root%" 442 u_uucp="%uid_uucp%" 443 g_kmem="%gid_kmem%" 444 g_ntpd="%gid_ntpd%" 445 g_operator="%gid_operator%" 446 g_wheel="%gid_wheel%" 447 dialin=0 448 dialout=524288 449 callunit=262144 450 451 # only allow read&write for owner by default 452 umask 077 453 454 # Check if we have fdesc mounted 455 if [ -d fd ]; then 456 case "$(df fd)" in 457 *fdesc*) nofdesc=false;; 458 *) nofdesc=true;; 459 esac 460 else 461 nofdesc=true 462 fi 463 464 # do_force requires mknod 465 if $do_force; then 466 if $do_pax || $do_specfile; then 467 warn "-f option works only with mknod" 468 exit 1 469 fi 470 do_mknod=true 471 fi 472 473 # If no other options take precedence, then default to 474 # using pax, if it appears to work. 475 if ! $do_mknod && ! $do_specfile && ! $do_pax; then 476 : ${TOOL_PAX:=pax} 477 if check_pax "${TOOL_PAX}"; then 478 do_pax=true 479 else 480 do_mknod=true 481 fi 482 fi 483 484 # Now we need exactly one of do_pax, do_mknod, or do_specfile. 485 case $(( $($do_pax && echo 1 || echo 0) + \ 486 $($do_mknod && echo 1 || echo 0) + \ 487 $($do_specfile && echo 1 || echo 0) )) 488 in 489 1) : OK ;; 490 *) 491 warn "-m, -p, and -s options are mutually exclusive" 492 exit 1 493 ;; 494 esac 495 496 # If we are using mknod, then decide what options to pass it. 497 if $do_mknod; then 498 MKNOD="${TOOL_MKNOD:-mknod} -F netbsd" 499 if $do_force; then 500 MKNOD="${MKNOD} -R" 501 else 502 MKNOD="${MKNOD} -r" 503 fi 504 fi 505 506 # do_pax internally implies do_specfile. This happens after 507 # checking for mutually-exclusive options. 508 if $do_pax && ! $do_specfile; then 509 do_specfile=true 510 opts="${opts} -s" 511 fi 512} 513 514# wrap_makedev makedev_name ... 515# Invoke a makedev-like function, with additional processing 516# as appropriate for use from the outer level. 517# 518wrap_makedev() 519{ 520 if $do_specfile; then 521 # "optional" tells pax(1) not to create the directory itself. 522 echo ". type=dir optional" 523 fi 524 "$@" 525} 526 527# makedev_main makedev_name args... 528# Perform most of the work of the main program. makedev_name is 529# the name of a makedev-like function, and the other args are 530# command line args with which the MAKEDEV (or MAKEDEV.local) 531# script was invoked. 532# 533makedev_main() 534{ 535 local makedev="$1" ; shift 536 537 # Parse command line args 538 setup ${1+"$@"} 539 shift $((${OPTIND}-1)) 540 541 if $do_create_mfs; then 542 # Count inodes and create mfs file system. 543 # The makedev call merely updates $count_nodes. 544 count_nodes=0 545 $makedev ${1+"$@"} 546 create_mfs_dev $count_nodes 547 unset count_nodes 548 fi 549 550 if $do_pax ; then 551 # wrap_makedev will print an mtree specification because 552 # do_pax implies do_specfile. pax will create device nodes. 553 wrap_makedev $makedev ${1+"$@"} | ${TOOL_PAX} -r -w -M -pe . 554 else 555 wrap_makedev $makedev ${1+"$@"} 556 fi 557} 558 559# 560# functions available to create nodes: 561# 562# mkdev name [b|c] major minor [mode{=600} [gid{=0} [uid{=0}]]] 563# create device node `name' with the appropriate permissions 564# 565# lndev src target 566# create a symlink from src to target 567# 568# makedir dir mode 569# create directory with appropriate mode 570# 571 572mkdev() 573{ 574 if [ -n "$count_nodes" ]; then 575 count_nodes=$((count_nodes + 1)) 576 return 577 fi 578 if $do_specfile; then 579 case $2 in 580 b) type=block ;; 581 c) type=char ;; 582 esac 583 echo "./$1 type=${type} device=netbsd,$3,$4 mode=${5:-600} gid=${6:-$g_wheel} uid=${7:-$u_root}" 584 else 585 ${MKNOD} -m ${5:-600} -g \#${6:-$g_wheel} -u \#${7:-$u_root} $1 $2 $3 $4 586 fi 587} 588 589lndev() 590{ 591 if [ -n "$count_nodes" ]; then 592 count_nodes=$((count_nodes + 1)) 593 return 594 fi 595 if $do_specfile; then 596 echo "./$2 type=link link=$1 mode=0700 gid=$g_wheel uid=$u_root" 597 else 598 ln -f -s $1 $2 599 fi 600} 601 602makedir() 603{ 604 if [ -n "$count_nodes" ]; then 605 count_nodes=$((count_nodes + 1)) 606 return 607 fi 608 if $do_specfile; then 609 echo "./$1 type=dir mode=$2 gid=$g_wheel uid=$u_root" 610 else 611 nooutput -2 mkdir $1 612 chmod $2 $1 613 fi 614} 615 616warn() 617{ 618 echo 1>&2 "$0: $*" 619} 620 621# makedev special [...] 622# the main loop 623# 624makedev() 625{ 626 627for i 628do 629 630case $i in 631 632%MD_DEVICES% 633 634all) 635 makedev all_md 636 makedev std fd ptm pty0 pty1 pty2 pty3 637 makedev ccd0 ccd1 ccd2 ccd3 638 makedev cgd0 cgd1 cgd2 cgd3 639 makedev fss0 fss1 fss2 fss3 640 makedev md0 md1 641 makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7 642 makedev vnd0 vnd1 vnd2 vnd3 643 makedev bpf 644 makedev tun0 tun1 tun2 tun3 645 makedev ipl pf crypto random 646 makedev lkm lockstat clockctl cpuctl 647 makedev atabus0 atabus1 atabus2 atabus3 648 makedev tap tap0 tap1 tap2 tap3 649 makedev gpio gpio0 gpio1 gpio2 gpio3 gpio4 gpio5 gpio6 gpio7 650 makedev pad pad0 pad1 pad2 pad3 651 makedev bthub 652 makedev cfs 653 makedev putter 654 makedev drvctl 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 1444kttcp) 1445 mkdev kttcp c %kttcp_chr% 0 1446 ;; 1447 1448dmoverio) 1449 mkdev dmoverio c %dmoverio_chr% 0 644 1450 ;; 1451 1452veriexec) 1453 mkdev veriexec c %veriexec_chr% 0 600 1454 ;; 1455 1456ttyv*) 1457 unit=${i#ttyv} 1458 mkdev ttyv$unit c %pc_chr% $unit 1459 ;; 1460 1461# arm, acorn32 1462ttyv*) 1463 unit=${i#ttyv} 1464 mkdev ttyv$unit c %physcon_chr% $unit 1465 ;; 1466 1467arcpp*) 1468 unit=${i#arcpp} 1469 mkdev arcpp$unit c %arcpp_chr% $unit 1470 ;; 1471 1472par*) 1473 unit=${i#par} 1474 case $unit in 1475 0) 1476 mkdev par$unit c %par_chr% $unit 1477 ;; 1478 *) 1479 warn "bad unit for par in: $i" 1480 ;; 1481 esac 1482 ;; 1483 1484ite*|ttye*) 1485 case $i in 1486 ite*) unit=${i#ite};; 1487 ttye*) unit=${i#ttye};; 1488 esac 1489 mkdev ttye$unit c %ite_chr% $unit 1490 ;; 1491 1492pms*) 1493 unit=${i#pms} 1494 mkdev pms$unit c %opms_chr% $unit 1495 ;; 1496 1497qms*) 1498 unit=${i#qms} 1499 mkdev qms$unit c %qms_chr% $unit 1500 ;; 1501 1502lms*) 1503 unit=${i#lms} 1504 mkdev lms$unit c %lms_chr% $unit 1505 ;; 1506 1507mms*) 1508 unit=${i#mms} 1509 mkdev mms$unit c %mms_chr% $unit 1510 ;; 1511 1512mouse-*) 1513 case $i in 1514 mouse-pms*) name=pms ;; 1515 mouse-qms*) name=qms ;; 1516 esac 1517 unit=${i#mouse-${name}} 1518 lndev $name$unit mouse 1519 ;; 1520 1521kbd) 1522 mkdev kbd c %kbd_chr% 0 1523 ;; 1524 1525kbdctl) 1526 mkdev kbdctl c %kbd_chr% 1 1527 ;; 1528 1529vidcconsole0) 1530 mkdev vidcconsole0 c %vidcconsole_chr% 0 640 1531 ;; 1532 1533view*) 1534 unit=${i#view} 1535 mkdev view$unit c %view_chr% $unit 666 1536 ;; 1537 1538mouse*) 1539 unit=${i#mouse} 1540 case $unit in 1541 0|1) 1542 mkdev mouse$unit c %ms_chr% $unit 666 1543 if [ $unit = 0 ]; then 1544 lndev mouse$unit mouse 1545 fi 1546 ;; 1547 *) 1548 warn "bad unit for mouse in: $i" 1549 ;; 1550 esac 1551 ;; 1552 1553panel) 1554 mkdev panel0 c %panel_chr% 0 660 1555 ;; 1556 1557tslcd) 1558 mkdev tslcd0 c %tslcd_chr% 0 660 1559 ;; 1560 1561ipty) 1562 mkdev ttyp0 c %pts_chr% 0 666 1563 mkdev ttyp1 c %pts_chr% 1 666 1564 mkdev ptyp0 c %ptc_chr% 0 666 1565 mkdev ptyp1 c %ptc_chr% 1 666 1566 ;; 1567 1568ptm) 1569 mkdev ptmx c %ptm_chr% 0 666 1570 mkdev ptm c %ptm_chr% 1 666 1571 ;; 1572 1573grf*) 1574 unit=${i#grf} 1575 mkdev grf$unit c %grf_chr% $unit 666 1576 ;; 1577 1578etvme) 1579 mkdev etvme c %et_chr% 0 1580 ;; 1581 1582leo*) 1583 unit=${i#leo} 1584 mkdev leo$unit c %leo_chr% $unit 1585 ;; 1586 1587scif*) 1588 unit=${i#scif} 1589 mkdev scif$unit c %scif_chr% $unit "" "" $u_uucp 1590 ;; 1591 1592sci*) 1593 unit=${i#sci} 1594 mkdev sci$unit c %sci_chr% $unit "" "" $u_uucp 1595 ;; 1596 1597maple*) 1598 case $i in 1599 mapleA*) name="mapleA"; unit=0;; 1600 mapleB*) name="mapleB"; unit=1;; 1601 mapleC*) name="mapleC"; unit=2;; 1602 mapleD*) name="mapleD"; unit=3;; 1603 esac 1604 subunit=${i#$name} 1605 mkdev $name$subunit c %maple_chr% $(($unit * 8 + 0$subunit)) 1606 ;; 1607 1608mmem*) 1609 unit=${i#mmem} 1610 for pt in 0 # 1 2 3 4 ... 255 1611 do 1612# mkdev mmem${unit}.${pt}a b %mmem_blk% $(($unit * 4096 + $pt * 16 + 0)) 640 $g_operator 1613 mkdev mmem${unit}.${pt}c b %mmem_blk% $(($unit * 4096 + $pt * 16 + 2)) 640 $g_operator 1614# mkdev rmmem${unit}.${pt}a c %mmem_chr% $(($unit * 4096 + $pt * 16 + 0)) 640 $g_operator 1615 mkdev rmmem${unit}.${pt}c c %mmem_chr% $(($unit * 4096 + $pt * 16 + 2)) 640 $g_operator 1616 done 1617 ;; 1618 1619mlcd*) 1620 unit=${i#mlcd} 1621 for pt in 0 # 1 2 3 4 ... 255 1622 do 1623 mkdev mlcd${unit}.${pt} c %mlcd_chr% $(($unit * 256 + $pt)) 640 $g_operator 1624 done 1625 ;; 1626 1627ixpcom*) 1628 unit=${i#ixpcom} 1629 mkdev ixpcom$unit c %ixpcom_chr% $unit "" "" $u_uucp 1630 ;; 1631 1632epcom*) 1633 unit=${i#epcom} 1634 mkdev epcom$unit c %epcom_chr% $unit "" "" $u_uucp 1635 ;; 1636 1637ucbsnd) 1638 mkdev ucbsnd c %ucbsnd_chr% 0 666 1639 ;; 1640 1641adb) 1642 mkdev adb c %aed_chr% 0 666 1643 ;; 1644 1645asc*) 1646 unit=${i#asc} 1647 mkdev asc$unit c %asc_chr% $unit 666 1648 ;; 1649 1650bwtwo*) 1651 unit=${i#bwtwo} 1652 mkdev bwtwo$unit c %bwtwo_chr% $unit 666 1653 ;; 1654 1655cgtwo*) 1656 unit=${i#cgtwo} 1657 mkdev cgtwo$unit c %cgtwo_chr% $unit 666 1658 ;; 1659 1660cgthree*) 1661 unit=${i#cgthree} 1662 mkdev cgthree$unit c %cgthree_chr% $unit 666 1663 ;; 1664 1665cgfour*) 1666 unit=${i#cgfour} 1667 mkdev cgfour$unit c %cgfour_chr% $unit 666 1668 ;; 1669 1670cgsix*) 1671 unit=${i#cgsix} 1672 mkdev cgsix$unit c %cgsix_chr% $unit 666 1673 ;; 1674 1675cgeight*) 1676 unit=${i#cgeight} 1677 mkdev cgeight$unit c %cgeight_chr% $unit 666 1678 ;; 1679 1680tcx*) 1681 unit=${i#tcx} 1682 mkdev tcx$unit c %tcx_chr% $unit 666 1683 ;; 1684 1685xd*|xy*) 1686 case $i in 1687 xd*) name=xd; unit=${i#xd}; blk=%xd_blk%; chr=%xd_chr%;; 1688 xy*) name=xy; unit=${i#xy}; blk=%xy_blk%; chr=%xy_chr%;; 1689 esac 1690 %MKDISK% $name $unit $blk $chr 1691 ;; 1692 1693magma*) 1694 unit=${i#magma} 1695 if [ 0$unit -gt 3 ]; then 1696 warn "bad unit for $i: $unit" 1697 break 1698 fi 1699 for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f 1700 do 1701 case $j in 1702 [0-9]) jn=$j ;; 1703 a) jn=10 ;; 1704 b) jn=11 ;; 1705 c) jn=12 ;; 1706 d) jn=13 ;; 1707 e) jn=14 ;; 1708 f) jn=15 ;; 1709 esac 1710 mkdev tty$unit$j c %mtty_chr% $(($unit * 64 + $jn)) 1711 done 1712 mkdev bpp${unit}0 c %mbpp_chr% $(($unit * 64 + 0)) 1713 mkdev bpp${unit}1 c %mbpp_chr% $(($unit * 64 + 1)) 1714 ;; 1715 1716clcd*) 1717 unit=${i#clcd} 1718 if [ 0$unit -gt 7 ]; then 1719 warn "bad unit for $i: $unit" 1720 break 1721 fi 1722 for j in 0 1 2 3 4 5 6 7 1723 do 1724 mkdev ttyA$unit$j c %clcd_chr% $(($unit * 8 + $j + $dialin)) "" "" $u_uucp 1725 mkdev dtyA$unit$j c %clcd_chr% $(($unit * 8 + $j + $dialout)) "" "" $u_uucp 1726 done 1727 ;; 1728 1729spif*) 1730 unit=${i#spif} 1731 if [ 0$unit -gt 3 ]; then 1732 warn "bad unit for $i: $unit" 1733 break 1734 fi 1735 for j in 0 1 2 3 4 5 6 7; do 1736 mkdev ttyS$unit$j c 102 $(($unit * 64 + $j)) "" "" $u_uucp 1737 done 1738 mkdev bppS${unit}0 c 103 $(($unit * 64 + 0)) 1739 mkdev bppS${unit}1 c 103 $(($unit * 64 + 1)) 1740 ;; 1741 1742bpp*) 1743 unit=${i#bpp} 1744 mkdev bpp$unit c %bpp_chr% $(($unit + 0)) 1745 ;; 1746 1747tctrl*) 1748 unit=${i#tctrl} 1749 mkdev tctrl$unit c %tctrl_chr% $unit 666 1750 ;; 1751 1752bmd*) 1753 unit=${i#bmd} 1754 mkdev bmd${unit}a b %bmd_blk% $(($unit * 8 + 0)) 640 $g_operator 1755 mkdev bmd${unit}c b %bmd_blk% $(($unit * 8 + 2)) 640 $g_operator 1756 mkdev rbmd${unit}a c %bmd_chr% $(($unit * 8 + 0)) 640 $g_operator 1757 mkdev rbmd${unit}c c %bmd_chr% $(($unit * 8 + 2)) 640 $g_operator 1758 ;; 1759 1760sram) 1761 mkdev sram c %sram_chr% 0 644 1762 ;; 1763 1764pow*) 1765 unit=${i#pow} 1766 case $unit in 1767 0|1) 1768 mkdev pow${unit} c %pow_chr% ${unit} 644 1769 if [ $unit = 0 ]; then 1770 lndev pow${unit} pow 1771 fi 1772 ;; 1773 *) 1774 warn "bad unit for pow in: $i" 1775 ;; 1776 esac 1777 ;; 1778 1779ttyS*) 1780 unit=${i#ttyS} 1781 mkdev ttyS$unit c %sacom_chr% $(($unit + $dialin )) "" "" $u_uucp 1782 mkdev dtyS$unit c %sacom_chr% $(($unit + $dialout)) "" "" $u_uucp 1783 ;; 1784 1785atabus*) 1786 unit=${i#atabus} 1787 mkdev atabus$unit c %atabus_chr% $unit 644 1788 ;; 1789 1790drvctl) 1791 mkdev drvctl c %drvctl_chr% 0 644 1792 ;; 1793 1794tap*) 1795 unit=${i#tap} 1796 case "$unit" in 1797 [0-9]*) 1798 mkdev tap${unit} c %tap_chr% ${unit} 600 1799 ;; 1800 *) 1801 mkdev tap c %tap_chr% 0xfffff 600 1802 ;; 1803 esac 1804 ;; 1805 1806fw*) 1807 unit=${i#fw} 1808 for j in 0 1 2 3 1809 do 1810 mkdev fw${unit}.${j} c %fw_chr% $((${unit} * 256 + ${j})) 660 ${g_operator} 1811 mkdev fwmem${unit}.${j} c %fw_chr% $((65536 + ${unit} * 256 + ${j})) 660 ${g_operator} 1812 done 1813 ;; 1814 1815# create putter device and symlinks for all subsystems using it 1816putter) 1817 mkdev putter c %putter_chr% 0 600 1818 mkdev pud c %putter_chr% 1 600 1819 lndev putter puffs 1820 ;; 1821 1822midevend) 1823%MI_DEVICES_END% 1824local) 1825 if [ -f "$0.local" ]; then 1826 umask 0 1827 if [ -n "$count_nodes" ]; then 1828 count_nodes=$((count_nodes + \ 1829 $(linecount "$(sh "$0.local" $opts -s all)") )) 1830 else 1831 sh "$0.local" $opts all 1832 fi 1833 umask 077 1834 else 1835 warn "missing $0.local" 1836 fi 1837 ;; 1838 1839*) 1840 warn "$i: unknown device" 1841 ;; 1842 1843esac 1844done 1845 1846} 1847 1848 1849# three variants of disk partitions - max 8, max 16, max 16 with highpartoffset 1850# hack; only the one used by port is retained in final MAKEDEV script 1851# routine is called as: 1852# makedisk name unit blk chr 1853makedisk_p8() 1854{ 1855 name="$1"; unit="$2"; blk="$3"; chr="$4" 1856 1857 mkdev ${name}${unit}a b $blk $(($unit * 8 + 0)) 640 $g_operator 1858 mkdev ${name}${unit}b b $blk $(($unit * 8 + 1)) 640 $g_operator 1859 mkdev ${name}${unit}c b $blk $(($unit * 8 + 2)) 640 $g_operator 1860 mkdev ${name}${unit}d b $blk $(($unit * 8 + 3)) 640 $g_operator 1861 mkdev ${name}${unit}e b $blk $(($unit * 8 + 4)) 640 $g_operator 1862 mkdev ${name}${unit}f b $blk $(($unit * 8 + 5)) 640 $g_operator 1863 mkdev ${name}${unit}g b $blk $(($unit * 8 + 6)) 640 $g_operator 1864 mkdev ${name}${unit}h b $blk $(($unit * 8 + 7)) 640 $g_operator 1865 mkdev r${name}${unit}a c $chr $(($unit * 8 + 0)) 640 $g_operator 1866 mkdev r${name}${unit}b c $chr $(($unit * 8 + 1)) 640 $g_operator 1867 mkdev r${name}${unit}c c $chr $(($unit * 8 + 2)) 640 $g_operator 1868 mkdev r${name}${unit}d c $chr $(($unit * 8 + 3)) 640 $g_operator 1869 mkdev r${name}${unit}e c $chr $(($unit * 8 + 4)) 640 $g_operator 1870 mkdev r${name}${unit}f c $chr $(($unit * 8 + 5)) 640 $g_operator 1871 mkdev r${name}${unit}g c $chr $(($unit * 8 + 6)) 640 $g_operator 1872 mkdev r${name}${unit}h c $chr $(($unit * 8 + 7)) 640 $g_operator 1873} 1874 1875makedisk_p16() 1876{ 1877 name="$1"; unit="$2"; blk="$3"; chr="$4" 1878 1879 mkdev ${name}${unit}a b $blk $(($unit * 16 + 0)) 640 $g_operator 1880 mkdev ${name}${unit}b b $blk $(($unit * 16 + 1)) 640 $g_operator 1881 mkdev ${name}${unit}c b $blk $(($unit * 16 + 2)) 640 $g_operator 1882 mkdev ${name}${unit}d b $blk $(($unit * 16 + 3)) 640 $g_operator 1883 mkdev ${name}${unit}e b $blk $(($unit * 16 + 4)) 640 $g_operator 1884 mkdev ${name}${unit}f b $blk $(($unit * 16 + 5)) 640 $g_operator 1885 mkdev ${name}${unit}g b $blk $(($unit * 16 + 6)) 640 $g_operator 1886 mkdev ${name}${unit}h b $blk $(($unit * 16 + 7)) 640 $g_operator 1887 mkdev ${name}${unit}i b $blk $(($unit * 16 + 8)) 640 $g_operator 1888 mkdev ${name}${unit}j b $blk $(($unit * 16 + 9)) 640 $g_operator 1889 mkdev ${name}${unit}k b $blk $(($unit * 16 + 10)) 640 $g_operator 1890 mkdev ${name}${unit}l b $blk $(($unit * 16 + 11)) 640 $g_operator 1891 mkdev ${name}${unit}m b $blk $(($unit * 16 + 12)) 640 $g_operator 1892 mkdev ${name}${unit}n b $blk $(($unit * 16 + 13)) 640 $g_operator 1893 mkdev ${name}${unit}o b $blk $(($unit * 16 + 14)) 640 $g_operator 1894 mkdev ${name}${unit}p b $blk $(($unit * 16 + 15)) 640 $g_operator 1895 mkdev r${name}${unit}a c $chr $(($unit * 16 + 0)) 640 $g_operator 1896 mkdev r${name}${unit}b c $chr $(($unit * 16 + 1)) 640 $g_operator 1897 mkdev r${name}${unit}c c $chr $(($unit * 16 + 2)) 640 $g_operator 1898 mkdev r${name}${unit}d c $chr $(($unit * 16 + 3)) 640 $g_operator 1899 mkdev r${name}${unit}e c $chr $(($unit * 16 + 4)) 640 $g_operator 1900 mkdev r${name}${unit}f c $chr $(($unit * 16 + 5)) 640 $g_operator 1901 mkdev r${name}${unit}g c $chr $(($unit * 16 + 6)) 640 $g_operator 1902 mkdev r${name}${unit}h c $chr $(($unit * 16 + 7)) 640 $g_operator 1903 mkdev r${name}${unit}i c $chr $(($unit * 16 + 8)) 640 $g_operator 1904 mkdev r${name}${unit}j c $chr $(($unit * 16 + 9)) 640 $g_operator 1905 mkdev r${name}${unit}k c $chr $(($unit * 16 + 10)) 640 $g_operator 1906 mkdev r${name}${unit}l c $chr $(($unit * 16 + 11)) 640 $g_operator 1907 mkdev r${name}${unit}m c $chr $(($unit * 16 + 12)) 640 $g_operator 1908 mkdev r${name}${unit}n c $chr $(($unit * 16 + 13)) 640 $g_operator 1909 mkdev r${name}${unit}o c $chr $(($unit * 16 + 14)) 640 $g_operator 1910 mkdev r${name}${unit}p c $chr $(($unit * 16 + 15)) 640 $g_operator 1911} 1912 1913makedisk_p16high() 1914{ 1915 ho=524280 # offset for partition 9 to 16 1916 name="$1"; unit="$2"; blk="$3"; chr="$4" 1917 1918 mkdev ${name}${unit}a b $blk $(($unit * 8 + 0)) 640 $g_operator 1919 mkdev ${name}${unit}b b $blk $(($unit * 8 + 1)) 640 $g_operator 1920 mkdev ${name}${unit}c b $blk $(($unit * 8 + 2)) 640 $g_operator 1921 mkdev ${name}${unit}d b $blk $(($unit * 8 + 3)) 640 $g_operator 1922 mkdev ${name}${unit}e b $blk $(($unit * 8 + 4)) 640 $g_operator 1923 mkdev ${name}${unit}f b $blk $(($unit * 8 + 5)) 640 $g_operator 1924 mkdev ${name}${unit}g b $blk $(($unit * 8 + 6)) 640 $g_operator 1925 mkdev ${name}${unit}h b $blk $(($unit * 8 + 7)) 640 $g_operator 1926 mkdev ${name}${unit}i b $blk $(($unit * 8 + $ho + 8)) 640 $g_operator 1927 mkdev ${name}${unit}j b $blk $(($unit * 8 + $ho + 9)) 640 $g_operator 1928 mkdev ${name}${unit}k b $blk $(($unit * 8 + $ho + 10)) 640 $g_operator 1929 mkdev ${name}${unit}l b $blk $(($unit * 8 + $ho + 11)) 640 $g_operator 1930 mkdev ${name}${unit}m b $blk $(($unit * 8 + $ho + 12)) 640 $g_operator 1931 mkdev ${name}${unit}n b $blk $(($unit * 8 + $ho + 13)) 640 $g_operator 1932 mkdev ${name}${unit}o b $blk $(($unit * 8 + $ho + 14)) 640 $g_operator 1933 mkdev ${name}${unit}p b $blk $(($unit * 8 + $ho + 15)) 640 $g_operator 1934 mkdev r${name}${unit}a c $chr $(($unit * 8 + 0)) 640 $g_operator 1935 mkdev r${name}${unit}b c $chr $(($unit * 8 + 1)) 640 $g_operator 1936 mkdev r${name}${unit}c c $chr $(($unit * 8 + 2)) 640 $g_operator 1937 mkdev r${name}${unit}d c $chr $(($unit * 8 + 3)) 640 $g_operator 1938 mkdev r${name}${unit}e c $chr $(($unit * 8 + 4)) 640 $g_operator 1939 mkdev r${name}${unit}f c $chr $(($unit * 8 + 5)) 640 $g_operator 1940 mkdev r${name}${unit}g c $chr $(($unit * 8 + 6)) 640 $g_operator 1941 mkdev r${name}${unit}h c $chr $(($unit * 8 + 7)) 640 $g_operator 1942 mkdev r${name}${unit}i c $chr $(($unit * 8 + $ho + 8)) 640 $g_operator 1943 mkdev r${name}${unit}j c $chr $(($unit * 8 + $ho + 9)) 640 $g_operator 1944 mkdev r${name}${unit}k c $chr $(($unit * 8 + $ho + 10)) 640 $g_operator 1945 mkdev r${name}${unit}l c $chr $(($unit * 8 + $ho + 11)) 640 $g_operator 1946 mkdev r${name}${unit}m c $chr $(($unit * 8 + $ho + 12)) 640 $g_operator 1947 mkdev r${name}${unit}n c $chr $(($unit * 8 + $ho + 13)) 640 $g_operator 1948 mkdev r${name}${unit}o c $chr $(($unit * 8 + $ho + 14)) 640 $g_operator 1949 mkdev r${name}${unit}p c $chr $(($unit * 8 + $ho + 15)) 640 $g_operator 1950} 1951 1952# make only the very few basic disk device nodes - 'a' partition 1953# and raw partition 1954makedisk_minimal() 1955{ 1956 name=$1; unit=$2; blk=$3; chr=$4 1957 doff=%DISKMINOROFFSET% 1958 ro=%RAWDISK_OFF% 1959 rn=%RAWDISK_NAME% 1960 1961 mkdev ${name}${unit}a b $blk $(($unit * $doff + 0)) 640 $g_operator 1962 mkdev ${name}${unit}$rn b $blk $(($unit * $doff + $ro)) 640 $g_operator 1963 mkdev r${name}${unit}a c $chr $(($unit * $doff + 0)) 640 $g_operator 1964 mkdev r${name}${unit}$rn c $chr $(($unit * $doff + $ro)) 640 $g_operator 1965} 1966 1967# create_mfs_dev nodes 1968# Create a memory file system for a given number of device nodes, 1969# and mount it. Attempts to use mount_tmpfs, or falls back to 1970# mount_mfs. 1971# 1972# If do_redirect, then also redirect output to the console. 1973# 1974create_mfs_dev() 1975{ 1976 ndevnodes=${1-1200} 1977 dev_mountpoint=${PWD:-/dev} 1978 1979 # Number of inodes is the specified number of device nodes, plus 1980 # a margin to allow for extra device nodes created later. 1981 ninode=$((ndevnodes * 11 / 10)) 1982 # Add 2 reserved inodes (needed for both mfs and tmpfs), and round 1983 # up to a multiple of 32 (needed for mfs, not needed for tmpfs). 1984 ninode=$(( (ninode + 2 + 31) / 32 * 32 )) 1985 # This file system size calculation is exact for mount_mfs(8) 1986 # with 512-byte sectors; it's larger than necessary 1987 # for mount_tmpfs(8). 40960 bytes (80 blocks) is the minimum size 1988 # allowed by mount_mfs. 1989 fs_bytes=$((8192 + 2 * 8192 + 4096 + ninode*(128+18) + 8192)) 1990 [ "$fs_bytes" -lt 40960 ] && fs_bytes=40960 1991 fs_blocks=$((fs_bytes/512)) 1992 1993 # Try tmpfs; if that fails try mfs. 1994 if mount_tmpfs -s $fs_bytes -n $ninode -m 0755 \ 1995 -o union tmpfs "$dev_mountpoint" 1996 then 1997 fstype=tmpfs 1998 elif mount_mfs -b 4096 -f 512 -s $fs_blocks -n $ninode -p 0755 \ 1999 -o union swap "$dev_mountpoint" 2000 then 2001 fstype=mfs 2002 else 2003 warn "Failed to create memory file system" 2004 exit 1 2005 fi 2006 2007 # Our current directory was in the lower file system; change it to 2008 # the newly mounted upper file system. 2009 cd "$dev_mountpoint" 2010 2011 if $do_redirect; then 2012 # Redirect stdout and stderr to console 2013 mknod -m 600 -g 0 -u 0 temp_console c 0 0 2014 exec >temp_console 2>&1 2015 rm temp_console 2016 fi 2017 2018 echo "Created $fstype $dev_mountpoint" \ 2019 "($fs_blocks blocks, $ninode inodes)" 2020} 2021 2022# 2023# MAIN: If MAKEDEV_AS_LIBRARY is set, then we are being used as a 2024# function library, so just return. Otherwise, do all the real work. 2025# 2026[ -n "${MAKEDEV_AS_LIBRARY}" ] && return 2027makedev_main makedev ${1+"$@"} 2028