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

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

1.1       todd        1: include(MAKEDEV.sub)dnl
                      2: dnl
1.35    ! todd        3: vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.34 2002/02/17 05:14:30 deraadt Exp $-})dnl
1.1       todd        4: dnl
                      5: divert(1)dnl
                      6: {-#-}
1.33      deraadt     7: {-#-} Copyright (c) 2001,2002 Todd T. Fries <todd@OpenBSD.org>
1.1       todd        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
1.29      todd       43: dnl  Use '__devitem(uniqueid, name-pattern, description)' to create an entry
1.1       todd       44: dnl  in the description at the top of the generated MAKEDEV file:
                     45: dnl
1.29      todd       46: dnl    __devitem(sca, sca*, Sugar Generic device)dnl
1.1       todd       47: dnl
                     48: dnl  This is ultimately shown as:
                     49: dnl
                     50: dnl    #  sca*   Sugar Generic device
                     51: dnl
1.29      todd       52: dnl  Use '_mkdev(uniqueid, shell-pattern, {-shell-script-})dnl' to create
1.1       todd       53: dnl  a shell script fragment used to 'create' the device (be sure to match
                     54: dnl  the uniqueid from above):
                     55: dnl
1.29      todd       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
1.1       todd       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
1.29      todd       64: dnl In the MAKEDEV.md file, add a '_DEV(uniqueid, charmajor, blockmajor)'
1.1       todd       65: dnl entry:
                     66: dnl
1.29      todd       67: dnl   _DEV(sca, 24, 42)
1.1       todd       68: dnl
                     69: dnl Final step is to add an entry to the 'all' entry below. For a short
                     70: dnl example:
                     71: dnl
1.29      todd       72: dnl   _mkdev({-all-}, {-all-}, {-dnl
                     73: dnl   _dl({-std-}, {-std-}, {-sca-}, {-sca0 sca1 sca2 sca3-})-})dnl
1.1       todd       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
1.31      todd       92: dnl TODO:
                     93: dnl
                     94: dnl make a 'disktgt' macro that automatically does:
1.34      deraadt    95: dnl disktgt(rd, {-rd-})
1.31      todd       96: dnl
                     97: dnl    target(all,rd,0)
                     98: dnl    target(ramd,rd,0)
                     99: dnl    disk_q(rd)
1.34      deraadt   100: dnl    __devitem(rd, {-rd*-}, {-rd-})dnl
1.31      todd      101: dnl
                    102: dnl
1.29      todd      103: _mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
1.1       todd      104: dnl
1.29      todd      105: __devtitle(make, Device "make" file.  Valid arguments)dnl
                    106: __devitem({-all-}, {-all-},
1.4       todd      107: {-makes all known devices{-,-} including local devices.
1.1       todd      108: {-#-}          Tries to make the ``standard'' number of each type.-})dnl
                    109: dnl
                    110: dnl 'all' is special.  The 'D'evice 'L'ist (or _dl) macro checks to see if
                    111: dnl a particular devices is in the MAKEDEV.md file, and if so, includes the
                    112: dnl necessary devices.  Otherwise the devices are not included in the 'all'
                    113: dnl target.  Note this keeps line lengths to less than column 70.  For the
                    114: dnl gory details see the definition of '_dl' in MAKEDEV.sub
                    115: dnl
1.29      todd      116: target(all, mcd, 0)dnl
                    117: twrget(all, fdesc, fd)dnl
                    118: target(all, st, 0, 1)dnl
                    119: target(all, mcd, 0)dnl
                    120: target(all, std)dnl
                    121: target(all, raid, 0, 1, 2, 3)dnl
                    122: target(all, rz, 0, 1, 2, 3, 4)dnl
                    123: target(all, hp, 0, 1, 2, 3)dnl
                    124: target(all, ra, 0, 1, 2, 3)dnl
                    125: target(all, rx, 0, 1)dnl
                    126: target(all, wd, 0, 1, 2, 3)dnl
                    127: target(all, xd, 0, 1, 2, 3)dnl
                    128: twrget(all, aflo, fd, 0, 1, 2, 3)dnl
                    129: target(all, pctr)dnl
                    130: target(all, pctr0)dnl
                    131: target(all, altq)dnl
                    132: target(all, pf)dnl
                    133: twrget(all, cry, crypto)dnl
                    134: target(all, apm)dnl
                    135: twrget(all, tth, ttyh, 0, 1)dnl
                    136: target(all, ttyA, 0, 1)dnl
                    137: target(all, ttyB, 0, 1, 2, 3, 4, 5)dnl
                    138: twrget(all, attyB, ttyB, 0, 1, 2, 3, 4)dnl
                    139: target(all, tty0, 0, 1, 2, 3)dnl
                    140: twrget(all, mac_tty0, tty0, 0, 1)dnl
                    141: twrget(all, tzs, tty, a, b, c, d)dnl
                    142: twrget(all, czs, cua, a, b, c, d)dnl
                    143: target(all, ttyc, 0, 1, 2, 3, 4, 5, 6, 7)dnl
                    144: twrget(all, com, tty0, 0, 1, 2, 3)dnl
                    145: twrget(all, mac_ttye, ttye, 0)dnl
                    146: target(all, ttye, 0, 1, 2, 3, 4, 5, 6)dnl
                    147: target(all, lkm)dnl
                    148: twrget(all, mmcl, mmclock)dnl
                    149: target(all, lpt, 0, 1, 2)dnl
                    150: twrget(all, lpt, lpa, 0, 1, 2)dnl
                    151: target(all, joy, 0, 1)dnl
                    152: target(all, rnd, random)dnl
                    153: target(all, uk, 0)dnl
                    154: target(all, st, 0)dnl
                    155: target(all, wt, 0)dnl
                    156: target(all, wdt, 0)dnl
                    157: twrget(all, au, audio, 0)dnl
                    158: twrget(all, speak, speaker)dnl
                    159: target(all, asc, 0)dnl
                    160: target(all, music, 0)dnl
                    161: target(all, radio, 0)dnl
                    162: target(all, tuner, 0)dnl
                    163: target(all, rmidi, 0, 1, 2, 3, 4, 5, 6, 7)dnl
                    164: target(all, usbs)dnl
                    165: target(all, adb)dnl
                    166: target(all, iop, 0, 1)dnl
                    167: target(all, pci)dnl
                    168: twrget(all, wsmouse, wscons)dnl
                    169: twrget(all, btw, bwtwo, 0)dnl
                    170: twrget(all, ctw, cgtwo, 0)dnl
                    171: twrget(all, ctr, cgthree, 0)dnl
                    172: twrget(all, cfr, cgfour, 0)dnl
                    173: twrget(all, csx, cgsix, 0)dnl
                    174: twrget(all, ceg, cgeight, 0)dnl
                    175: twrget(all, cfo, cgfourteen, 0)dnl
                    176: target(all, tcx, 0)dnl
                    177: twrget(all, grf_mac, grf, 0, 1, 2, 3)dnl
                    178: twrget(all, grf_amiga, grf, 0, 1, 2, 3, 4, 5, 6)dnl
                    179: target(all, par, 0)dnl
                    180: twrget(all, amouse, mouse, 0, 1)dnl
                    181: twrget(all, akbd, kbd)dnl
                    182: target(all, apci, 0)dnl
                    183: target(all, ppi, 0)dnl
                    184: target(all, view0, 0, 1, 2, 3, 4, 5)dnl
                    185: target(all, local)dnl
1.18      todd      186: dnl
1.29      todd      187: _mkdev(all, {-all-}, {-dnl
1.18      todd      188: show_target(all)dnl
                    189: -})dnl
                    190: dnl
1.34      deraadt   191: __devitem(ramdisk, ramdisk, devices to be put on ramdisk-based media)dnl
1.29      todd      192: __devitem(std, {-std-}, standard devices)dnl
1.1       todd      193: dnl
1.18      todd      194: dnl
                    195: dnl
1.1       todd      196: dnl _std
                    197: dnl
                    198: dnl $1: tty
                    199: dnl $2: memstuff
                    200: dnl $3: ksyms
                    201: dnl $4: drum
                    202: dnl $5: klog
                    203: dnl
1.29      todd      204: define({-_std-}, {-dnl
1.1       todd      205: std)
                    206:        M console       c 0 0 600
                    207:        M tty           c $1 0
                    208:        M mem           c $2 0 640 kmem
                    209:        M kmem          c $2 1 640 kmem
                    210:        M null          c $2 2
                    211:        M zero          c $2 12
                    212:        M stdin         c major_fdesc_c 0
                    213:        M stdout        c major_fdesc_c 1
                    214:        M stderr        c major_fdesc_c 2
                    215:        M ksyms         c $3 0 640 kmem
                    216:        M drum          c $4 0 640 kmem
                    217:        M klog          c $5 0 600-})dnl
                    218: dnl
1.29      todd      219: target(usb, usb, 0, 1)dnl
                    220: target(usb, urio, 0)dnl
                    221: twrget(usb, uscan, uscanner, 0)dnl
                    222: target(usb, uhid, 0, 1, 2, 3)dnl
                    223: target(usb, ulpt, 0, 1)dnl
                    224: target(usb, ugen, 0, 1)dnl
                    225: target(usb, utty, 0, 1)dnl
1.18      todd      226: dnl
1.29      todd      227: __devitem({-usbs-}, usbs, make USB devices)dnl
                    228: _mkdev(usbs, usbs, {-dnl
1.18      todd      229: show_target({-usb-})dnl
                    230: -})dnl
1.29      todd      231: __devtitle(tap, Tapes)dnl
                    232: __devitem(wt, {-wt*    -}, QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl
                    233: _mkdev(wt, wt*,
1.1       todd      234: {-name=wt
1.29      todd      235:        n=Mult($U, 8) m=Add($n, 4)
1.1       todd      236:        M $name$U       b major_wt_b $n 640 operator
                    237:        M r$name$U      c major_wt_c $n 640 operator
                    238:        M n$name$U      b major_wt_b $m 640 operator
                    239:        M nr$name$U     c major_wt_c $m 640 operator-})dnl
1.29      todd      240: __devitem(tz, tz*, {-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl
                    241: __devitem(st, {-st*-}, SCSI tapes)dnl
                    242: _mkdev(st, st*, {-n=Mult($U, 16)
1.1       todd      243:        for pre in " " n e en
                    244:        do
                    245:                M ${pre}st$U    b major_st_b $n 660 operator
                    246:                M ${pre}rst$U   c major_st_c $n 660 operator
1.29      todd      247:                n=Add($n, 1)
1.1       todd      248:        done-})dnl
1.29      todd      249: __devitem(ct, ct*, HP300 HP-IB cartridge tape)dnl
                    250: __devitem(mt, mt*, (Magnetic) 9-track reel tape)dnl
                    251: __devitem(ht, ht*, massbus tm03 & tu??)dnl
                    252: __devitem(tm, tm*, unibus tm11 & te10 emulations (e.g. Emulex tc-11))dnl
                    253: __devitem(ts, ts*, unibus ts11)dnl
                    254: __devitem(ut, ut*, unibus tu45 emulations (e.g.si 9700))dnl
                    255: __devtitle(dis, Disks)dnl
                    256: __devitem(rz, rz*, SCSI disks)dnl
1.31      todd      257: __devitem(sd, {-sd*-}, {-SCSI disks, includes flopticals-})dnl
1.29      todd      258: __devitem(hd, {-hd*-}, HP300 HP-IB disks)dnl
                    259: __devitem(cd, {-cd*-}, SCSI cdrom drives)dnl
                    260: __devitem(acd, acd*, ATAPI cdrom drives)dnl
                    261: _mkdev(cd, cd*, {-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl
                    262: __devitem(mcd, mcd*, Mitsumi cdrom drives)dnl
                    263: _mkdev(mcd, mcd*, {-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0{--}ifstep(mcd)dnl
                    264: -})dnl
                    265: __devitem(ch, {-ch*-}, SCSI media changer)dnl
                    266: _mcdev(ch, ch*, ch, {-major_ch_c-}, 660, operator)dnl
                    267: __devitem(uk, uk*, SCSI Unknown device)dnl
                    268: _mcdev(uk, uk*, uk, {-major_uk_c-}, 640, operator)dnl
                    269: __devitem(ss, ss*, SCSI scanners)dnl
1.31      todd      270: _mkdev(ss, ss*, {-M ss$U c major_ss_c Mult($U,16) 640 operator
                    271:        M nss$U c major_ss_c Add(Mult($U,16),1) 640 operator
                    272:        M enss$U c major_ss_c Add(Mult($U,16),3) 640 operator
1.1       todd      273:        RMlist="$RMlist scan$U"
                    274:        MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl
1.29      todd      275: __devitem(ses, ses*, SES/SAF-TE SCSI devices)dnl
                    276: _mkdev(ses, ses*, {-M ses$U c major_ses_c $U 640 operator-})dnl
                    277: __devitem(ramd, ramdisk, makes all devices for a ramdisk kernel)dnl arc
                    278: _mkdev(ramd, ramdisk, {-dnl
1.20      todd      279: show_target(ramd)dnl
                    280: -})dnl
1.29      todd      281: ifelse(MACHINE, mvmeppc, {-dnl
1.32      todd      282: target(all, ses, 0)dnl
                    283: target(all, ch, 0)dnl
                    284: target(all, ss, 0, 1)dnl
                    285: target(all, xfs, 0)dnl
                    286: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    287: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    288: target(all, pty, 0, 1, 2)dnl
                    289: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    290: target(all, tun, 0, 1, 2, 3)dnl
                    291: target(all, xy, 0, 1, 2, 3)dnl
                    292: target(all, rd, 0)dnl
                    293: target(all, cd, 0, 1)dnl
                    294: target(all, sd, 0, 1, 2, 3, 4)dnl
                    295: target(all, vnd, 0, 1, 2, 3)dnl
                    296: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      297: target(ramd, tty0, 0, 1, 2, 3)dnl
                    298: twrget(ramd, wsdisp, ttyC, 0)dnl
                    299: target(ramd, rd, 0)dnl
                    300: target(ramd, wd, 0, 1, 2, 3)dnl
                    301: target(ramd, sd, 0, 1, 2, 3, 4)dnl
                    302: target(ramd, cd, 0, 1)dnl
                    303: target(ramd, st, 0, 1)dnl
                    304: target(ramd, bpf, 0)dnl
                    305: target(ramd, rd, 0)dnl
                    306: -})dnl
                    307: ifelse(MACHINE, sparc, {-dnl
1.32      todd      308: target(all, ses, 0)dnl
                    309: target(all, ch, 0)dnl
                    310: target(all, ss, 0, 1)dnl
                    311: target(all, xfs, 0)dnl
                    312: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    313: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    314: target(all, pty, 0, 1, 2)dnl
                    315: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    316: target(all, tun, 0, 1, 2, 3)dnl
                    317: target(all, xy, 0, 1, 2, 3)dnl
                    318: target(all, hk, 0, 1, 2, 3)dnl
                    319: target(all, rd, 0)dnl
                    320: target(all, cd, 0, 1)dnl
                    321: target(all, sd, 0, 1, 2, 3, 4)dnl
                    322: target(all, vnd, 0, 1, 2, 3)dnl
                    323: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      324: target(ramd, fd, 0)dnl
                    325: target(ramd, sd, 0, 1, 2, 3)dnl
                    326: target(ramd, rd, 0)dnl
                    327: target(ramd, cd, 0)dnl
                    328: -})dnl
                    329: ifelse(MACHINE, sparc64, {-dnl
1.35    ! todd      330: twrget(wscons, wscons, ttyD, cfg, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b)dnl
1.32      todd      331: target(all, ccd, 0, 1, 2, 3)dnl
                    332: target(all, ses, 0)dnl
                    333: target(all, ch, 0)dnl
                    334: target(all, ss, 0, 1)dnl
                    335: target(all, xfs, 0)dnl
                    336: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    337: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    338: target(all, pty, 0, 1, 2)dnl
                    339: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    340: target(all, tun, 0, 1, 2, 3)dnl
                    341: target(all, xy, 0, 1, 2, 3)dnl
                    342: target(all, rd, 0)dnl
                    343: target(all, cd, 0, 1)dnl
                    344: target(all, sd, 0, 1, 2, 3, 4)dnl
                    345: target(all, vnd, 0, 1, 2, 3)dnl
1.29      todd      346: target(ramd, fd, 0)dnl
                    347: target(ramd, rd, 0)dnl
                    348: target(ramd, sd, 0, 1, 2, 3)dnl
                    349: target(ramd, wd, 0, 1, 2, 3)dnl
                    350: target(ramd, cd, 0, 1)dnl
                    351: target(ramd, st, 0, 1)dnl
                    352: target(ramd, bpf, 0)dnl
                    353: twrget(all, s64_tzs, tty, a, b, c, d)dnl
                    354: twrget(all, s64_czs, cua, a, b, c, d)dnl
                    355: __devitem(s64_tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl
                    356: __devitem(s64_czs, cua[a-z]*, Zilog 8530 Serial Port)dnl
                    357: _mkdev(s64_tzs, {-tty[a-z]-}, {-u=${i#tty*}
1.23      todd      358:        case $u in
                    359:        a) n=0 ;;
                    360:        b) n=1 ;;
                    361:        c) n=2 ;;
                    362:        d) n=3 ;;
                    363:        *) echo unknown tty device $i ;;
                    364:        esac
                    365:        M tty$u c major_s64_tzs_c $n 660 dialer uucp-})dnl
1.29      todd      366: _mkdev(s64_czs, cua[a-z], {-u=${i#cua*}
1.23      todd      367:        case $u in
                    368:        a) n=0 ;;
                    369:        b) n=1 ;;
                    370:        c) n=2 ;;
                    371:        d) n=3 ;;
                    372:        *) echo unknown cua device $i ;;
                    373:        esac
1.29      todd      374:        M cua$u c major_s64_czs_c Add($n, 128) 660 dialer uucp-})dnl
1.18      todd      375: -})dnl
1.29      todd      376: ifelse(MACHINE, i386, {-dnl
1.32      todd      377: target(all, ses, 0)dnl
                    378: target(all, ch, 0)dnl
                    379: target(all, ss, 0, 1)dnl
                    380: target(all, xfs, 0)dnl
                    381: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    382: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    383: target(all, pty, 0, 1, 2)dnl
                    384: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    385: target(all, tun, 0, 1, 2, 3)dnl
                    386: target(all, xy, 0, 1, 2, 3)dnl
                    387: target(all, rd, 0)dnl
                    388: target(all, cd, 0, 1)dnl
                    389: target(all, sd, 0, 1, 2, 3, 4)dnl
                    390: target(all, vnd, 0, 1, 2, 3)dnl
                    391: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      392: target(ramd, tty0, 0, 1, 2, 3)dnl
                    393: twrget(ramd, wsdisp, ttyC, 0)dnl
                    394: target(ramd, wt, 0)dnl
                    395: target(ramd, fd, 0)dnl
                    396: target(ramd, rd, 0)dnl
                    397: target(ramd, wd, 0, 1, 2, 3)dnl
                    398: target(ramd, sd, 0, 1, 2, 3)dnl
                    399: target(ramd, cd, 0, 1)dnl
                    400: target(ramd, st, 0, 1)dnl
                    401: target(ramd, mcd, 0)dnl
                    402: -})dnl
                    403: ifelse(MACHINE, alpha, {-dnl
1.32      todd      404: target(all, ses, 0)dnl
                    405: target(all, ch, 0)dnl
                    406: target(all, ss, 0, 1)dnl
                    407: target(all, xfs, 0)dnl
                    408: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    409: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    410: target(all, pty, 0, 1, 2)dnl
                    411: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    412: target(all, tun, 0, 1, 2, 3)dnl
                    413: target(all, xy, 0, 1, 2, 3)dnl
                    414: target(all, rd, 0)dnl
                    415: target(all, cd, 0, 1)dnl
                    416: target(all, sd, 0, 1, 2, 3, 4)dnl
                    417: target(all, vnd, 0, 1, 2, 3)dnl
                    418: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      419: target(ramd, sd, 0, 1, 2)dnl
                    420: target(ramd, wd, 0)dnl
                    421: target(ramd, tty0, 0, 1)dnl
                    422: target(ramd, st, 0)dnl
                    423: target(ramd, cd, 0)dnl
                    424: target(ramd, ttyB, 0, 1)dnl
                    425: target(ramd, ttyE, 0, 1)dnl
                    426: -})dnl
                    427: ifelse(MACHINE, amiga, {-dnl
1.32      todd      428: target(all, ses, 0)dnl
                    429: target(all, ch, 0)dnl
                    430: target(all, ss, 0, 1)dnl
                    431: target(all, xfs, 0)dnl
                    432: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    433: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    434: target(all, pty, 0, 1, 2)dnl
                    435: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    436: target(all, tun, 0, 1, 2, 3)dnl
                    437: target(all, xy, 0, 1, 2, 3)dnl
                    438: target(all, rd, 0)dnl
                    439: target(all, cd, 0, 1)dnl
                    440: target(all, sd, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    441: target(all, vnd, 0, 1, 2, 3)dnl
                    442: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      443: target(ramd, kbd)dnl
                    444: target(ramd, pty, 0)dnl
                    445: target(ramd, tty0, 0)dnl
                    446: target(ramd, ttyA, 0, 1)dnl
                    447: target(ramd, ttyB, 0, 1)dnl
                    448: target(ramd, ttye, 0, 1, 2, 3, 4, 5, 6)dnl
                    449: target(ramd, cd, 0, 1)dnl
                    450: target(ramd, sd, 0, 1, 2, 3)dnl
                    451: target(ramd, st, 0, 1)dnl
                    452: target(ramd, fd, 0, 1)dnl
                    453: target(ramd, wd, 0, 1)dnl
                    454: target(ramd, rd, 0)dnl
1.21      todd      455: -})dnl
1.29      todd      456: ifelse(MACHINE, hp300, {-dnl
1.32      todd      457: target(all, ses, 0)dnl
                    458: target(all, ch, 0)dnl
                    459: target(all, ss, 0, 1)dnl
                    460: target(all, xfs, 0)dnl
                    461: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    462: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    463: target(all, pty, 0, 1, 2)dnl
                    464: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    465: target(all, tun, 0, 1, 2, 3)dnl
                    466: target(all, xy, 0, 1, 2, 3)dnl
                    467: target(all, rd, 0)dnl
                    468: target(all, cd, 0, 1)dnl
                    469: target(all, sd, 0, 1, 2, 3, 4)dnl
                    470: target(all, vnd, 0, 1, 2, 3)dnl
1.29      todd      471: _mkdev(st_hp300, ct*|mt*|st*,
1.27      todd      472: {-case $i in
                    473:        ct*) name=ct blk=major_ct_b chr=major_ct_c;;
                    474:        mt*) name=mt blk=major_mt_b chr=major_mt_c;;
                    475:        st*) name=st blk=major_st_hp300_b chr=major_st_hp300_c;;
                    476:        esac
                    477:        case $U in
                    478:        [0-7])
1.29      todd      479:                four=Add($U, 4) eight=Add($U, 8)
                    480:                twelve=Add($U, 12) twenty=Add($U, 20)
1.27      todd      481:                M r$name$U      c $chr $U 660 operator
                    482:                M r$name$four   c $chr $four 660 operator
                    483:                M r$name$eight  c $chr $eight 660 operator
                    484:                M r$name$twelve c $chr $twelve 660 operator
                    485:                MKlist="$MKlist;ln r$name$four nr$name$U";: sanity w/pdp11 v7
                    486:                MKlist="$MKlist;ln r$name$twelve nr$name$eight";: ditto
                    487:                RMlist="$RMlist nr$name$U nr$name$eight"
                    488:                ;;
                    489:        *)
                    490:                echo bad unit for tape in: $1
                    491:                ;;
                    492:        esac-})dnl
1.29      todd      493: __devitem(st_hp300, st*, Exabyte tape)dnl
                    494: __devitem(grf, grf*, raw interface to HP300 graphics devices)dnl
1.32      todd      495: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      496: target( all, grf, 0)dnl
                    497: dnl XXX target( all, hil, 0, 1, 2, 3, 4, 5, 6, 7)dnl
                    498: target( all, hil, )dnl
                    499: twrget( all, st_hp300, st, 0, 1)dnl
                    500: target( all, dca, 0, 1)dnl
                    501: target( all, dcm, 0, 1, 2, 3)dnl
                    502: target( all, hd, 0, 1, 2)dnl
                    503: target( all, ct, 0, 1)dnl
                    504: target( all, ite, 0)dnl
                    505: target(ramd, ct, 0, 1)dnl
                    506: target(ramd, hd, 0, 1, 2)dnl
                    507: target(ramd, sd, 0, 1, 2)dnl
                    508: target(ramd, rd, 0, 1)dnl
                    509: target(ramd, pty, 0)dnl
                    510: target(ramd, hil, )dnl
                    511: target(ramd, grf, 0)dnl
                    512: target(ramd, apci, 0)dnl
                    513: target(ramd, ite, 0)dnl
                    514: target(ramd, dca, 0)dnl
                    515: target(ramd, dcm, 0, 1)dnl
                    516: target(ramd, bpf, 0, 1)dnl
                    517: target(ramd, tun, 0, 1)dnl
                    518: -})dnl
                    519: ifelse(MACHINE, hppa, {-dnl
1.32      todd      520: target(all, ses, 0)dnl
                    521: target(all, ch, 0)dnl
                    522: target(all, ss, 0, 1)dnl
                    523: target(all, xfs, 0)dnl
                    524: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    525: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    526: target(all, pty, 0, 1, 2)dnl
                    527: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    528: target(all, tun, 0, 1, 2, 3)dnl
                    529: target(all, xy, 0, 1, 2, 3)dnl
                    530: target(all, rd, 0)dnl
                    531: target(all, cd, 0, 1)dnl
                    532: target(all, sd, 0, 1, 2, 3, 4)dnl
                    533: target(all, vnd, 0, 1, 2, 3)dnl
                    534: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      535: target(ramd, st, 0, 1)dnl
                    536: target(ramd, sd, 0, 1, 2, 3)dnl
                    537: target(ramd, rd, 0, 1)dnl
                    538: target(ramd, pty, 0)dnl
                    539: target(ramd, hil)dnl
                    540: target(ramd, com, 0, 1)dnl
                    541: target(ramd, bpf, 0, 1)dnl
                    542: target(ramd, tun, 0, 1)dnl
                    543: -})dnl
                    544: ifelse(MACHINE, mac68k, {-dnl
1.32      todd      545: target(all, ses, 0)dnl
                    546: target(all, sd, 0, 1, 2, 3, 4)dnl
                    547: target(all, vnd, 0, 1, 2, 3)dnl
                    548: target(all, ch, 0)dnl
                    549: target(all, ss, 0, 1)dnl
                    550: target(all, xfs, 0)dnl
                    551: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    552: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    553: target(all, pty, 0, 1, 2)dnl
                    554: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    555: target(all, tun, 0, 1, 2, 3)dnl
                    556: target(all, xy, 0, 1, 2, 3)dnl
                    557: target(all, rd, 0)dnl
                    558: target(all, cd, 0, 1)dnl
                    559: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      560: target(ramd, sd, 0, 1, 2, 3)dnl
                    561: target(ramd, st, 0, 1)dnl
                    562: target(ramd, adb)dnl
                    563: target(ramd, asc, 0)dnl
                    564: target(ramd, grf, 0, 1)dnl
                    565: target(ramd, ttye, 0)dnl
                    566: twrget(ramd, mac_tty0, tty0, 0, 1)dnl
                    567: target(ramd, pty, 0)dnl
                    568: -})dnl
                    569: ifelse(MACHINE, macppc, {-dnl
1.32      todd      570: target(all, ses, 0)dnl
                    571: target(all, ch, 0)dnl
                    572: target(all, ss, 0, 1)dnl
                    573: target(all, xfs, 0)dnl
                    574: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    575: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    576: target(all, pty, 0, 1, 2)dnl
                    577: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    578: target(all, tun, 0, 1, 2, 3)dnl
                    579: target(all, xy, 0, 1, 2, 3)dnl
                    580: target(all, rd, 0)dnl
                    581: target(all, cd, 0, 1)dnl
                    582: target(all, sd, 0, 1, 2, 3, 4)dnl
                    583: target(all, vnd, 0, 1, 2, 3)dnl
                    584: target(all, ccd, 0, 1, 2, 3)dnl
1.29      todd      585: target(ramd, sd, 0, 1, 2, 3, 4)dnl
                    586: target(ramd, wd, 0, 1, 2, 3, 4)dnl
                    587: target(ramd, st, 0, 1)dnl
                    588: target(ramd, cd, 0, 1)dnl)dnl
                    589: target(ramd, rd, 0)dnl
                    590: target(ramd, ttyE, 0)dnl
                    591: target(ramd, tty0, 0, 1)dnl
                    592: target(ramd, pty, 0)dnl
                    593: -})dnl
