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

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

1.1       todd        1: include(MAKEDEV.sub)dnl
                      2: dnl
1.56    ! todd        3: vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.55 2003/01/06 05:57:32 deraadt Exp $-})dnl
1.1       todd        4: dnl
                      5: divert(1)dnl
                      6: {-#-}
1.33      deraadt     7: {-#-} Copyright (c) 2001,2002 Todd T. Fries <todd@OpenBSD.org>
1.1       todd        8: {-#-} All rights reserved.
                      9: {-#-}
                     10: {-#-} Redistribution and use in source and binary forms, with or without
                     11: {-#-} modification, are permitted provided that the following conditions
                     12: {-#-} are met:
                     13: {-#-} 1. Redistributions of source code must retain the above copyright
                     14: {-#-}    notice, this list of conditions and the following disclaimer.
                     15: {-#-} 2. The name of the author may not be used to endorse or promote products
                     16: {-#-}    derived from this software without specific prior written permission.
                     17: {-#-}
                     18: {-#-} THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
                     19: {-#-} INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
                     20: {-#-} AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
                     21: {-#-} THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
                     22: {-#-} EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
                     23: {-#-} PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
                     24: {-#-} OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
                     25: {-#-} WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
                     26: {-#-} OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
                     27: {-#-} ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     28: {-#-}
                     29: dnl
                     30: dnl Diversions:  (upon termination, concatenated output queues)
                     31: dnl
                     32: dnl 0 - very top
                     33: dnl 1 - descriptions of devices
                     34: dnl 2 - init of script, function definitions, etc
                     35: dnl 3 - beginning of global recursive R() function
                     36: dnl 7 - body of MAKEDEV, device creations, etc
                     37: dnl 9 - end
                     38: dnl
                     39: dnl HOW TO ADD A DEVICE:
                     40: dnl
                     41: dnl In this file, you must use at least two macros:
                     42: dnl
1.29      todd       43: dnl  Use '__devitem(uniqueid, name-pattern, description)' to create an entry
1.1       todd       44: dnl  in the description at the top of the generated MAKEDEV file:
                     45: dnl
1.29      todd       46: dnl    __devitem(sca, sca*, Sugar Generic device)dnl
1.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
1.46      provos    151: target(all, systrace)dnl
1.29      todd      152: target(all, pctr)dnl
                    153: target(all, pctr0)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: target(all, par, 0)dnl
                    200: twrget(all, amouse, mouse, 0, 1)dnl
                    201: twrget(all, akbd, kbd)dnl
                    202: target(all, apci, 0)dnl
                    203: target(all, ppi, 0)dnl
                    204: target(all, view0, 0, 1, 2, 3, 4, 5)dnl
                    205: target(all, local)dnl
1.49      fgsch     206: target(all, gpr, 0)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
1.29      todd      301: -})dnl
                    302: target(ramd, std)dnl
                    303: target(ramd, random)dnl
                    304: target(ramd, bpf, 0)dnl
1.34      deraadt   305: __devitem(rd, {-rd*-}, "rd" pseudo-disks)dnl
1.29      todd      306: _mkdev(rd, rd*, {-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
                    307: __devitem(xd, xd*, Xylogic 753/7053 disks)dnl
                    308: __devitem(xy, xy*, {-  Xylogic 450/451 disks-})dnl
                    309: __devitem(flo, {-fd*-}, {-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl
                    310: _mkdev(flo, fd*,
1.1       todd      311: {-typnam=$U${i#fd[01]*}
                    312:        case $typnam in
                    313:        0|1)    typnum=0;; # no type specified, assume A
1.26      deraadt   314:        *A)     typnum=0; typnam=0;;
                    315:        *B)     typnum=1;;
                    316:        *C)     typnum=2;;
                    317:        *D)     typnum=3;;
                    318:        *E)     typnum=4;;
                    319:        *F)     typnum=5;;
                    320:        *G)     typnum=6;;
                    321:        *H)     typnum=7;;
                    322:        *)      echo bad type $typnam for $i; exit 1;;
1.1       todd      323:        esac
                    324:        case $U in
                    325:        0|1)    blk=major_flo_b; chr=major_flo_c;;
                    326:        *)      echo bad unit $U for $i; exit 1;;
                    327:        esac
                    328:        nam=fd${typnam}
1.29      todd      329:        n=Add(Mult($U, 128), Mult($typnum, 16))
1.1       todd      330:        M ${nam}a       b $blk $n 640 operator
1.29      todd      331:        M ${nam}b       b $blk Add($n, 1) 640 operator
                    332:        M ${nam}c       b $blk Add($n, 2) 640 operator
1.1       todd      333:        M r${nam}a      c $chr $n 640 operator
1.29      todd      334:        M r${nam}b      c $chr Add($n, 1) 640 operator
                    335:        M r${nam}c      c $chr Add($n, 2) 640 operator-}, 664)dnl
                    336: __devitem(aflo, ramdisk, devices needed for install floppies)dnl
                    337: _mkdev(aflo, fd*, {-case $U in 0|1|2|3)
                    338:        M fd${U}a b major_aflo_b Mult($U, 16) 640 operator
                    339:        M fd${U}b b major_aflo_b Add(Mult($U, 16), 1) 640 operator
                    340:        M rfd${U}a c major_aflo_c Mult($U, 16) 640 operator
                    341:        M rfd${U}b c major_aflo_c Add(Mult($U, 16), 1) 640 operator;;
1.1       todd      342:        *) echo bad unit for floppy disk in: $i;;
                    343:        esac-})dnl
1.29      todd      344: __devitem(iop, iop*, I2O controller device)dnl
                    345: _mcdev(iop, iop*, iop, {-major_iop_c-}, 660)dnl
                    346: __devitem(wdt, wdt0, watchdog timer)dnl
                    347: _mcdev(wdt, wdt0, wdt, {-major_wdt_c-}, 440, operator)dnl
                    348: __devitem(local, local, configuration specific devices)dnl
                    349: __devitem(wd, {-wd*-}, {-"winchester" disk drives (ST506, IDE, ESDI, RLL, ...)-})dnl
                    350: __devitem(ccd, ccd*, concatenated disk devices)dnl
                    351: __devitem(raid, raid*, RAIDframe disk devices)dnl
                    352: __devitem(vnd, vnd*, "file" pseudo-disks)dnl
                    353: _mkdev(vnd, vnd*, {-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)
1.6       todd      354:        dodisk svnd $U major_vnd_b major_vnd_c $U 128{--}ifstep(vnd)-})dnl
1.29      todd      355: __devitem(ra, ra*, {-MSCP disks (ra??, hd??)-})dnl
                    356: __devitem(hp, hp*, {-massbuss rm??-})dnl
                    357: __devitem(hk, hk*, {-unibus rk06 and rk07-})dnl
                    358: __devitem(up, up*, {-other unibus devices (e.g. on Emulex sc-21v controller)-})dnl
                    359: __devitem(rb, rb*, {-730 idc w/ rb80 and/or rb02-})dnl
                    360: __devitem(rx, rx*, {-MSCP floppy disk (rx33/50/...)-})dnl
                    361: __devitem(rl, rl*, {-unibus r102-})dnl
                    362: __devitem(hd, hd*, {-HDC9224 hd disks on VS2000-})dnl
1.1       todd      363: dnl
                    364: dnl For normal disk devices, add a disk_q entry; anything else define like
                    365: dnl the rest (such as vnd above).
                    366: dnl
1.18      todd      367: disk_q({-ccd-})dnl
                    368: disk_q({-hd-})dnl
                    369: disk_q({-hk-})dnl
                    370: disk_q({-hp-})dnl
                    371: disk_q({-ra-})dnl
                    372: disk_q({-raid-})dnl
                    373: disk_q({-rb-})dnl
                    374: disk_q({-rl-})dnl
                    375: disk_q({-rx-})dnl
                    376: disk_q({-sd-})dnl
1.1       todd      377: disk_q({-xy-})dnl
                    378: disk_q({-xd-})dnl
1.18      todd      379: disk_q({-up-})dnl
                    380: disk_q({-wd-})dnl
1.1       todd      381: disk_q({-rz-})dnl
                    382: dnl
1.29      todd      383: __devitem(loc, local, configuration specific devices)dnl
                    384: _mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
                    385: _mkdev({-disks-}, {-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
1.1       todd      386: {-case $i in
                    387: show_disks2()dnl
1.6       todd      388:        esac-})dnl
1.1       todd      389: __mkdev({-disks-}){--}dnl
                    390: dnl
1.29      todd      391: __devtitle(cons, Console ports)dnl
                    392: __devitem(ttyv0, ttyv0, pccons or pcvt screen 0)dnl
                    393: __devitem(ttyv, ttyv*, pcvt)dnl
                    394: __devitem(ttye, ttye*, ite bitmapped consoles)dnl
                    395: __devitem(mac_ttye, ttye*, ite bitmapped consoles)dnl
                    396: __devitem(wscons, ttyC0, wscons screen 0)dnl
1.35      todd      397: twrget(wscons, wscons, ttyC, cfg, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b)dnl
                    398: target(wscons, wsmux)dnl
                    399: target(wscons, wskbd, 0, 1, 2, 3)dnl
                    400: target(wscons, wsmouse, 0, 1, 2, 3)dnl
1.29      todd      401: _mkdev({-wscons-}, {-wscons-}, {-dnl
1.35      todd      402: show_target(wscons)dnl
                    403: -})dnl
1.36      todd      404: __devitem(wsdisp, ttyC-F*, wscons virtual consoles)dnl
1.35      todd      405: _mkdev({-wsdisp-}, tty[C-F]*, {-U=${i##tty[C-F]}
                    406:        case $i in
                    407:        ttyC*) n=C m=expr(0*256);;
                    408:        ttyD*) n=D m=expr(1*256);;
                    409:        ttyE*) n=E m=expr(2*256);;
                    410:        ttyF*) n=F m=expr(3*256);;
                    411:        esac
1.3       todd      412:        case $U in
1.35      todd      413:        [0-9a-f]) M tty$n$U c major_wsdisp_c {-$(( 16#$U + $m ))-} 600;;
                    414:        cfg) M tty${n}cfg c major_wsdisp_c Add(255,$m) 600;;
1.3       todd      415:        *) echo bad unit $U for $i; exit 1;;
1.6       todd      416:        esac-})dnl
1.29      todd      417: __devitem(wskbd, wskbd*, wscons keyboards)dnl
                    418: _mkdev(wskbd, wskbd*, {-M wskbd$U c major_wskbd_c $U 600-})dnl
                    419: __devitem(wsmux, wsmux, wscons keyboard/mouse mux devices)dnl
                    420: _mkdev(wsmux, wsmux|wsmouse|wskbd, {-M wsmouse c major_wsmux_c 0 600
1.1       todd      421:        M wskbd c major_wsmux_c 1 600-})dnl
1.29      todd      422: __devitem(pcons, console, PROM console)dnl
                    423: __devtitle(point, Pointing devices)dnl
                    424: __devitem(wsmouse, wsmouse*, wscons mice)dnl
                    425: _mkdev(wsmouse, wsmouse*, {-M wsmouse$U c major_wsmouse_c $U 600-})dnl
                    426: __devitem(quad, quadmouse, "quadrature mouse")dnl
                    427: __devtitle(pty, Pseudo terminals)dnl
                    428: __devitem(tty, tty*, set of 16 slave psuedo terminals)dnl
                    429: __devitem(pty, pty*, set of 16 master pseudo terminals)dnl
1.31      todd      430: _mkdev(pty, pty*, {-if [ $U -gt 15 ]; then
                    431:                echo bad unit for pty in: $i
                    432:                continue
                    433:        fi
                    434:        set -A tbl p q r s t u v w x y z P Q R S T
                    435:        name=${tbl[$U]}
1.1       todd      436:        n=0
                    437:        while [ $n -lt 16 ]
                    438:        do
                    439:                nam=$name$(hex $n)
1.31      todd      440:                off=Mult($U, 16)
1.29      todd      441:                M tty$nam c major_tty_c Add($off, $n)
                    442:                M pty$nam c major_pty_c Add($off, $n)
                    443:                n=Add($n, 1)
1.1       todd      444:        done-})dnl
1.29      todd      445: __devitem(dc, dc*, {-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
                    446: __devtitle(prn, Printers)dnl
                    447: __devitem(par, par*, motherboard parallel port)dnl
                    448: __devitem(lpt, lpt*, IEEE 1284 centronics printer)dnl
                    449: _mkdev(lpt, lpt*|lpa*,
1.1       todd      450: {-case $i in
                    451:        lpt*) n=lpt f=0;;
                    452:        lpa*) n=lpa f=128;;
                    453:        esac
1.29      todd      454:        M $n$U c major_lpt_c Add($U, $f) 600-})dnl
                    455: __devitem(lpa, lpa*, interruptless lp)dnl
                    456: __devitem(ppi, ppi*, HP-IB plotters)dnl
                    457: __devtitle({-usb-}, USB devices)dnl
                    458: __devitem({-usb-}, usb*, Bus control devices used by usbd for attach/detach)dnl
                    459: _mkdev({-usb-}, usb*, {-[ "$i" = "usb" ] && u= || u=$U
1.1       todd      460:        M usb$u c major_usb_c $U 660-})dnl
1.29      todd      461: __devitem(uhid, uhid*, Generic HID devices)dnl
                    462: _mcdev({-uhid-}, uhid*, {-uhid-}, {-major_uhid_c-}, 660)dnl
                    463: __devitem(ulpt, ulpt*, Printer devices)dnl
                    464: _mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 660)dnl
                    465: __devitem(utty, utty*, Serial ports)dnl
                    466: _mcdev({-utty-}, utty*, {-utty-}, {-major_utty_c-}, 660)dnl
                    467: __devitem(urio, urio*, Diamond Multimedia Rio 500)dnl
                    468: _mcdev({-urio-}, urio*, {-urio-}, {-major_urio_c-}, 660)dnl
                    469: __devitem(uscan, uscanner*, Scanners)dnl
                    470: _mcdev({-uscan-}, uscanner*, {-uscanner-}, {-major_uscan_c-}, 660)dnl
                    471: __devitem(ugen, ugen*, Generic device)dnl
                    472: _mkdev(ugen, ugen*, {-n=Mult($U, 16)
1.1       todd      473:        for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
                    474:        do
1.29      todd      475:                M ugen$U.$j c major_ugen_c Add($n, $j) 660
1.1       todd      476:        done-})dnl
1.29      todd      477: __devtitle(cpu, Cpus)dnl
                    478: __devitem(cpu, cpu*, cpus)dnl
                    479: __devtitle(call, Call units)dnl
                    480: __devtitle(term, Terminal ports)dnl
                    481: __devtitle(termp, Terminal multiplexers)dnl
                    482: __devitem(dca, dca*, HP200/300 single port serial interface)dnl
                    483: __devitem(dcm, dcm*, HP200/300 4 port serial mux interface)dnl
                    484: __devitem(apci, apci*, HP400 4 port serial mux interface)dnl
                    485: __devitem({-com-}, {-tty0*-}, NS16x50 serial ports)dnl
                    486: _mkdev(com, {-tty0*-}, {-M tty$U c major_com_c $U 660 dialer uucp
                    487:        M cua$U c major_com_c Add($U, 128) 660 dialer uucp-})dnl
                    488: __devitem(ttyc, ttyc*, Cyclades serial ports)dnl
                    489: __devitem(tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl
                    490: _mkdev(tzs, {-tty[a-z]-}, {-u=${i#tty*}
1.1       todd      491:        case $u in
                    492:        a) n=0 ;;
                    493:        b) n=1 ;;
                    494:        c) n=4 ;;
                    495:        d) n=5 ;;
                    496:        *) echo unknown tty device $i ;;
                    497:        esac
                    498:        M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
1.29      todd      499: __devitem(tth, ttyh*, Sab82532 serial devices)dnl
                    500: _mkdev(tth, ttyh*, {-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
                    501: __devitem(czs, cua[a-z]*, Zilog 8530 Serial Port)dnl
                    502: _mkdev(czs, cua[a-z], {-u=${i#cua*}
1.1       todd      503:        case $u in
                    504:        a) n=0 ;;
                    505:        b) n=1 ;;
                    506:        c) n=4 ;;
                    507:        d) n=5 ;;
1.41      todd      508:        *) echo unknown cua device $i ;;
1.1       todd      509:        esac
1.29      todd      510:        M cua$u c major_czs_c Add($n, 128) 660 dialer uucp-})dnl
                    511: __devitem(arm_tty, tty*, {-alias for PC COM ports{-,-} this is what the system really wants-})dnl
                    512: __devitem(tty0, tty00, standard serial port)dnl
                    513: __devitem(mac_tty0, tty00, standard serial port)dnl
                    514: __devitem(ttyA, ttyA*, mfc serial ports)dnl
                    515: __devitem(ttyz, tty[a-d], onboard zs serial ports)dnl
                    516: __devitem(cuaz, cua[a-d], onboard zs serial ports)dnl
                    517: __devitem(ttyB, ttyB?, DEC 3000 ZS8530 ("scc") serial ports)dnl
                    518: __devitem(scc, scc*, 82530 serial interface)dnl
                    519: __devitem(arc_ttyC, ttyC0, pccons)dnl
                    520: __devitem(i386_ttyC, ttyC*, pcvt)dnl
                    521: __devitem(ttyC, ttyC?, {-AlphaStation NS16550 ("com serial ports")-})dnl
                    522: __devitem(ttyE, ttyE?, Workstation console (framebuffer & keyboard) tty emulators)dnl
                    523: __devitem(ser02, ser02, {-serial2 port (channel A on 8530)-})dnl
                    524: __devitem(mdm02, mdm02, {-modem2 port (channel B on 8530)-})dnl
                    525: __devtitle(spec, Special purpose devices)dnl
                    526: __devitem(apm, apm     , power management device)dnl
                    527: _mkdev(apm, apm*, {-M apm      c major_apm_c 0 644
1.1       todd      528:        M apmctl        c major_apm_c 8 644-})dnl
1.29      todd      529: __devitem(pcmcia, pcmcia*, PCMCIA card drivers)dnl
                    530: __devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl
                    531: _mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl
1.46      provos    532: __devitem(systrace, systrace*, system call tracing device)dnl
                    533: _mkdev(systrace, systrace, {-M systrace c major_systrace_c 0 644-})dnl
1.29      todd      534: __devitem(au, audio*, audio device)dnl
                    535: _mkdev(au, audio*, {-M sound$U c major_au_c $U
                    536:        M mixer$U       c major_au_c Add($U, 16)
                    537:        M audio$U       c major_au_c Add($U, 128)
                    538:        M audioctl$U    c major_au_c Add($U, 192)
1.1       todd      539:        MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
                    540:        MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
                    541:        MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
                    542:        MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
1.29      todd      543: __devitem(asc, asc*, ASC Audio device)dnl
                    544: _mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
                    545: __devitem(music, music*, midi devices)dnl
                    546: _mkdev(music, music*, {-M music$U     c major_music_c $U
                    547:        M sequencer$U c major_music_c Add($U, 128)
1.1       todd      548:        MKlist="$MKlist;[ -e music ] || ln -s music$U music"
                    549:        MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
1.29      todd      550: __devitem(radio, radio*, FM tuner device)dnl
                    551: _mkdev(radio, radio*, {-M radio$U     c major_radio_c $U
1.8       todd      552:        MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl
1.29      todd      553: __devitem(fdesc, fd, makes fd/* for the fdescfs)dnl
                    554: _mkdev(fdesc, fd, {-RMlist="mkdir -p fd;$RMlist" n=0
                    555:        while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
1.1       todd      556:        MKlist="$MKlist;chmod 555 fd"-})dnl
1.29      todd      557: __devtitle(graph, Graphics devices)dnl
                    558: __devitem(grf_mac, grf*, {-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-}
1.1       todd      559: {-#-}          Cirrus boards (grf3){-,-} A2410 (grf4) video or
                    560: {-#-}          CyberVision 64 (grf5)-})dnl
1.29      todd      561: __devitem(ite, ite*, terminal emulator interface to HP300 graphics devices)dnl
                    562: __devitem({-hil-}, {-hil-}, HP300 HIL input devices)dnl
                    563: __devitem(oppr, openprom)dnl
                    564: _cdev(oppr, openprom, 70, 0)dnl
                    565: __devitem(btw, bwtwo*)dnl
                    566: _mcdev(btw, bwtwo*, bwtwo, {-major_btw_c-}, 666)dnl
                    567: __devitem(ctw, cgtwo*)dnl
                    568: _mcdev(ctw, cgtwo*, cgtwo, {-major_ctw_c-}, 666)dnl
                    569: __devitem(ctr, cgthree*)dnl
                    570: _mcdev(ctr, cgthree*, cgthree, {-major_ctr_c-}, 666)dnl
                    571: __devitem(cfr, cgfour*)dnl
                    572: _mcdev(cfr, cgfour*, cgfour, {-major_cfr_c-}, 666)dnl
                    573: __devitem(csx, cgsix*)dnl
                    574: _mcdev(csx, cgsix*, cgsix, {-major_csx_c-}, 666)dnl
                    575: __devitem(ceg, cgeight*)dnl
                    576: _mcdev(ceg, cgeight*, cgeight, {-major_ceg_c-}, 666)dnl
                    577: __devitem(cfo, cgfourteen*)dnl
                    578: _mcdev(cfo, cgfourteen*, cgfourteen, {-major_cfo_c-})dnl
                    579: __devitem(tcx, tcx*)dnl
                    580: _mcdev(tcx, tcx*, tcx, {-major_tcx_c-})dnl
                    581: __devitem(cry, crypto, hardware crypto access driver)dnl
                    582: _mkdev(cry, crypto, {-M crypto c major_cry_c-} 0)dnl
                    583: __devitem(pf, pf*, Packet Filter)dnl
                    584: _mkdev(pf, {-pf*-}, {-M pf c major_pf_c 0 600-})dnl
                    585: __devitem(bpf, bpf*, Berkeley Packet Filter)dnl
                    586: _mkdev(bpf, {-bpf*-}, {-M bpf$U c major_bpf_c $U 600-}, 600)dnl
                    587: _mkdev(tun, {-tun*-}, {-M tun$U c major_tun_c $U 600-}, 600)dnl
                    588: __devitem(speak, speaker, pc speaker)dnl
                    589: _mkdev(speak, speaker, {-M speaker c major_speak_c 0 600-})dnl
                    590: __devitem(kbd, kbd, keyboard (provides events, for X11))dnl
                    591: _cdev(kbd, kbd, {-major_kbd_c-}, 0, 600)dnl
                    592: __devitem(kbd_atari, kbd, Atari keyboard)dnl
                    593: __devitem(akbd, kbd, Amiga keyboard)dnl
                    594: __devitem(rkbd, kbd, raw keyboard)dnl
                    595: __devitem(kbdctl, kbdctl, keyboard control)dnl
                    596: __devitem(beep, beep, riscpc speaker)dnl
                    597: __devitem(iic, iic*, IIC bus device)dnl
                    598: __devitem(rtc, rtc*, RTC device)dnl
                    599: __devitem(view, view*, generic interface to graphic displays)dnl
                    600: __devitem(aconf, aconf, {-autoconfig information (not yet)-})dnl
                    601: __devitem(mouse-, mouse-*, "mouse link")dnl
                    602: __devitem(mouse, mouse, mouse (provides events, for X11))dnl
                    603: __devitem(amouse, mouse*, Amiga mice)dnl
                    604: __devitem(lkm, lkm, loadable kernel modules interface)dnl
1.55      deraadt   605: _cdev(lkm, lkm, {-major_lkm_c-}, 0, 640, _lkm)dnl
1.29      todd      606: __devitem(mmcl, mmclock, memory mapped clock)dnl
                    607: __devitem(tun, tun*, network tunnel driver)dnl
                    608: __devitem(rnd, *random, inkernel random data source)dnl
                    609: _mkdev(rnd, *random, {-n=0
1.1       todd      610:        for pre in " " s u p a
                    611:        do
                    612:                M ${pre}random c major_rnd_c $n 644
1.29      todd      613:                n=Add($n, 1)
                    614:        done-}, 644)dnl
                    615: __devitem(joy, joy*, joystick driver)dnl
                    616: _mcdev(joy, joy*, joy, {-major_joy_c-}, 666)dnl
                    617: __devitem(mag, magma*, magma card (makes 16 tty and 2 bpp))dnl
                    618: __devitem(bppmag, bppmag[mno], magma parallel port device)dnl
                    619: __devitem(spif, spif*, spif card (makes 8 tty and 1 bpp))dnl
                    620: __devitem(bppsp, bpp[jkl], spif parallel port device)dnl
                    621: _mkdev(mag, magma*, {-case $U in
1.18      todd      622:        0)      offset=0  nam=m;;
                    623:        1)      offset=16 nam=n;;
                    624:        2)      offset=32 nam=o;;
                    625:        *)      echo "bad unit for $i: $U"; exit 127;;
                    626:        esac
1.29      todd      627:        offset=Mult($U, 64)
1.18      todd      628:        n=0
                    629:        while [ $n -lt 16 ]
                    630:        do
                    631:                name=${nam}`hex $n`
1.29      todd      632:                M tty$name c major_mag_c Add($offset, $n) 660 dialer uucp
                    633:                n=Add($n, 1)
1.18      todd      634:        done
1.29      todd      635:        M bpp${nam}0 c major_bppmag_c Add($offset, 0) 600
                    636:        M bpp${nam}1 c major_bppmag_c Add($offset, 1) 600-})dnl
                    637: _mkdev(spif, spif*, {-case $U in
1.18      todd      638:        0)      offset=0  nam=j;;
                    639:        1)      offset=16 nam=k;;
                    640:        2)      offset=32 nam=l;;
                    641:        *)      echo "bad unit for $i: $U"; exit 127;;
                    642:        esac
1.29      todd      643:        offset=Mult($U, 64)
1.18      todd      644:        n=0
                    645:        while [ $n -lt 8 ]
                    646:        do
                    647:                name=${nam}`hex $n`
1.29      todd      648:                M tty$name c major_spif_c Add($offset, $n) 660 dialer uucp
                    649:                n=Add($n, 1)
1.18      todd      650:        done
1.29      todd      651:        M bpp${nam}0 c major_bppsp_c Add($offset, 0) 600-})dnl
                    652: __devitem(bpp, bpp*, parallel port devices)dnl
                    653: __devitem(xfs, xfs*, XFS filesystem devices)dnl
                    654: _mcdev(xfs, xfs*, xfs, {-major_xfs_c-}, 600)dnl
                    655: __devitem(hil, hil, HIL input devices)dnl
                    656: __devitem(rmidi, rmidi*, raw midi devices)dnl
                    657: _mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl
                    658: __devtitle(plat, Platform-specific devices)dnl
                    659: __devitem(fb, fb*, framebuffer device)dnl
                    660: __devitem(bktr, bktr*, video capturing)dnl
                    661: _mcdev(bktr, bktr*, bktr, {-major_bktr_c-}, 644)dnl
                    662: __devitem(tuner, tuner*, tuner device)dnl
                    663: _mkdev(tuner, tuner*, {-M tuner$U c major_bktr_c Add(Mult($U, 2), 16) 644-}, 644)dnl
                    664: __devitem(pci, pci, PCI bus device)dnl
1.43      deraadt   665: _mkdev(pci, pci, {-M pci c major_pci_c 0 600-}, 600)dnl
1.29      todd      666: __devitem(adb, adb, Apple Desktop bus event interface)dnl
                    667: _mkdev(adb, adb, {-M adb c major_adb_c 0-})dnl
                    668: __devitem(pdc, pdc, PDC device)dnl
                    669: _mkdev(local, local, {-test -s $T.local && sh $T.local-}, 666)dnl
1.49      fgsch     670: __devitem(gpr, gpr*, gpr400 pcmcia device)dnl
                    671: _mcdev(gpr, gpr*, gpr, {-major_gpr_c-})dnl
1.1       todd      672: dnl
                    673: divert(1)dnl
                    674: include(etc.MACHINE/MAKEDEV.md)dnl
                    675: dnl
                    676: dnl
                    677: divert(0)dnl
                    678: #!/bin/sh -
                    679: #
                    680: # THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
                    681: # generated from:
                    682: #
                    683: show_vers()dnl <-- now that all files are included, show versions
                    684: #
                    685: dnl
                    686: divert(2)dnl
                    687: PATH=/sbin:/usr/sbin:/bin:/usr/bin
                    688: T=$0
                    689:
                    690: # set this to echo for Echo-Only debugging
                    691: [ "$eo" ] || eo=
                    692:
                    693: hex()
                    694: {
                    695:        case ${--}1 in
1.26      deraadt   696:        [0-9]) echo -n {-$-}1;;
                    697:        10) echo -n a;;
                    698:        11) echo -n b;;
                    699:        12) echo -n c;;
                    700:        13) echo -n d;;
                    701:        14) echo -n e;;
                    702:        15) echo -n f;;
1.1       todd      703:        esac
                    704: }
1.26      deraadt   705:
1.1       todd      706: trunc()
                    707: {
                    708:        # XXX pdksh can't seem to deal with locally scoped variables
                    709:        # in ${foo#$bar} expansions
                    710:        arg1="{-$-}1"
                    711:        arg2="{-$-}2"
                    712:        case {-$-}3 in
                    713:        l)   echo ${arg2#$arg1} ;;
                    714:        r|*) echo ${arg1#$arg2} ;;
                    715:        esac
                    716: }
1.26      deraadt   717:
1.1       todd      718: unt()
                    719: {
                    720:        # XXX pdksh can't seem to deal with locally scoped variables
                    721:        # in ${foo#$bar} expansions
                    722:        arg="{-$-}1"
                    723:        tmp="${arg#[a-zA-Z]*}"
                    724:        tmp="${tmp%*[a-zA-Z]}"
                    725:        while [ "$tmp" != "$arg" ]
                    726:        do
                    727:                arg=$tmp
                    728:                tmp="${arg#[a-zA-Z]*}"
                    729:                tmp="${tmp%*[a-zA-Z]}"
                    730:        done
                    731:        echo $arg
                    732: }
                    733: dnl
1.29      todd      734: dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.5       todd      735: dnl   arg: 1    2    3      4      5    6    7
1.1       todd      736: dnl
1.26      deraadt   737:
1.1       todd      738: dodisk()
                    739: {
1.27      todd      740:        [ "$DEBUG" ] && set -x
1.29      todd      741:        n=Add(Mult(${5}, ${7:-16}), ${6}) count=0
1.1       todd      742:        RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?"
1.13      todd      743:        [ 0$7 -ne 8 ] && l="i j k l m n o p"
                    744:        for d in a b c d e f g h $l
1.1       todd      745:        do
1.29      todd      746:                M {-$-}1{-$-}2$d        b {-$-}3 Add($n, $count) 640
                    747:                M r{-$-}1{-$-}2$d       c {-$-}4 Add($n, $count) 640
1.1       todd      748:                let count=count+1
                    749:        done
                    750:        MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?"
                    751: }
                    752: dnl
1.29      todd      753: dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.1       todd      754: dnl
                    755: dnl 1. name    - prefix name of the device
                    756: dnl 2. unit    - beginning unit number for block devices
                    757: dnl 3. blkmaj  - block device major number
                    758: dnl 4. chrmaj  - character device major number
                    759: dnl 5. unit    - beginning unit number for character devices
                    760: dnl 6. off     - offset from 0 for all minor numbers (see svnd for an example)
1.5       todd      761: dnl 7. step    - optional, defaults to 16, number of partitions per device
1.1       todd      762: dnl
1.26      deraadt   763:
1.1       todd      764: dodisk2()
                    765: {
1.29      todd      766:        n=Add(Mult({-$-}5, ${7:-16}), {-$-}6)
1.1       todd      767:        M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
                    768:        M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
1.29      todd      769:        n=Add($n, 2)
1.1       todd      770:        M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
                    771:        M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
                    772: }
                    773:
                    774: # M name b/c major minor [mode] [group]
                    775: RMlist="rm -f"
                    776: MKlist=":"
1.26      deraadt   777:
1.1       todd      778: mkl() {
                    779: dnl
                    780: dnl uncomment if multi mknod happens
                    781: dnl
1.29      todd      782: ifelse(1, 0,
1.1       todd      783: [ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
1.30      todd      784:          mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                    785:          modes="$modes {-$-}1"
1.1       todd      786:      },
                    787: dnl
                    788: dnl non multi mknod
                    789: dnl
1.26      deraadt   790:        [ "${mklist[{-$-}1]}" ] && {
                    791:                mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                    792:        } || {
                    793:                mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                    794:                modes="$modes {-$-}1"
                    795:        })
1.1       todd      796: }
1.26      deraadt   797:
1.1       todd      798: M() {
                    799:        RMlist="$RMlist {-$-}1"
                    800:        mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
                    801:        mklist="$mklist {-$-}1"
                    802:        G={-$-}{6:-wheel}
                    803:        [ "{-$-}7" ] && {
                    804:                MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1"
                    805:        } || {
                    806:                case $G in
1.56    ! todd      807:                wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;_lkm)g=61;;
1.1       todd      808:                esac
                    809:                [ "${grplist[$g]}" ] && {
                    810:                        grplist[$g]="${grplist[$g]} {-$-}1"
                    811:                } || {
                    812:                        groups="$groups $g"
                    813:                        grplist[$g]="chgrp $G {-$-}1"
                    814:                }
                    815:        }
                    816:        return 0
                    817: }
                    818: divert(7)dnl
                    819: dnl
                    820: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
                    821: dnl on the following line:
                    822:
                    823: show_devs()dnl
                    824: dnl
                    825: divert(9)dnl
                    826: *)
                    827:        echo $i: unknown device
                    828:        ;;
                    829: esac
                    830: done
                    831: }
                    832: _recurse "$@"
                    833: if [ "$os" = "SunOS" ]; then
                    834:        eo=transform
                    835:        transform() {
                    836:                case $mode in
                    837:                600) mask=077;;
                    838:                640) mask=027;;
                    839:                660) mask=007;;
                    840:                644) mask=022;;
                    841:                666) mask=0;;
                    842:                440) mask=227;;
                    843:                esac
                    844:                echo `echo "$@"|sed \
1.26      deraadt   845:                    's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
                    846:                    s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
1.1       todd      847:        }
                    848: fi
                    849: list="$RMlist"
                    850: for mode in $modes; do
                    851:        list="$list;${mklist[$mode]}"
                    852: done
                    853: for group in $groups; do
                    854:        list="$list;${grplist[$group]}"
                    855: done
                    856: list="$list;$MKlist"
                    857: if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
                    858:        $eo "$list"
                    859: else
                    860:        echo "$list" | sh
                    861: fi
1.41      todd      862: divert(3)dnl
1.1       todd      863: dnl
1.26      deraadt   864:
1.1       todd      865: R() {
1.23      todd      866: [ "$DEBUG" ] && set -x
1.1       todd      867: for i in "$@"
                    868: do
                    869: U=`unt $i`
                    870: [ "$U" ] || U=0
                    871:
                    872: case $i in
                    873: dnl