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

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

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