1.32      todd      594: ifelse(MACHINE, sun3, {-
                    595: target(all, ses, 0)dnl
                    596: target(all, ch, 0)dnl
                    597: target(all, ss, 0, 1)dnl
                    598: target(all, xfs, 0)dnl
                    599: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    600: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    601: target(all, pty, 0, 1, 2)dnl
                    602: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    603: target(all, tun, 0, 1, 2, 3)dnl
                    604: target(all, xy, 0, 1, 2, 3)dnl
                    605: target(all, hk, 0, 1, 2, 3)dnl
                    606: target(all, rd, 0)dnl
                    607: target(all, cd, 0, 1)dnl
                    608: target(all, sd, 0, 1, 2, 3, 4)dnl
                    609: target(all, vnd, 0, 1, 2, 3)dnl
                    610: target(all, ccd, 0, 1, 2, 3)dnl
                    611: -})dnl
1.29      todd      612: ifelse(MACHINE, vax, {-
1.32      todd      613: dnl target(all, ses, 0)dnl
                    614: dnl target(all, ut, 0)dnl
                    615: dnl target(all, ch, 0)dnl
                    616: target(all, ss, 0)dnl
                    617: dnl target(all, xfs, 0)dnl
                    618: target(all, pty, 0, 1)dnl
                    619: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7)dnl
                    620: target(all, tun, 0, 1)dnl
                    621: dnl target(all, xy, 0, 1, 2, 3)dnl
                    622: dnl target(all, hk, 0, 1, 2, 3)dnl
                    623: dnl target(all, up, 0, 1, 2, 3)dnl
                    624: dnl target(all, rd, 0)dnl
                    625: target(all, cd, 0)dnl
                    626: target(all, sd, 0, 1, 2, 3)dnl
                    627: target(all, vnd, 0)dnl
1.30      todd      628: __devitem(dhu, dhu*, unibus dhu11)dnl
                    629: __devitem(dmz, dmz*, unibus dmz32)dnl
                    630: __devitem(dmf, dmf*, unibus dmf32)dnl
                    631: __devitem(dh, dh*, {-unibus dh11 and emulations (e.g. Able dmax, Emulex cs-11)-})
                    632: __devitem(vt, vt*, {-console-})dnl
                    633: __devitem(dz, dz*, unibus dz11 and dz32)dnl
1.31      todd      634: __devitem(dl, dl*, unibus dl11)dnl
1.30      todd      635: _mkdev(dz, dz*,
1.31      todd      636: {-case $U in
1.30      todd      637:        [0-7])
                    638:               i=0
                    639:               while [ $i -lt 8 ]; do
1.31      todd      640:                       no=Add(Mult($U, 8), $i)
1.30      todd      641:                       if [ $no -lt 10 ]; then
                    642:                               no="0${no}"
                    643:                       fi
1.31      todd      644:                       M tty${no} c 1 $no 600
                    645:                       let i=i+1
1.30      todd      646:               done
                    647:               ;;
                    648:        *)
                    649:               echo bad unit for dz in: $i
                    650:               ;;
                    651:        esac-})dnl
                    652: dnl XXX split this up abit?
