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

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

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