[BACK]Return to MAKEDEV.mi CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/MAKEDEV.mi, Revision 1.1

1.1     ! todd        1: include(MAKEDEV.sub)dnl
        !             2: dnl
        !             3: vers(a,{-$OpenBSD: MAKEDEV.mi,v 1.1.1.1 2001/09/20 12:34:56 todd Exp $-})dnl
        !             4: dnl
        !             5: divert(1)dnl
        !             6: {-#-}
        !             7: {-#-} Copyright (c) 2001 Todd T. Fries <todd@OpenBSD.org>
        !             8: {-#-} All rights reserved.
        !             9: {-#-}
        !            10: {-#-} Redistribution and use in source and binary forms, with or without
        !            11: {-#-} modification, are permitted provided that the following conditions
        !            12: {-#-} are met:
        !            13: {-#-} 1. Redistributions of source code must retain the above copyright
        !            14: {-#-}    notice, this list of conditions and the following disclaimer.
        !            15: {-#-} 2. The name of the author may not be used to endorse or promote products
        !            16: {-#-}    derived from this software without specific prior written permission.
        !            17: {-#-}
        !            18: {-#-} THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
        !            19: {-#-} INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
        !            20: {-#-} AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
        !            21: {-#-} THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
        !            22: {-#-} EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
        !            23: {-#-} PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
        !            24: {-#-} OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
        !            25: {-#-} WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
        !            26: {-#-} OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
        !            27: {-#-} ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            28: {-#-}
        !            29: dnl
        !            30: dnl Diversions:  (upon termination, concatenated output queues)
        !            31: dnl
        !            32: dnl 0 - very top
        !            33: dnl 1 - descriptions of devices
        !            34: dnl 2 - init of script, function definitions, etc
        !            35: dnl 3 - beginning of global recursive R() function
        !            36: dnl 7 - body of MAKEDEV, device creations, etc
        !            37: dnl 9 - end
        !            38: dnl
        !            39: dnl HOW TO ADD A DEVICE:
        !            40: dnl
        !            41: dnl In this file, you must use at least two macros:
        !            42: dnl
        !            43: dnl  Use '__devitem(uniqueid,name-pattern,description)' to create an entry
        !            44: dnl  in the description at the top of the generated MAKEDEV file:
        !            45: dnl
        !            46: dnl    __devitem(sca,sca*,Sugar Generic device)dnl
        !            47: dnl
        !            48: dnl  This is ultimately shown as:
        !            49: dnl
        !            50: dnl    #  sca*   Sugar Generic device
        !            51: dnl
        !            52: dnl  Use '_mkdev(uniqueid,shell-pattern,{-shell-script-})dnl' to create
        !            53: dnl  a shell script fragment used to 'create' the device (be sure to match
        !            54: dnl  the uniqueid from above):
        !            55: dnl
        !            56: dnl    _mkdev(sca,sca*,{-M sca$U c major_sca_c $U
        !            57: dnl           M rsca$U b major_sca_b Add($U,128)-})dnl
        !            58: dnl
        !            59: dnl  This is ultimately expanded into:
        !            60: dnl
        !            61: dnl    sca*)  M sca$U c 24 $U
        !            62: dnl           M sca$U b 42 $(($U+128));;
        !            63: dnl
        !            64: dnl In the MAKEDEV.md file, add a '_DEV(uniqueid,charmajor,blockmajor)'
        !            65: dnl entry:
        !            66: dnl
        !            67: dnl   _DEV(sca,24,42)
        !            68: dnl
        !            69: dnl Final step is to add an entry to the 'all' entry below. For a short
        !            70: dnl example:
        !            71: dnl
        !            72: dnl   _mkdev(all,{-all-},{-dnl
        !            73: dnl   _dl({-std-},{-std-},{-sca-},{-sca0 sca1 sca2 sca3-})-})dnl
        !            74: dnl
        !            75: dnl would expand to:
        !            76: dnl
        !            77: dnl   all)
        !            78: dnl        R std sca0 sca1 sca2 sca3
        !            79: dnl        ;;
        !            80: dnl
        !            81: dnl presuming '_DEV(sca..' and '_DEV(std)' were in the MAKEDEV.md file.
        !            82: dnl
        !            83: dnl
        !            84: dnl Everything is 'automatically' added to 'MAKEDEV' based on whether or
        !            85: dnl not the '_DEV()' entry has a corresponding _mkdev() and __devitem()
        !            86: dnl entry in MAKEDEV.sub (this file).
        !            87: dnl
        !            88: dnl Note: be very wary of adding whitespace, carriage returns, or not
        !            89: dnl finishing a macro with ')dnl' .. otherwise, extra blank lines show up
        !            90: dnl in the output.
        !            91: dnl
        !            92: _mkdev(loc,local,{-test -s $T.local && sh $T.local-})dnl
        !            93: dnl
        !            94: __devtitle(make,Device "make" file.  Valid arguments)dnl
        !            95: __devitem(all,{-all-},{-makes all known devices{-,-} including local devices.
        !            96: {-#-}          Tries to make the ``standard'' number of each type.-})dnl
        !            97: dnl
        !            98: dnl 'all' is special.  The 'D'evice 'L'ist (or _dl) macro checks to see if
        !            99: dnl a particular devices is in the MAKEDEV.md file, and if so, includes the
        !           100: dnl necessary devices.  Otherwise the devices are not included in the 'all'
        !           101: dnl target.  Note this keeps line lengths to less than column 70.  For the
        !           102: dnl gory details see the definition of '_dl' in MAKEDEV.sub
        !           103: dnl
        !           104: _mkdev(all,{-all-},{-dnl
        !           105: _dl({-std-},{-std-},
        !           106: {-fdesc-},{-fd-},
        !           107: {-sd-},{-sd0 sd1 sd2 sd3 sd4-},
        !           108: {-pty-},{-pty0 pty1-},
        !           109: {-st-},{-st0 st1-},
        !           110: {-ch-},{-ch0-},
        !           111: {-cd-},{-cd0 cd1-},
        !           112: {-mcd-},{-mcd0-},
        !           113: {-vnd-},{-vnd0 vnd1 vnd2 vnd3-},
        !           114: {-ccd-},{-ccd0 ccd1 ccd2 ccd3-},
        !           115: {-wd-},{-wd0 wd1 wd2 wd3-},
        !           116: {-raid-},{-raid0 raid1 raid2 raid3-},
        !           117: {-bpf-},{-bpf0 bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7 bpf8 bpf9-},
        !           118: {-tun-},{-tun0 tun1 tun2 tun3-},
        !           119: {-altq-},{-altq-},
        !           120: {-pf-},{-pf-},
        !           121: {-cry-},{-crypto-},
        !           122: {-tty-},{-ttyh0 ttyh1-},
        !           123: {-flo-},{-fd0 fd0B fd0C fd0D fd0E fd0F fd0G fd0H-},
        !           124: {-flo-},{-fd1 fd1B fd1C fd1D fd1E fd1F fd1G fd1H-},
        !           125: {-ttyB-},{-ttyB0 ttyB1-},
        !           126: {-tty0-},{-tty00 tty01 tty02 tty03-},
        !           127: {-tzs-},{-ttya ttyb ttyc ttyd-},
        !           128: {-tzs-},{-cuaa cuab cuac cuad-},
        !           129: {-lkm-},{-lkm-},
        !           130: {-iop-},{-iop0 iop1-},
        !           131: {-mmcl-},{-mmclock-},dnl
        !           132: {-lpt-},{-lpa0 lpt0-},
        !           133: {-rnd-},{-random-},
        !           134: {-ses-},{-ses0-},
        !           135: {-uk-},{-uk0 uk1-},
        !           136: {-ss-},{-ss0 ss1-},
        !           137: {-ttyc-},{-ttyc0 ttyc1 ttyc2 ttyc3 ttyc4 ttyc5 ttyc6 ttyc7-},
        !           138: {-com-},{-tty00 tty01 tty02 tty03-},
        !           139: {-xfs-},{-xfs0-},
        !           140: {-au-},{-audio0-},
        !           141: {-usbs-},{-usbs-},
        !           142: {-wsmouse-},{-wscons-},
        !           143: {-local-},{-local-})-})dnl
        !           144: __devitem(floppy,floppy,devices to be put on install floppies)dnl
        !           145: __devitem(std,{-std-},standard devices)dnl
        !           146: dnl
        !           147: dnl _std
        !           148: dnl
        !           149: dnl $1: tty
        !           150: dnl $2: memstuff
        !           151: dnl $3: ksyms
        !           152: dnl $4: drum
        !           153: dnl $5: klog
        !           154: dnl
        !           155: define({-_std-},{-dnl
        !           156: std)
        !           157:        M console       c 0 0 600
        !           158:        M tty           c $1 0
        !           159:        M mem           c $2 0 640 kmem
        !           160:        M kmem          c $2 1 640 kmem
        !           161:        M null          c $2 2
        !           162:        M zero          c $2 12
        !           163:        M stdin         c major_fdesc_c 0
        !           164:        M stdout        c major_fdesc_c 1
        !           165:        M stderr        c major_fdesc_c 2
        !           166:        M ksyms         c $3 0 640 kmem
        !           167:        M drum          c $4 0 640 kmem
        !           168:        M klog          c $5 0 600-})dnl
        !           169: dnl
        !           170: __devitem({-usbs-},usbs,make USB devices)dnl
        !           171: _mkdev(usbs,usbs,{-dnl
        !           172: _dl({-usb-},{-usb0 usb1-},
        !           173: {-urio-},{-urio-},
        !           174: {-uhid-},{-uhid0 uhid1 uhid2 uhid3-},
        !           175: {-ulpt-},{-ulpt0 ulpt1-},
        !           176: {-ugen-},{-ugen0 ugen1-},
        !           177: {-utty-},{-utty0 utty1-})-})dnl
        !           178: __devtitle(tap,Tapes)dnl
        !           179: __devitem(wt,{-wt*     -},QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl
        !           180: _mkdev(wt,wt*,
        !           181: {-name=wt
        !           182:        n=Mult($U,8) m=Add($n,4)
        !           183:        M $name$U       b major_wt_b $n 640 operator
        !           184:        M r$name$U      c major_wt_c $n 640 operator
        !           185:        M n$name$U      b major_wt_b $m 640 operator
        !           186:        M nr$name$U     c major_wt_c $m 640 operator-})dnl
        !           187: __devitem(tz,tz*,{-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl
        !           188: __devitem(st,{-st*-},SCSI tapes)dnl
        !           189: _mkdev(st,st*,{-n=Mult($U,16)
        !           190:        for pre in " " n e en
        !           191:        do
        !           192:                M ${pre}st$U    b major_st_b $n 660 operator
        !           193:                M ${pre}rst$U   c major_st_c $n 660 operator
        !           194:                n=Add($n,1)
        !           195:        done-})dnl
        !           196: _mkdev(st_hp300,ct*|mt*|st*,
        !           197: {-case $i in
        !           198:        ct*) name=ct blk=major_ct_b chr=major_ct_c;;
        !           199:        mt*) name=mt blk=major_mt_b chr=major_mt_c;;
        !           200:        st*) name=st blk=major_st_hp300_b chr=major_st_hp300_c;;
        !           201:        esac
        !           202:        case $U in
        !           203:        [0-7])
        !           204:                four=Add($U,4) eight=Add($U,8)
        !           205:                twelve=Add($U,12) twenty=Add($U,20)
        !           206:                M r$name$U      c $chr $U 660 operator
        !           207:                M r$name$four   c $chr $four 660 operator
        !           208:                M r$name$eight  c $chr $eight 660 operator
        !           209:                M r$name$twelve c $chr $twelve 660 operator
        !           210:                MKlist="$MKlist;ln r$name$four nr$name$U";: sanity w/pdp11 v7
        !           211:                MKlist="$MKlist;ln r$name$twelve nr$name$eight";: ditto
        !           212:                RMlist="$RMlist nr$name$U nr$name$eight"
        !           213:                ;;
        !           214:        *)
        !           215:                echo bad unit for tape in: $1
        !           216:                ;;
        !           217:        esac-})dnl
        !           218: __devitem(st_hp300,st*,Exabyte tape)dnl
        !           219: __devitem(ct,ct*,HP300 HP-IB cartridge tape)dnl
        !           220: __devitem(mt,mt*,(Magnetic) 9-track reel tape)dnl
        !           221: __devtitle(dis,Disks)dnl
        !           222: __devitem(rz,rz*,SCSI disks)dnl
        !           223: __devitem(sd,{-sd*-},SCSI disks{-,-} includes flopticals)dnl
        !           224: __devitem(ofdisk,ofdisk*,OpenFirmware disks)dnl
        !           225: __devitem(hd,{-hd*-},HP300 HP-IB disks)dnl
        !           226: __devitem(cd,{-cd*-},SCSI cdrom drives)dnl
        !           227: __devitem(acd,acd*,ATAPI cdrom drives)dnl
        !           228: _mkdev(cd,cd*,{-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}dnl
        !           229: -})dnl
        !           230: __devitem(mcd,mcd*,Mitsumi cdrom drives)dnl
        !           231: _mkdev(mcd,mcd*,{-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0-})dnl
        !           232: __devitem(ch,{-ch*-},SCSI media changer)dnl
        !           233: _mcdev(ch,ch*,ch,{-major_ch_c-},660,operator)dnl
        !           234: __devitem(uk,uk*,SCSI Unknown device)dnl
        !           235: _mcdev(uk,uk*,uk,{-major_uk_c-},640,operator)dnl
        !           236: __devitem(ss,ss*,SCSI scanners)dnl
        !           237: _mkdev(ss,ss*,{-M ss$U c major_ss_c $U 440 operator
        !           238:        RMlist="$RMlist scan$U"
        !           239:        MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl
        !           240: __devitem(ses,ses*,SES/SAF-TE SCSI devices)dnl
        !           241: _mkdev(ses,ses*,{-M ses$U c major_ses_c $U 640 operator-})dnl
        !           242: __devitem(ramd,ramdisk,makes all devices for a ramdisk kernel)dnl arc
        !           243: __devitem(rd,{-rd*-},"ramdisk" pseudo-disks)dnl
        !           244: _mkdev(rd,rd*,{-dodisk2 rd $U major_rd_b major_rd_c $U 0-})dnl
        !           245: __devitem(xd,xd*,Xylogic 753/7053 disks)dnl
        !           246: __devitem(xy,xy*,{-    Xylogic 450/451 disks-})dnl
        !           247: __devitem(flo,{-fd*-},{-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl
        !           248: _mkdev(flo,fd*,
        !           249: {-typnam=$U${i#fd[01]*}
        !           250:        case $typnam in
        !           251:        0|1)    typnum=0;; # no type specified, assume A
        !           252:        *A)             typnam=0; typnum=0;;
        !           253:        *B)             typnum=1;;
        !           254:        *C)             typnum=2;;
        !           255:        *D)             typnum=3;;
        !           256:        *E)             typnum=4;;
        !           257:        *F)             typnum=5;;
        !           258:        *G)             typnum=6;;
        !           259:        *H)             typnum=7;;
        !           260:        *)              echo bad type $typnam for $i; exit 1;;
        !           261:        esac
        !           262:        case $U in
        !           263:        0|1)    blk=major_flo_b; chr=major_flo_c;;
        !           264:        *)      echo bad unit $U for $i; exit 1;;
        !           265:        esac
        !           266:        nam=fd${typnam}
        !           267:        n=Add(Mult($U,128),Mult($typnum,16))
        !           268:        M ${nam}a       b $blk $n 640 operator
        !           269:        M ${nam}b       b $blk Add($n,1) 640 operator
        !           270:        M ${nam}c       b $blk Add($n,2) 640 operator
        !           271:        M r${nam}a      c $chr $n 640 operator
        !           272:        M r${nam}b      c $chr Add($n,1) 640 operator
        !           273:        M r${nam}c      c $chr Add($n,2) 640 operator-},664)dnl
        !           274: __devitem(aflo,floppy,devices needed for install floppies)dnl
        !           275: _mkdev(aflo,fd*,{-case $U in 0|1|2|3)
        !           276:        M fd${U}a b major_aflo_b Mult($U,16) 640 operator
        !           277:        M fd${U}b b major_aflo_b Add(Mult($U,16),1) 640 operator
        !           278:        M rfd${U}a c major_aflo_c Mult($U,16) 640 operator
        !           279:        M rfd${U}b c major_aflo_c Add(Mult($U,16),1) 640 operator;;
        !           280:        *) echo bad unit for floppy disk in: $i;;
        !           281:        esac-})dnl
        !           282: __devitem(iop,iop*,I2O controller device)dnl
        !           283: _mcdev(iop,iop*,iop,{-major_iop_c-},660)dnl
        !           284: __devitem(wdt,wdt0,watchdog timer)dnl
        !           285: _mcdev(wdt,wdt0,wdt,{-major_wdt_c-},440,operator)dnl
        !           286: __devitem(local,local,configuration specific devices)dnl
        !           287: __devitem(wd,{-wd*-},{-"winchester" disk drives (ST506,IDE,ESDI,RLL,...)-})dnl
        !           288: __devitem(ccd,ccd*,concatenated disk devices)dnl
        !           289: __devitem(raid,raid*,RAIDframe disk devices)dnl
        !           290: __devitem(vnd,vnd*,"file" pseudo-disks)dnl
        !           291: _mkdev(vnd,vnd*,{-dodisk vnd $U major_vnd_b major_vnd_c $U 0
        !           292:        dodisk svnd $U major_vnd_b major_vnd_c $U 128-})dnl
        !           293: dnl
        !           294: dnl For normal disk devices, add a disk_q entry; anything else define like
        !           295: dnl the rest (such as vnd above).
        !           296: dnl
        !           297: disk_q({-xy-})dnl
        !           298: disk_q({-xd-})dnl
        !           299: disk_q({-hd-})dnl
        !           300: disk_q({-ofdisk-})dnl
        !           301: disk_q({-rz-})dnl
        !           302: disk_q({-wd-})dnl
        !           303: disk_q({-raid-})dnl
        !           304: disk_q({-ccd-})dnl
        !           305: disk_q({-sd-})dnl
        !           306: dnl
        !           307: __devitem(loc,local,configuration specific devices)dnl
        !           308: _mkdev(loc,local,{-test -s $T.local && sh $T.local-})dnl
        !           309: _mkdev({-disks-},{-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
        !           310: {-case $i in
        !           311: show_disks2()dnl
        !           312:        esac
        !           313:        dodisk $n $U $b $c $U 0-})dnl
        !           314: __mkdev({-disks-}){--}dnl
        !           315: dnl
        !           316: __devtitle(cons,Console ports)dnl
        !           317: __devitem(ttyv0,ttyv0,pccons or pcvt screen 0)dnl
        !           318: __devitem(ttyv,ttyv*,pcvt)dnl
        !           319: __devitem(ttye,ttye*,ite bitmapped consoles)dnl
        !           320: __devitem(wscons,ttyC0,wscons screen 0)dnl
        !           321: _mkdev({-wscons-},{-wscons-},{-dnl
        !           322: _dl(dnl
        !           323: {-wscons-},{-ttyCcfg-},
        !           324: {-wsmux-},{-wsmux-},
        !           325: {-wskbd-},{-wskbd0 wskbd1 wskbd2 wskbd3-},
        !           326: {-wsmouse-},{-wsmouse0 wsmouse1 wsmouse2 wsmouse3-})-})dnl
        !           327: __devitem(wskbd,wskbd*,wscons keyboards)dnl
        !           328: _mkdev(wskbd,wskbd*,{-M wskbd$U c major_wskbd_c $U 600-})dnl
        !           329: __devitem(wsmux,wsmux,wscons keyboard/mouse mux devices)dnl
        !           330: _mkdev(wsmux,wsmux|wsmouse|wskbd,{-M wsmouse c major_wsmux_c 0 600
        !           331:        M wskbd c major_wsmux_c 1 600-})dnl
        !           332: __devitem(pcons,console,PROM console)dnl
        !           333: __devtitle(point,Pointing devices)dnl
        !           334: __devitem(wsmouse,wsmouse*,wscons mice)dnl
        !           335: _mkdev(wsmouse,wsmouse*,{-M wsmouse$U c major_wsmouse_c $U 600-})dnl
        !           336: __devitem(quad,quadmouse,"quadrature mouse")dnl
        !           337: __devtitle(pty,Pseudo terminals)dnl
        !           338: __devitem(tty,tty*,set of 16 slave psuedo terminals)dnl
        !           339: __devitem(pty,pty*,set of 16 master pseudo terminals)dnl
        !           340: _mkdev(pty,pty*,{-case $U in
        !           341:        0) off=0 name=p;;
        !           342:        1) off=16 name=q;;
        !           343:        2) off=32 name=r;;
        !           344:        3) off=48 name=s;;
        !           345: # Note that telnetd, rlogind, and xterm (at least) only look at p-s.
        !           346:        4) off=64 name=t;;
        !           347:        5) off=80 name=u;;
        !           348:        6) off=96 name=v;;
        !           349:        7) off=112 name=w;;
        !           350:        8) off=128 name=x;;
        !           351:        9) off=144 name=y;;
        !           352:        10) off=160 name=z;;
        !           353:        11) off=176 name=P;;
        !           354:        12) off=192 name=Q;;
        !           355:        13) off=206 name=R;;
        !           356:        14) off=224 name=S;;
        !           357:        15) off=240 name=T;;
        !           358:        *) echo bad unit for pty in: $i; continue;;
        !           359:        esac
        !           360:        n=0
        !           361:        while [ $n -lt 16 ]
        !           362:        do
        !           363:                nam=$name$(hex $n)
        !           364:                M tty$nam c major_tty_c Add($off,$n)
        !           365:                M pty$nam c major_pty_c Add($off,$n)
        !           366:                n=Add($n,1)
        !           367:        done-})dnl
        !           368: __devitem(dc,dc*,{-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
        !           369: __devtitle(prn,Printers)dnl
        !           370: __devitem(par,par*,motherboard parallel port)dnl
        !           371: __devitem(lpt,lpt*,IEEE 1284 centronics printer)dnl
        !           372: _mkdev(lpt,lpt*|lpa*,
        !           373: {-case $i in
        !           374:        lpt*) n=lpt f=0;;
        !           375:        lpa*) n=lpa f=128;;
        !           376:        esac
        !           377:        M $n$U c major_lpt_c Add($U,$f) 600-})dnl
        !           378: __devitem(lpa,lpa*,interruptless lp)dnl
        !           379: __devitem(ppi,ppi*,HP-IB plotters)dnl
        !           380: __devtitle({-usb-},USB devices)dnl
        !           381: __devitem({-usb-},usb*,Bus control devices used by usbd for attach/detach)dnl
        !           382: _mkdev({-usb-},usb*,{-[ "$i" = "usb" ] && u= || u=$U
        !           383:        M usb$u c major_usb_c $U 660-})dnl
        !           384: __devitem(uhid,uhid*,Generic HID devices)dnl
        !           385: _mcdev({-uhid-},uhid*,{-uhid-},{-major_uhid_c-},660)dnl
        !           386: __devitem(ulpt,ulpt*,Printer devices)dnl
        !           387: _mcdev({-ulpt-},ulpt*,{-ulpt-},{-major_ulpt_c-},660)dnl
        !           388: __devitem(utty,utty*,Serial ports)dnl
        !           389: _mcdev({-utty-},utty*,{-utty-},{-major_utty_c-},660)dnl
        !           390: __devitem(urio,urio*,Diamond Multimedia Rio 500)dnl
        !           391: _mcdev({-urio-},urio*,{-urio-},{-major_urio_c-},660)dnl
        !           392: __devitem(ugen,ugen*,Generic device)dnl
        !           393: _mkdev(ugen,ugen*,{-n=Mult($U,16)
        !           394:        for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
        !           395:        do
        !           396:                M ugen$U.$j c major_ugen_c Add($n,$j) 660
        !           397:        done-})dnl
        !           398: __devtitle(cpu,Cpus)dnl
        !           399: __devitem(cpu,cpu*,cpus)dnl
        !           400: __devtitle(call,Call units)dnl
        !           401: __devtitle(term,Terminal ports)dnl
        !           402: __devtitle(termp,Terminal multiplexers)dnl
        !           403: __devitem(dca,dca*,HP200/300 single port serial interface)dnl
        !           404: __devitem(dcm,dcm*,HP200/300 4 port serial mux interface)dnl
        !           405: __devitem(apci,apci*,HP400 4 port serial mux interface)dnl
        !           406: __devitem({-com-},{-tty0*-},NS16x50 serial ports)dnl
        !           407: _mkdev(com,{-tty0*-},{-M tty$U c major_com_c $U 660 dialer uucp
        !           408:        M cua$U c major_com_c Add($U,128) 660 dialer uucp-})dnl
        !           409: __devitem(ttyc,ttyc*,Cyclades serial ports)dnl
        !           410: __devitem(tzs,tty[a-z]*,Zilog 8530 Serial Port)dnl
        !           411: _mkdev(tzs,{-tty[a-z]-},{-u=${i#tty*}
        !           412:        case $u in
        !           413:        a) n=0 ;;
        !           414:        b) n=1 ;;
        !           415:        c) n=4 ;;
        !           416:        d) n=5 ;;
        !           417:        *) echo unknown tty device $i ;;
        !           418:        esac
        !           419:        M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
        !           420: __devitem(tth,ttyh*,Sab82532 serial devices)dnl
        !           421: _mkdev(tth,ttyh*,{-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
        !           422: __devitem(czs,cua[a-z]*,Zilog 8530 Serial Port)dnl
        !           423: _mkdev(czs,cua[a-z],{-u=${i#cua*}
        !           424:        case $u in
        !           425:        a) n=0 ;;
        !           426:        b) n=1 ;;
        !           427:        c) n=4 ;;
        !           428:        d) n=5 ;;
        !           429:        *) echo unknown cua device $i ;;
        !           430:        esac
        !           431:        M cua$u c major_czs_c Add($n,128) 660 dialer uucp-})dnl
        !           432: __devitem(arm_tty,tty*,{-alias for PC COM ports{-,-} this is what the system really wants-})dnl
        !           433: __devitem(tty0,tty00,standard serial port)dnl
        !           434: __devitem(ttyA,ttyA*,mfc serial ports)dnl
        !           435: __devitem(attyB,ttyB*,ISA COM ports)dnl  amiga
        !           436: __devitem(ttyz,tty[a-d],onboard zs serial ports)dnl
        !           437: __devitem(cuaz,cua[a-d],onboard zs serial ports)dnl
        !           438: __devitem(ttyB,ttyB?,DEC 3000 ZS8530 ("scc") serial ports)dnl
        !           439: __devitem(scc,scc*,82530 serial interface)dnl
        !           440: __devitem(arc_ttyC,ttyC0,pccons)dnl
        !           441: __devitem(i386_ttyC,ttyC*,pcvt)dnl
        !           442: __devitem(ttyC,ttyC?,{-AlphaStation NS16550 ("com serial ports")-})dnl
        !           443: __devitem(ttyE,ttyE?,Workstation console (framebuffer & keyboard) tty emulators)dnl
        !           444: __devitem(ser02,ser02,{-serial2 port (channel A on 8530)-})dnl
        !           445: __devitem(mdm02,mdm02,{-modem2 port (channel B on 8530)-})dnl
        !           446: __devtitle(spec,Special purpose devices)dnl
        !           447: __devitem(apm,apm      ,power management device)dnl
        !           448: _mkdev(apm,apm*,{-M apm        c major_apm_c 0 644
        !           449:        M apmctl        c major_apm_c 8 644-})dnl
        !           450: __devitem(pcmcia,pcmcia*,PCMCIA card drivers)dnl
        !           451: __devitem(pctr,pctr*,PC Performance Tuning Register access device)dnl
        !           452: _mkdev(pctr,pctr,{-M pctr c major_pctr_c 0 644-})dnl
        !           453: __devitem(au,audio*,audio device)dnl
        !           454: _mkdev(au,audio*,{-M sound$U   c major_au_c $U
        !           455:        M mixer$U       c major_au_c Add($U,16)
        !           456:        M audio$U       c major_au_c Add($U,128)
        !           457:        M audioctl$U    c major_au_c Add($U,192)
        !           458:        MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
        !           459:        MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
        !           460:        MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
        !           461:        MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
        !           462: __devitem(music,music*,midi devices)dnl
        !           463: _mkdev(music,music*,{-M music$U     c major_music_c $U
        !           464:        M sequencer$U c major_music_c Add($U,128)
        !           465:        MKlist="$MKlist;[ -e music ] || ln -s music$U music"
        !           466:        MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
        !           467: __devitem(fdesc,fd,makes fd/* for the fdescfs)dnl
        !           468: _mkdev(fdesc,fd,{-RMlist="mkdir -p fd;$RMlist" n=0
        !           469:        while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n,1);done
        !           470:        MKlist="$MKlist;chmod 555 fd"-})dnl
        !           471: __devtitle(graph,Graphics devices)dnl
        !           472: __devitem(grf,grf*,{-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-}
        !           473: {-#-}          Cirrus boards (grf3){-,-} A2410 (grf4) video or
        !           474: {-#-}          CyberVision 64 (grf5)-})dnl
        !           475: __devitem(grf_amiga,grf*,{-Motherboard bitmapped video.-})dnl
        !           476: __devitem(grf_hp300,grf*,raw interface to HP300 graphics devices)dnl
        !           477: __devitem(ite,ite*,terminal emulator interface to HP300 graphics devices)dnl
        !           478: __devitem({-hil-},{-hil-},HP300 HIL input devices)dnl
        !           479: __devitem(oppr,openprom)dnl
        !           480: _cdev(oppr,openprom,70,0)dnl
        !           481: __devitem(btw,bwtwo*)dnl
        !           482: _mcdev(btw,bwtwo*,bwtwo,{-major_btw_c-},666)dnl
        !           483: __devitem(ctw,cgtwo*)dnl
        !           484: _mcdev(ctw,cgtwo*,cgtwo,{-major_ctw_c-},666)dnl
        !           485: __devitem(ctr,cgthree*)dnl
        !           486: _mcdev(ctr,cgthree*,cgthree,{-major_ctr_c-},666)dnl
        !           487: __devitem(cfr,cgfour*)dnl
        !           488: _mcdev(cfr,cgfour*,cgfour,{-major_cfr_c-},666)dnl
        !           489: __devitem(csx,cgsix*)dnl
        !           490: _mcdev(csx,cgsix*,cgsix,{-major_csx_c-},666)dnl
        !           491: __devitem(ceg,cgeight*)dnl
        !           492: _mcdev(ceg,cgeight*,cgeight,{-major_ceg_c-},666)dnl
        !           493: __devitem(cfo,cgfourteen*)dnl
        !           494: _mcdev(cfo,cgfourteen*,cgfourteen,{-major_cfo_c-})dnl
        !           495: __devitem(tcx,tcx*)dnl
        !           496: _mcdev(tcx,tcx*,tcx,{-major_tcx_c-})dnl
        !           497: __devitem(cry,crypto,hardware crypto access driver)dnl
        !           498: _mkdev(cry,crypto,{-M crypto c major_cry_c-} 0)dnl
        !           499: __devitem(pf,pf*,Packet Filter)dnl
        !           500: _mkdev(pf,{-pf*-},{-M pf c major_pf_c 0 600-})dnl
        !           501: __devitem(bpf,bpf*,Berkeley Packet Filter)dnl
        !           502: _mkdev(bpf,{-bpf*-},{-M bpf$U c major_bpf_c $U 600-},600)dnl
        !           503: _mkdev(tun,{-tun*-},{-M tun$U c major_tun_c $U 600-},600)dnl
        !           504: __devitem(altq,altq/,ALTQ control interface)dnl
        !           505: _mkdev(altq,altq,{-RMlist="mkdir -p altq;$RMlist"
        !           506:        for d in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq; do
        !           507:                M altq/$d c major_altq_c $U 644
        !           508:                U=Add($U,1)
        !           509:        done-})dnl
        !           510: __devitem(speak,speaker,pc speaker)dnl
        !           511: __devitem(kbd,kbd,keyboard (provides events, for X11))dnl
        !           512: _cdev(kbd,kbd,{-major_kbd_c-},0,600)dnl
        !           513: __devitem(kbd_atari,kbd,Atari keyboard)dnl
        !           514: __devitem(akbd,kbd,Amiga keyboard)dnl
        !           515: __devitem(rkbd,kbd,raw keyboard)dnl
        !           516: __devitem(kbdctl,kbdctl,keyboard control)dnl
        !           517: __devitem(beep,beep,riscpc speaker)dnl
        !           518: __devitem(iic,iic*,IIC bus device)dnl
        !           519: __devitem(rtc,rtc*,RTC device)dnl
        !           520: __devitem(view,view*,generic interface to graphic displays)dnl
        !           521: __devitem(aconf,aconf,{-autoconfig information (not yet)-})dnl
        !           522: __devitem(mouse-,mouse-*,"mouse link")dnl
        !           523: __devitem(mouse,mouse,mouse (provides events, for X11))dnl
        !           524: __devitem(mouse_atari,mouse*,Atari mice)dnl
        !           525: _cdev(mouse,mouse,30,0,666)dnl
        !           526: __devitem(amouse,mouse*,Amiga mice)dnl
        !           527: __devitem(lkm,lkm,loadable kernel modules interface)dnl
        !           528: _cdev(lkm,lkm,{-major_lkm_c-},0,640,kmem)dnl
        !           529: __devitem(mmcl,mmclock,memory mapped clock)dnl
        !           530: __devitem(tun,tun*,network tunnel driver)dnl
        !           531: __devitem(rnd,*random,inkernel random data source)dnl
        !           532: _mkdev(rnd,*random,{-n=0
        !           533:        for pre in " " s u p a
        !           534:        do
        !           535:                M ${pre}random c major_rnd_c $n 644
        !           536:                n=Add($n,1)
        !           537:        done-},644)dnl
        !           538: __devitem(joy,joy*,joystick driver)dnl
        !           539: _mcdev(joy,joy*,joy,{-major_joy_c-},600)dnl
        !           540: __devitem(mag,magma*,magma card (makes 16 tty and 2 bpp))dnl
        !           541: __devitem(xfs,xfs*,XFS filesystem devices)dnl
        !           542: _mcdev(xfs,xfs*,xfs,{-major_xfs_c-},600)dnl
        !           543: __devitem(hil,hil,HIL input devices)dnl
        !           544: __devitem(rmidi,rmidi*,raw midi devices)dnl
        !           545: _mcdev(rmidi,rmidi*,rmidi,{-major_rmidi_c-},666)dnl
        !           546: __devtitle(plat,Platform-specific devices)dnl
        !           547: __devitem(fb,fb*,framebuffer device)dnl
        !           548: __devitem(bktr,bktr*,video capturing)dnl
        !           549: _mcdev(bktr,bktr*,bktr,{-major_bktr_c-},644)dnl
        !           550: __devitem(tuner,tuner*,tuner device)dnl
        !           551: _mkdev(tuner,tuner*,{-M tuner$U c major_tuner_c Add(Mult($U,2),16) 644-},644)dnl
        !           552: _mkdev(local,local,{-test -s $T.local && sh $T.local-},666)dnl
        !           553: dnl
        !           554: divert(1)dnl
        !           555: include(etc.MACHINE/MAKEDEV.md)dnl
        !           556: dnl
        !           557: dnl define DISK_STEPPING in the above file if other than 16
        !           558: dnl
        !           559: ifdef({-DISK_STEPPING-},,{-define({-DISK_STEPPING-},{-16-})-})dnl
        !           560: dnl
        !           561: divert(0)dnl
        !           562: #!/bin/sh -
        !           563: #
        !           564: # THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
        !           565: # generated from:
        !           566: #
        !           567: show_vers()dnl <-- now that all files are included, show versions
        !           568: #
        !           569: #      $OpenBSD$
        !           570: dnl
        !           571: divert(2)dnl
        !           572: PATH=/sbin:/usr/sbin:/bin:/usr/bin
        !           573: T=$0
        !           574:
        !           575: # set this to echo for Echo-Only debugging
        !           576: [ "$eo" ] || eo=
        !           577:
        !           578: hex()
        !           579: {
        !           580:        case ${--}1 in
        !           581:                [0-9]) echo -n {-$-}1;;
        !           582:                10) echo -n a;;
        !           583:                11) echo -n b;;
        !           584:                12) echo -n c;;
        !           585:                13) echo -n d;;
        !           586:                14) echo -n e;;
        !           587:                15) echo -n f;;
        !           588:        esac
        !           589: }
        !           590: trunc()
        !           591: {
        !           592:        # XXX pdksh can't seem to deal with locally scoped variables
        !           593:        # in ${foo#$bar} expansions
        !           594:        arg1="{-$-}1"
        !           595:        arg2="{-$-}2"
        !           596:        case {-$-}3 in
        !           597:        l)   echo ${arg2#$arg1} ;;
        !           598:        r|*) echo ${arg1#$arg2} ;;
        !           599:        esac
        !           600: }
        !           601: unt()
        !           602: {
        !           603:        # XXX pdksh can't seem to deal with locally scoped variables
        !           604:        # in ${foo#$bar} expansions
        !           605:        arg="{-$-}1"
        !           606:        tmp="${arg#[a-zA-Z]*}"
        !           607:        tmp="${tmp%*[a-zA-Z]}"
        !           608:        while [ "$tmp" != "$arg" ]
        !           609:        do
        !           610:                arg=$tmp
        !           611:                tmp="${arg#[a-zA-Z]*}"
        !           612:                tmp="${tmp%*[a-zA-Z]}"
        !           613:        done
        !           614:        echo $arg
        !           615: }
        !           616: dnl
        !           617: dnl dodisk(name,unit,blkmaj,chrmaj,unit,off)
        !           618: dnl
        !           619: dodisk()
        !           620: {
        !           621:        n=Add(Mult(${5},DISK_STEPPING),${6}) count=0
        !           622:        RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?"
        !           623:        for d in a b c d e f g h i j k l m n o p
        !           624:        do
        !           625:                M {-$-}1{-$-}2$d        b {-$-}3 Add($n,$count) 640
        !           626:                M r{-$-}1{-$-}2$d       c {-$-}4 Add($n,$count) 640
        !           627:                let count=count+1
        !           628:        done
        !           629:        MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?"
        !           630: }
        !           631: dnl
        !           632: dnl dodisk2(name,unit,blkmaj,chrmaj,unit,off)
        !           633: dnl
        !           634: dnl 1. name    - prefix name of the device
        !           635: dnl 2. unit    - beginning unit number for block devices
        !           636: dnl 3. blkmaj  - block device major number
        !           637: dnl 4. chrmaj  - character device major number
        !           638: dnl 5. unit    - beginning unit number for character devices
        !           639: dnl 6. off     - offset from 0 for all minor numbers (see svnd for an example)
        !           640: dnl
        !           641: dodisk2()
        !           642: {
        !           643:        n=Add(Mult({-$-}5,DISK_STEPPING),{-$-}6)
        !           644:        M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
        !           645:        M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
        !           646:        n=Add($n,2)
        !           647:        M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
        !           648:        M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
        !           649: }
        !           650:
        !           651: # M name b/c major minor [mode] [group]
        !           652: RMlist="rm -f"
        !           653: MKlist=":"
        !           654: mkl() {
        !           655: dnl
        !           656: dnl uncomment if multi mknod happens
        !           657: dnl
        !           658: ifelse(1,0,
        !           659: [ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
        !           660:           mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
        !           661:           modes="$modes {-$-}1"
        !           662:      },
        !           663: dnl
        !           664: dnl non multi mknod
        !           665: dnl
        !           666:  [ "${mklist[{-$-}1]}" ] && {
        !           667:   mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
        !           668:  } || {
        !           669:   mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
        !           670:   modes="$modes {-$-}1"
        !           671:  })
        !           672: }
        !           673: M() {
        !           674:        RMlist="$RMlist {-$-}1"
        !           675:        mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
        !           676:        mklist="$mklist {-$-}1"
        !           677:        G={-$-}{6:-wheel}
        !           678:        [ "{-$-}7" ] && {
        !           679:                MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1"
        !           680:        } || {
        !           681:                case $G in
        !           682:                wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;
        !           683:                esac
        !           684:                [ "${grplist[$g]}" ] && {
        !           685:                        grplist[$g]="${grplist[$g]} {-$-}1"
        !           686:                } || {
        !           687:                        groups="$groups $g"
        !           688:                        grplist[$g]="chgrp $G {-$-}1"
        !           689:                }
        !           690:        }
        !           691:        return 0
        !           692: }
        !           693: divert(7)dnl
        !           694: dnl
        !           695: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
        !           696: dnl on the following line:
        !           697:
        !           698: show_devs()dnl
        !           699: dnl
        !           700: divert(9)dnl
        !           701: *)
        !           702:        echo $i: unknown device
        !           703:        ;;
        !           704: esac
        !           705: done
        !           706: }
        !           707: _recurse "$@"
        !           708: if [ "$os" = "SunOS" ]; then
        !           709:        eo=transform
        !           710:        transform() {
        !           711:                case $mode in
        !           712:                600) mask=077;;
        !           713:                640) mask=027;;
        !           714:                660) mask=007;;
        !           715:                644) mask=022;;
        !           716:                666) mask=0;;
        !           717:                440) mask=227;;
        !           718:                esac
        !           719:                echo `echo "$@"|sed \
        !           720:                        's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
        !           721:                         s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
        !           722:        }
        !           723: fi
        !           724: list="$RMlist"
        !           725: for mode in $modes; do
        !           726:        list="$list;${mklist[$mode]}"
        !           727: done
        !           728: for group in $groups; do
        !           729:        list="$list;${grplist[$group]}"
        !           730: done
        !           731: list="$list;$MKlist"
        !           732: if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
        !           733:        $eo "$list"
        !           734: else
        !           735:        echo "$list" | sh
        !           736: fi
        !           737: divert(3)dnl
        !           738: dnl
        !           739: R() {
        !           740: for i in "$@"
        !           741: do
        !           742: U=`unt $i`
        !           743: [ "$U" ] || U=0
        !           744:
        !           745: case $i in
        !           746: dnl