1.31      todd      653: _mkdev(dhu, dhu*|dmz*|dmf*|dh*|vt*,
1.30      todd      654: {-set -A cnvtbl 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v
                    655:        case $i in
                    656:        vt*)    name=vt; major=68; count=8;
1.31      todd      657:                case $U in
1.30      todd      658:                0) ch=w ;;
                    659:                *) echo bad unit for $name in: $i ;;
                    660:                esac;;
                    661:        dmz*)   name=dmz; major=37; count=24;
1.31      todd      662:                case $U in
1.30      todd      663:                0) ch=a ;; 1) ch=b ;; 2) ch=c ;; 3) ch=e ;; 4) ch=f ;;
                    664:                *) echo bad unit for $name in: $i ;;
                    665:                esac;;
                    666:        dmf*)   name=dmf; major=22; count=8;
1.31      todd      667:                case $U in
1.30      todd      668:                0) ch=A ;; 1) ch=B ;; 2) ch=C ;; 3) ch=E ;;
                    669:                4) ch=F ;; 5) ch=G ;; 6) ch=H ;; 7) ch=I ;;
                    670:                *) echo bad unit for $name in: $i ;;
                    671:                esac;;
                    672:        dhu*)   name=dhu; major=34; count=16;
1.31      todd      673:                case $U in
1.30      todd      674:                0) ch=S ;; 1) ch=T ;; 2) ch=U ;; 3) ch=V ;;
                    675:                4) ch=W ;; 5) ch=X ;; 6) ch=Y ;; 7) ch=Z ;;
                    676:                *) echo bad unit for $name in: $i ;;
                    677:                esac;;
                    678:        dh*)    name=dh; major=12; count=16;
1.31      todd      679:                case $U in
1.30      todd      680:                0) ch=h ;; 1) ch=i ;; 2) ch=j ;; 3) ch=k ;;
                    681:                4) ch=l ;; 5) ch=m ;; 6) ch=n ;; 7) ch=o ;;
                    682:                *) echo bad unit for $name in: $i ;;
                    683:                esac;;
                    684:        esac
                    685:        i=0
                    686:        while [ $i -lt $count ]; do
                    687:                let=${cnvtbl[$i]}
                    688:                if [ -n "$let" ] ;then
1.31      todd      689:                        M tty${ch}${let} c $major Add(Mult($U, $count), $i) 600
1.30      todd      690:                else
1.31      todd      691:                        echo bad count for ${name}: $U, $count, $i
1.30      todd      692:                fi
1.31      todd      693:                let i=i+1
1.30      todd      694:        done
                    695:        ;;
                    696:
                    697: dl*)
                    698:        major=66
1.31      todd      699:        let=${cnvtbl[$U]}
1.30      todd      700:        if [ -n "$let" ] ;then
1.31      todd      701:                M ttyJ${let} c $major $U 600
1.30      todd      702:        else
1.31      todd      703:                echo bad number for ${name}: $U
1.30      todd      704:        fi-})dnl
                    705: dnl
1.32      todd      706: target( all, ccd, 0)dnl
1.29      todd      707: target( all, hd, 0, 1, 2)dnl
1.31      todd      708: target( all, mt, 0, 1)dnl
                    709: target( all, ts, 0, 1)dnl
1.30      todd      710: target( all, uu, 0)dnl
1.31      todd      711: target( all, st, 0, 1)dnl
1.30      todd      712: target( all, dhu, 0)dnl
1.32      todd      713: dnl target( all, dmz, 0)dnl
                    714: dnl target( all, dmf, 0)dnl
                    715: dnl target( all, dh, 0)dnl
1.30      todd      716: target( all, dz, 0)dnl
1.31      todd      717: target( all, dl, 0)dnl
                    718: target( all, vt, 0)dnl
1.29      todd      719: target(ramd, fd, 0)dnl
                    720: target(ramd, sd, 0, 1, 2, 3)dnl
                    721: target(ramd, rd, 0)dnl
                    722: target(ramd, cd, 0)dnl
                    723: target(ramd, bpf, 0)dnl
                    724: -})dnl
                    725: target(ramd, std)dnl
                    726: target(ramd, random)dnl
                    727: target(ramd, bpf, 0)dnl
1.34      deraadt   728: __devitem(rd, {-rd*-}, "rd" pseudo-disks)dnl
1.29      todd      729: _mkdev(rd, rd*, {-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
                    730: __devitem(xd, xd*, Xylogic 753/7053 disks)dnl
                    731: __devitem(xy, xy*, {-  Xylogic 450/451 disks-})dnl
                    732: __devitem(flo, {-fd*-}, {-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl
                    733: _mkdev(flo, fd*,
1.1       todd      734: {-typnam=$U${i#fd[01]*}
                    735:        case $typnam in
                    736:        0|1)    typnum=0;; # no type specified, assume A
1.26      deraadt   737:        *A)     typnum=0; typnam=0;;
                    738:        *B)     typnum=1;;
                    739:        *C)     typnum=2;;
                    740:        *D)     typnum=3;;
                    741:        *E)     typnum=4;;
                    742:        *F)     typnum=5;;
                    743:        *G)     typnum=6;;
                    744:        *H)     typnum=7;;
                    745:        *)      echo bad type $typnam for $i; exit 1;;
1.1       todd      746:        esac
                    747:        case $U in
                    748:        0|1)    blk=major_flo_b; chr=major_flo_c;;
                    749:        *)      echo bad unit $U for $i; exit 1;;
                    750:        esac
                    751:        nam=fd${typnam}
1.29      todd      752:        n=Add(Mult($U, 128), Mult($typnum, 16))
1.1       todd      753:        M ${nam}a       b $blk $n 640 operator
1.29      todd      754:        M ${nam}b       b $blk Add($n, 1) 640 operator
                    755:        M ${nam}c       b $blk Add($n, 2) 640 operator
1.1       todd      756:        M r${nam}a      c $chr $n 640 operator
1.29      todd      757:        M r${nam}b      c $chr Add($n, 1) 640 operator
                    758:        M r${nam}c      c $chr Add($n, 2) 640 operator-}, 664)dnl
                    759: __devitem(aflo, ramdisk, devices needed for install floppies)dnl
                    760: _mkdev(aflo, fd*, {-case $U in 0|1|2|3)
                    761:        M fd${U}a b major_aflo_b Mult($U, 16) 640 operator
                    762:        M fd${U}b b major_aflo_b Add(Mult($U, 16), 1) 640 operator
                    763:        M rfd${U}a c major_aflo_c Mult($U, 16) 640 operator
                    764:        M rfd${U}b c major_aflo_c Add(Mult($U, 16), 1) 640 operator;;
1.1       todd      765:        *) echo bad unit for floppy disk in: $i;;
                    766:        esac-})dnl
1.29      todd      767: __devitem(iop, iop*, I2O controller device)dnl
                    768: _mcdev(iop, iop*, iop, {-major_iop_c-}, 660)dnl
                    769: __devitem(wdt, wdt0, watchdog timer)dnl
                    770: _mcdev(wdt, wdt0, wdt, {-major_wdt_c-}, 440, operator)dnl
                    771: __devitem(local, local, configuration specific devices)dnl
                    772: __devitem(wd, {-wd*-}, {-"winchester" disk drives (ST506, IDE, ESDI, RLL, ...)-})dnl
                    773: __devitem(ccd, ccd*, concatenated disk devices)dnl
                    774: __devitem(raid, raid*, RAIDframe disk devices)dnl
                    775: __devitem(vnd, vnd*, "file" pseudo-disks)dnl
                    776: _mkdev(vnd, vnd*, {-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)
1.6       todd      777:        dodisk svnd $U major_vnd_b major_vnd_c $U 128{--}ifstep(vnd)-})dnl
1.29      todd      778: __devitem(ra, ra*, {-MSCP disks (ra??, hd??)-})dnl
                    779: __devitem(hp, hp*, {-massbuss rm??-})dnl
                    780: __devitem(hk, hk*, {-unibus rk06 and rk07-})dnl
                    781: __devitem(up, up*, {-other unibus devices (e.g. on Emulex sc-21v controller)-})dnl
                    782: __devitem(rb, rb*, {-730 idc w/ rb80 and/or rb02-})dnl
                    783: __devitem(rx, rx*, {-MSCP floppy disk (rx33/50/...)-})dnl
                    784: __devitem(rl, rl*, {-unibus r102-})dnl
                    785: __devitem(hd, hd*, {-HDC9224 hd disks on VS2000-})dnl
1.1       todd      786: dnl
                    787: dnl For normal disk devices, add a disk_q entry; anything else define like
                    788: dnl the rest (such as vnd above).
                    789: dnl
1.18      todd      790: disk_q({-ccd-})dnl
                    791: disk_q({-hd-})dnl
                    792: disk_q({-hk-})dnl
                    793: disk_q({-hp-})dnl
                    794: disk_q({-ra-})dnl
                    795: disk_q({-raid-})dnl
                    796: disk_q({-rb-})dnl
                    797: disk_q({-rl-})dnl
                    798: disk_q({-rx-})dnl
                    799: disk_q({-sd-})dnl
1.1       todd      800: disk_q({-xy-})dnl
                    801: disk_q({-xd-})dnl
1.18      todd      802: disk_q({-up-})dnl
                    803: disk_q({-wd-})dnl
1.1       todd      804: disk_q({-rz-})dnl
                    805: dnl
1.29      todd      806: __devitem(loc, local, configuration specific devices)dnl
                    807: _mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
                    808: _mkdev({-disks-}, {-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
1.1       todd      809: {-case $i in
                    810: show_disks2()dnl
1.6       todd      811:        esac-})dnl
1.1       todd      812: __mkdev({-disks-}){--}dnl
                    813: dnl
1.29      todd      814: __devtitle(cons, Console ports)dnl
                    815: __devitem(ttyv0, ttyv0, pccons or pcvt screen 0)dnl
                    816: __devitem(ttyv, ttyv*, pcvt)dnl
                    817: __devitem(ttye, ttye*, ite bitmapped consoles)dnl
                    818: __devitem(mac_ttye, ttye*, ite bitmapped consoles)dnl
                    819: __devitem(wscons, ttyC0, wscons screen 0)dnl
1.35    ! todd      820: twrget(wscons, wscons, ttyC, cfg, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b)dnl
        !           821: target(wscons, wsmux)dnl
        !           822: target(wscons, wskbd, 0, 1, 2, 3)dnl
        !           823: target(wscons, wsmouse, 0, 1, 2, 3)dnl
1.29      todd      824: _mkdev({-wscons-}, {-wscons-}, {-dnl
1.35    ! todd      825: show_target(wscons)dnl
        !           826: -})dnl
        !           827: __devitem(wsdisp, tty[C-F]*, wscons virtual consoles)dnl
        !           828: _mkdev({-wsdisp-}, tty[C-F]*, {-U=${i##tty[C-F]}
        !           829:        case $i in
        !           830:        ttyC*) n=C m=expr(0*256);;
        !           831:        ttyD*) n=D m=expr(1*256);;
        !           832:        ttyE*) n=E m=expr(2*256);;
        !           833:        ttyF*) n=F m=expr(3*256);;
        !           834:        esac
1.3       todd      835:        case $U in
1.35    ! todd      836:        [0-9a-f]) M tty$n$U c major_wsdisp_c {-$(( 16#$U + $m ))-} 600;;
        !           837:        cfg) M tty${n}cfg c major_wsdisp_c Add(255,$m) 600;;
1.3       todd      838:        *) echo bad unit $U for $i; exit 1;;
1.6       todd      839:        esac-})dnl
1.29      todd      840: __devitem(wskbd, wskbd*, wscons keyboards)dnl
                    841: _mkdev(wskbd, wskbd*, {-M wskbd$U c major_wskbd_c $U 600-})dnl
                    842: __devitem(wsmux, wsmux, wscons keyboard/mouse mux devices)dnl
                    843: _mkdev(wsmux, wsmux|wsmouse|wskbd, {-M wsmouse c major_wsmux_c 0 600
1.1       todd      844:        M wskbd c major_wsmux_c 1 600-})dnl
1.29      todd      845: __devitem(pcons, console, PROM console)dnl
                    846: __devtitle(point, Pointing devices)dnl
                    847: __devitem(wsmouse, wsmouse*, wscons mice)dnl
                    848: _mkdev(wsmouse, wsmouse*, {-M wsmouse$U c major_wsmouse_c $U 600-})dnl
                    849: __devitem(quad, quadmouse, "quadrature mouse")dnl
                    850: __devtitle(pty, Pseudo terminals)dnl
                    851: __devitem(tty, tty*, set of 16 slave psuedo terminals)dnl
                    852: __devitem(pty, pty*, set of 16 master pseudo terminals)dnl
1.31      todd      853: _mkdev(pty, pty*, {-if [ $U -gt 15 ]; then
                    854:                echo bad unit for pty in: $i
                    855:                continue
                    856:        fi
                    857:        set -A tbl p q r s t u v w x y z P Q R S T
                    858:        name=${tbl[$U]}
1.1       todd      859:        n=0
                    860:        while [ $n -lt 16 ]
                    861:        do
                    862:                nam=$name$(hex $n)
1.31      todd      863:                off=Mult($U, 16)
1.29      todd      864:                M tty$nam c major_tty_c Add($off, $n)
                    865:                M pty$nam c major_pty_c Add($off, $n)
                    866:                n=Add($n, 1)
1.1       todd      867:        done-})dnl
1.29      todd      868: __devitem(dc, dc*, {-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
                    869: __devtitle(prn, Printers)dnl
                    870: __devitem(par, par*, motherboard parallel port)dnl
                    871: __devitem(lpt, lpt*, IEEE 1284 centronics printer)dnl
                    872: _mkdev(lpt, lpt*|lpa*,
1.1       todd      873: {-case $i in
                    874:        lpt*) n=lpt f=0;;
                    875:        lpa*) n=lpa f=128;;
                    876:        esac
1.29      todd      877:        M $n$U c major_lpt_c Add($U, $f) 600-})dnl
                    878: __devitem(lpa, lpa*, interruptless lp)dnl
                    879: __devitem(ppi, ppi*, HP-IB plotters)dnl
                    880: __devtitle({-usb-}, USB devices)dnl
                    881: __devitem({-usb-}, usb*, Bus control devices used by usbd for attach/detach)dnl
                    882: _mkdev({-usb-}, usb*, {-[ "$i" = "usb" ] && u= || u=$U
1.1       todd      883:        M usb$u c major_usb_c $U 660-})dnl
1.29      todd      884: __devitem(uhid, uhid*, Generic HID devices)dnl
                    885: _mcdev({-uhid-}, uhid*, {-uhid-}, {-major_uhid_c-}, 660)dnl
                    886: __devitem(ulpt, ulpt*, Printer devices)dnl
                    887: _mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 660)dnl
                    888: __devitem(utty, utty*, Serial ports)dnl
                    889: _mcdev({-utty-}, utty*, {-utty-}, {-major_utty_c-}, 660)dnl
                    890: __devitem(urio, urio*, Diamond Multimedia Rio 500)dnl
                    891: _mcdev({-urio-}, urio*, {-urio-}, {-major_urio_c-}, 660)dnl
                    892: __devitem(uscan, uscanner*, Scanners)dnl
                    893: _mcdev({-uscan-}, uscanner*, {-uscanner-}, {-major_uscan_c-}, 660)dnl
                    894: __devitem(ugen, ugen*, Generic device)dnl
                    895: _mkdev(ugen, ugen*, {-n=Mult($U, 16)
1.1       todd      896:        for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
                    897:        do
1.29      todd      898:                M ugen$U.$j c major_ugen_c Add($n, $j) 660
1.1       todd      899:        done-})dnl
1.29      todd      900: __devtitle(cpu, Cpus)dnl
                    901: __devitem(cpu, cpu*, cpus)dnl
                    902: __devtitle(call, Call units)dnl
                    903: __devtitle(term, Terminal ports)dnl
                    904: __devtitle(termp, Terminal multiplexers)dnl
                    905: __devitem(dca, dca*, HP200/300 single port serial interface)dnl
                    906: __devitem(dcm, dcm*, HP200/300 4 port serial mux interface)dnl
                    907: __devitem(apci, apci*, HP400 4 port serial mux interface)dnl
                    908: __devitem({-com-}, {-tty0*-}, NS16x50 serial ports)dnl
                    909: _mkdev(com, {-tty0*-}, {-M tty$U c major_com_c $U 660 dialer uucp
                    910:        M cua$U c major_com_c Add($U, 128) 660 dialer uucp-})dnl
                    911: __devitem(ttyc, ttyc*, Cyclades serial ports)dnl
                    912: __devitem(tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl
                    913: _mkdev(tzs, {-tty[a-z]-}, {-u=${i#tty*}
1.1       todd      914:        case $u in
                    915:        a) n=0 ;;
                    916:        b) n=1 ;;
                    917:        c) n=4 ;;
                    918:        d) n=5 ;;
                    919:        *) echo unknown tty device $i ;;
                    920:        esac
                    921:        M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
1.29      todd      922: __devitem(tth, ttyh*, Sab82532 serial devices)dnl
                    923: _mkdev(tth, ttyh*, {-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
                    924: __devitem(czs, cua[a-z]*, Zilog 8530 Serial Port)dnl
                    925: _mkdev(czs, cua[a-z], {-u=${i#cua*}
1.1       todd      926:        case $u in
                    927:        a) n=0 ;;
                    928:        b) n=1 ;;
                    929:        c) n=4 ;;
                    930:        d) n=5 ;;
                    931:        *) echo unknown cua device $i ;;
                    932:        esac
1.29      todd      933:        M cua$u c major_czs_c Add($n, 128) 660 dialer uucp-})dnl
                    934: __devitem(arm_tty, tty*, {-alias for PC COM ports{-,-} this is what the system really wants-})dnl
                    935: __devitem(tty0, tty00, standard serial port)dnl
                    936: __devitem(mac_tty0, tty00, standard serial port)dnl
                    937: __devitem(ttyA, ttyA*, mfc serial ports)dnl
                    938: __devitem(attyB, ttyB*, ISA COM ports)dnl  amiga
                    939: __devitem(ttyz, tty[a-d], onboard zs serial ports)dnl
                    940: __devitem(cuaz, cua[a-d], onboard zs serial ports)dnl
                    941: __devitem(ttyB, ttyB?, DEC 3000 ZS8530 ("scc") serial ports)dnl
                    942: __devitem(scc, scc*, 82530 serial interface)dnl
                    943: __devitem(arc_ttyC, ttyC0, pccons)dnl
                    944: __devitem(i386_ttyC, ttyC*, pcvt)dnl
                    945: __devitem(ttyC, ttyC?, {-AlphaStation NS16550 ("com serial ports")-})dnl
                    946: __devitem(ttyE, ttyE?, Workstation console (framebuffer & keyboard) tty emulators)dnl
                    947: __devitem(ser02, ser02, {-serial2 port (channel A on 8530)-})dnl
                    948: __devitem(mdm02, mdm02, {-modem2 port (channel B on 8530)-})dnl
                    949: __devtitle(spec, Special purpose devices)dnl
                    950: __devitem(apm, apm     , power management device)dnl
                    951: _mkdev(apm, apm*, {-M apm      c major_apm_c 0 644
1.1       todd      952:        M apmctl        c major_apm_c 8 644-})dnl
1.29      todd      953: __devitem(pcmcia, pcmcia*, PCMCIA card drivers)dnl
                    954: __devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl
                    955: _mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl
                    956: __devitem(au, audio*, audio device)dnl
                    957: _mkdev(au, audio*, {-M sound$U c major_au_c $U
                    958:        M mixer$U       c major_au_c Add($U, 16)
                    959:        M audio$U       c major_au_c Add($U, 128)
                    960:        M audioctl$U    c major_au_c Add($U, 192)
1.1       todd      961:        MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
                    962:        MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
                    963:        MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
                    964:        MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
1.29      todd      965: __devitem(asc, asc*, ASC Audio device)dnl
                    966: _mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
                    967: __devitem(music, music*, midi devices)dnl
                    968: _mkdev(music, music*, {-M music$U     c major_music_c $U
                    969:        M sequencer$U c major_music_c Add($U, 128)
1.1       todd      970:        MKlist="$MKlist;[ -e music ] || ln -s music$U music"
                    971:        MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
1.29      todd      972: __devitem(radio, radio*, FM tuner device)dnl
                    973: _mkdev(radio, radio*, {-M radio$U     c major_radio_c $U
1.8       todd      974:        MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl
1.29      todd      975: __devitem(fdesc, fd, makes fd/* for the fdescfs)dnl
                    976: _mkdev(fdesc, fd, {-RMlist="mkdir -p fd;$RMlist" n=0
                    977:        while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
1.1       todd      978:        MKlist="$MKlist;chmod 555 fd"-})dnl
1.29      todd      979: __devtitle(graph, Graphics devices)dnl
                    980: __devitem(grf_mac, grf*, {-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-}
1.1       todd      981: {-#-}          Cirrus boards (grf3){-,-} A2410 (grf4) video or
                    982: {-#-}          CyberVision 64 (grf5)-})dnl
1.29      todd      983: __devitem(grf_amiga, grf*, {-Motherboard bitmapped video.-})dnl
                    984: __devitem(ite, ite*, terminal emulator interface to HP300 graphics devices)dnl
                    985: __devitem({-hil-}, {-hil-}, HP300 HIL input devices)dnl
                    986: __devitem(oppr, openprom)dnl
                    987: _cdev(oppr, openprom, 70, 0)dnl
                    988: __devitem(btw, bwtwo*)dnl
                    989: _mcdev(btw, bwtwo*, bwtwo, {-major_btw_c-}, 666)dnl
                    990: __devitem(ctw, cgtwo*)dnl
                    991: _mcdev(ctw, cgtwo*, cgtwo, {-major_ctw_c-}, 666)dnl
                    992: __devitem(ctr, cgthree*)dnl
                    993: _mcdev(ctr, cgthree*, cgthree, {-major_ctr_c-}, 666)dnl
                    994: __devitem(cfr, cgfour*)dnl
                    995: _mcdev(cfr, cgfour*, cgfour, {-major_cfr_c-}, 666)dnl
                    996: __devitem(csx, cgsix*)dnl
                    997: _mcdev(csx, cgsix*, cgsix, {-major_csx_c-}, 666)dnl
                    998: __devitem(ceg, cgeight*)dnl
                    999: _mcdev(ceg, cgeight*, cgeight, {-major_ceg_c-}, 666)dnl
                   1000: __devitem(cfo, cgfourteen*)dnl
                   1001: _mcdev(cfo, cgfourteen*, cgfourteen, {-major_cfo_c-})dnl
                   1002: __devitem(tcx, tcx*)dnl
                   1003: _mcdev(tcx, tcx*, tcx, {-major_tcx_c-})dnl
                   1004: __devitem(cry, crypto, hardware crypto access driver)dnl
                   1005: _mkdev(cry, crypto, {-M crypto c major_cry_c-} 0)dnl
                   1006: __devitem(pf, pf*, Packet Filter)dnl
                   1007: _mkdev(pf, {-pf*-}, {-M pf c major_pf_c 0 600-})dnl
                   1008: __devitem(bpf, bpf*, Berkeley Packet Filter)dnl
                   1009: _mkdev(bpf, {-bpf*-}, {-M bpf$U c major_bpf_c $U 600-}, 600)dnl
                   1010: _mkdev(tun, {-tun*-}, {-M tun$U c major_tun_c $U 600-}, 600)dnl
                   1011: __devitem(altq, altq/, ALTQ control interface)dnl
                   1012: _mkdev(altq, altq, {-RMlist="mkdir -p altq;$RMlist"
1.1       todd     1013:        for d in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq; do
                   1014:                M altq/$d c major_altq_c $U 644
1.29      todd     1015:                U=Add($U, 1)
1.1       todd     1016:        done-})dnl
1.29      todd     1017: __devitem(speak, speaker, pc speaker)dnl
                   1018: _mkdev(speak, speaker, {-M speaker c major_speak_c 0 600-})dnl
                   1019: __devitem(kbd, kbd, keyboard (provides events, for X11))dnl
                   1020: _cdev(kbd, kbd, {-major_kbd_c-}, 0, 600)dnl
                   1021: __devitem(kbd_atari, kbd, Atari keyboard)dnl
                   1022: __devitem(akbd, kbd, Amiga keyboard)dnl
                   1023: __devitem(rkbd, kbd, raw keyboard)dnl
                   1024: __devitem(kbdctl, kbdctl, keyboard control)dnl
                   1025: __devitem(beep, beep, riscpc speaker)dnl
                   1026: __devitem(iic, iic*, IIC bus device)dnl
                   1027: __devitem(rtc, rtc*, RTC device)dnl
                   1028: __devitem(view, view*, generic interface to graphic displays)dnl
                   1029: __devitem(aconf, aconf, {-autoconfig information (not yet)-})dnl
                   1030: __devitem(mouse-, mouse-*, "mouse link")dnl
                   1031: __devitem(mouse, mouse, mouse (provides events, for X11))dnl
                   1032: __devitem(amouse, mouse*, Amiga mice)dnl
                   1033: __devitem(lkm, lkm, loadable kernel modules interface)dnl
                   1034: _cdev(lkm, lkm, {-major_lkm_c-}, 0, 640, kmem)dnl
                   1035: __devitem(mmcl, mmclock, memory mapped clock)dnl
                   1036: __devitem(tun, tun*, network tunnel driver)dnl
                   1037: __devitem(rnd, *random, inkernel random data source)dnl
                   1038: _mkdev(rnd, *random, {-n=0
1.1       todd     1039:        for pre in " " s u p a
                   1040:        do
                   1041:                M ${pre}random c major_rnd_c $n 644
1.29      todd     1042:                n=Add($n, 1)
                   1043:        done-}, 644)dnl
                   1044: __devitem(joy, joy*, joystick driver)dnl
                   1045: _mcdev(joy, joy*, joy, {-major_joy_c-}, 666)dnl
                   1046: __devitem(mag, magma*, magma card (makes 16 tty and 2 bpp))dnl
                   1047: __devitem(bppmag, bppmag[mno], magma parallel port device)dnl
                   1048: __devitem(spif, spif*, spif card (makes 8 tty and 1 bpp))dnl
                   1049: __devitem(bppsp, bpp[jkl], spif parallel port device)dnl
                   1050: _mkdev(mag, magma*, {-case $U in
1.18      todd     1051:        0)      offset=0  nam=m;;
                   1052:        1)      offset=16 nam=n;;
                   1053:        2)      offset=32 nam=o;;
                   1054:        *)      echo "bad unit for $i: $U"; exit 127;;
                   1055:        esac
1.29      todd     1056:        offset=Mult($U, 64)
1.18      todd     1057:        n=0
                   1058:        while [ $n -lt 16 ]
                   1059:        do
                   1060:                name=${nam}`hex $n`
1.29      todd     1061:                M tty$name c major_mag_c Add($offset, $n) 660 dialer uucp
                   1062:                n=Add($n, 1)
1.18      todd     1063:        done
1.29      todd     1064:        M bpp${nam}0 c major_bppmag_c Add($offset, 0) 600
                   1065:        M bpp${nam}1 c major_bppmag_c Add($offset, 1) 600-})dnl
                   1066: _mkdev(spif, spif*, {-case $U in
1.18      todd     1067:        0)      offset=0  nam=j;;
                   1068:        1)      offset=16 nam=k;;
                   1069:        2)      offset=32 nam=l;;
                   1070:        *)      echo "bad unit for $i: $U"; exit 127;;
                   1071:        esac
1.29      todd     1072:        offset=Mult($U, 64)
1.18      todd     1073:        n=0
                   1074:        while [ $n -lt 8 ]
                   1075:        do
                   1076:                name=${nam}`hex $n`
1.29      todd     1077:                M tty$name c major_spif_c Add($offset, $n) 660 dialer uucp
                   1078:                n=Add($n, 1)
1.18      todd     1079:        done
1.29      todd     1080:        M bpp${nam}0 c major_bppsp_c Add($offset, 0) 600-})dnl
                   1081: __devitem(bpp, bpp*, parallel port devices)dnl
                   1082: __devitem(xfs, xfs*, XFS filesystem devices)dnl
                   1083: _mcdev(xfs, xfs*, xfs, {-major_xfs_c-}, 600)dnl
                   1084: __devitem(hil, hil, HIL input devices)dnl
                   1085: __devitem(rmidi, rmidi*, raw midi devices)dnl
                   1086: _mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl
                   1087: __devtitle(plat, Platform-specific devices)dnl
                   1088: __devitem(fb, fb*, framebuffer device)dnl
                   1089: __devitem(bktr, bktr*, video capturing)dnl
                   1090: _mcdev(bktr, bktr*, bktr, {-major_bktr_c-}, 644)dnl
                   1091: __devitem(tuner, tuner*, tuner device)dnl
                   1092: _mkdev(tuner, tuner*, {-M tuner$U c major_bktr_c Add(Mult($U, 2), 16) 644-}, 644)dnl
                   1093: __devitem(pci, pci, PCI bus device)dnl
                   1094: _mkdev(pci, pci, {-M pci c major_pci_c 0 664-}, 664)dnl
                   1095: __devitem(adb, adb, Apple Desktop bus event interface)dnl
                   1096: _mkdev(adb, adb, {-M adb c major_adb_c 0-})dnl
                   1097: __devitem(pdc, pdc, PDC device)dnl
                   1098: _mkdev(local, local, {-test -s $T.local && sh $T.local-}, 666)dnl
1.1       todd     1099: dnl
                   1100: divert(1)dnl
                   1101: include(etc.MACHINE/MAKEDEV.md)dnl
                   1102: dnl
                   1103: dnl
                   1104: divert(0)dnl
                   1105: #!/bin/sh -
                   1106: #
                   1107: # THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
                   1108: # generated from:
                   1109: #
                   1110: show_vers()dnl <-- now that all files are included, show versions
                   1111: #
1.6       todd     1112: {-#-}  $Open{--}BSD$
1.1       todd     1113: dnl
                   1114: divert(2)dnl
                   1115: PATH=/sbin:/usr/sbin:/bin:/usr/bin
                   1116: T=$0
                   1117:
                   1118: # set this to echo for Echo-Only debugging
                   1119: [ "$eo" ] || eo=
                   1120:
                   1121: hex()
                   1122: {
                   1123:        case ${--}1 in
1.26      deraadt  1124:        [0-9]) echo -n {-$-}1;;
                   1125:        10) echo -n a;;
                   1126:        11) echo -n b;;
                   1127:        12) echo -n c;;
                   1128:        13) echo -n d;;
                   1129:        14) echo -n e;;
                   1130:        15) echo -n f;;
1.1       todd     1131:        esac
                   1132: }
1.26      deraadt  1133:
1.1       todd     1134: trunc()
                   1135: {
                   1136:        # XXX pdksh can't seem to deal with locally scoped variables
                   1137:        # in ${foo#$bar} expansions
                   1138:        arg1="{-$-}1"
                   1139:        arg2="{-$-}2"
                   1140:        case {-$-}3 in
                   1141:        l)   echo ${arg2#$arg1} ;;
                   1142:        r|*) echo ${arg1#$arg2} ;;
                   1143:        esac
                   1144: }
1.26      deraadt  1145:
1.1       todd     1146: unt()
                   1147: {
                   1148:        # XXX pdksh can't seem to deal with locally scoped variables
                   1149:        # in ${foo#$bar} expansions
                   1150:        arg="{-$-}1"
                   1151:        tmp="${arg#[a-zA-Z]*}"
                   1152:        tmp="${tmp%*[a-zA-Z]}"
                   1153:        while [ "$tmp" != "$arg" ]
                   1154:        do
                   1155:                arg=$tmp
                   1156:                tmp="${arg#[a-zA-Z]*}"
                   1157:                tmp="${tmp%*[a-zA-Z]}"
                   1158:        done
                   1159:        echo $arg
                   1160: }
                   1161: dnl
1.29      todd     1162: dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.5       todd     1163: dnl   arg: 1    2    3      4      5    6    7
1.1       todd     1164: dnl
1.26      deraadt  1165:
1.1       todd     1166: dodisk()
                   1167: {
1.27      todd     1168:        [ "$DEBUG" ] && set -x
1.29      todd     1169:        n=Add(Mult(${5}, ${7:-16}), ${6}) count=0
1.1       todd     1170:        RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?"
1.13      todd     1171:        [ 0$7 -ne 8 ] && l="i j k l m n o p"
                   1172:        for d in a b c d e f g h $l
1.1       todd     1173:        do
1.29      todd     1174:                M {-$-}1{-$-}2$d        b {-$-}3 Add($n, $count) 640
                   1175:                M r{-$-}1{-$-}2$d       c {-$-}4 Add($n, $count) 640
1.1       todd     1176:                let count=count+1
                   1177:        done
                   1178:        MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?"
                   1179: }
                   1180: dnl
1.29      todd     1181: dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.1       todd     1182: dnl
                   1183: dnl 1. name    - prefix name of the device
                   1184: dnl 2. unit    - beginning unit number for block devices
                   1185: dnl 3. blkmaj  - block device major number
                   1186: dnl 4. chrmaj  - character device major number
                   1187: dnl 5. unit    - beginning unit number for character devices
                   1188: dnl 6. off     - offset from 0 for all minor numbers (see svnd for an example)
1.5       todd     1189: dnl 7. step    - optional, defaults to 16, number of partitions per device
1.1       todd     1190: dnl
1.26      deraadt  1191:
1.1       todd     1192: dodisk2()
                   1193: {
1.29      todd     1194:        n=Add(Mult({-$-}5, ${7:-16}), {-$-}6)
1.1       todd     1195:        M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
                   1196:        M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
1.29      todd     1197:        n=Add($n, 2)
1.1       todd     1198:        M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
                   1199:        M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
                   1200: }
                   1201:
                   1202: # M name b/c major minor [mode] [group]
                   1203: RMlist="rm -f"
                   1204: MKlist=":"
1.26      deraadt  1205:
1.1       todd     1206: mkl() {
                   1207: dnl
                   1208: dnl uncomment if multi mknod happens
                   1209: dnl
1.29      todd     1210: ifelse(1, 0,
1.1       todd     1211: [ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
1.30      todd     1212:          mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                   1213:          modes="$modes {-$-}1"
1.1       todd     1214:      },
                   1215: dnl
                   1216: dnl non multi mknod
                   1217: dnl
1.26      deraadt  1218:        [ "${mklist[{-$-}1]}" ] && {
                   1219:                mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                   1220:        } || {
                   1221:                mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                   1222:                modes="$modes {-$-}1"
                   1223:        })
1.1       todd     1224: }
1.26      deraadt  1225:
1.1       todd     1226: M() {
                   1227:        RMlist="$RMlist {-$-}1"
                   1228:        mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
                   1229:        mklist="$mklist {-$-}1"
                   1230:        G={-$-}{6:-wheel}
                   1231:        [ "{-$-}7" ] && {
                   1232:                MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1"
                   1233:        } || {
                   1234:                case $G in
                   1235:                wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;
                   1236:                esac
                   1237:                [ "${grplist[$g]}" ] && {
                   1238:                        grplist[$g]="${grplist[$g]} {-$-}1"
                   1239:                } || {
                   1240:                        groups="$groups $g"
                   1241:                        grplist[$g]="chgrp $G {-$-}1"
                   1242:                }
                   1243:        }
                   1244:        return 0
                   1245: }
                   1246: divert(7)dnl
                   1247: dnl
                   1248: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
                   1249: dnl on the following line:
                   1250:
                   1251: show_devs()dnl
                   1252: dnl
                   1253: divert(9)dnl
                   1254: *)
                   1255:        echo $i: unknown device
                   1256:        ;;
                   1257: esac
                   1258: done
                   1259: }
                   1260: _recurse "$@"
                   1261: if [ "$os" = "SunOS" ]; then
                   1262:        eo=transform
                   1263:        transform() {
                   1264:                case $mode in
                   1265:                600) mask=077;;
                   1266:                640) mask=027;;
                   1267:                660) mask=007;;
                   1268:                644) mask=022;;
                   1269:                666) mask=0;;
                   1270:                440) mask=227;;
                   1271:                esac
                   1272:                echo `echo "$@"|sed \
1.26      deraadt  1273:                    's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
                   1274:                    s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
1.1       todd     1275:        }
                   1276: fi
                   1277: list="$RMlist"
                   1278: for mode in $modes; do
                   1279:        list="$list;${mklist[$mode]}"
                   1280: done
                   1281: for group in $groups; do
                   1282:        list="$list;${grplist[$group]}"
                   1283: done
                   1284: list="$list;$MKlist"
                   1285: if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
                   1286:        $eo "$list"
                   1287: else
                   1288:        echo "$list" | sh
                   1289: fi
                   1290: divert(3)dnl
                   1291: dnl
1.26      deraadt  1292:
1.1       todd     1293: R() {
1.23      todd     1294: [ "$DEBUG" ] && set -x
1.1       todd     1295: for i in "$@"
                   1296: do
                   1297: U=`unt $i`
                   1298: [ "$U" ] || U=0
                   1299:
                   1300: case $i in
                   1301: dnl