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

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

1.72      miod        1: define(COMM,`#')dnl
1.1       todd        2: include(MAKEDEV.sub)dnl
                      3: dnl
1.79    ! miod        4: vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.78 2008/06/14 23:09:05 todd Exp $-})dnl
1.1       todd        5: dnl
                      6: divert(1)dnl
                      7: {-#-}
1.71      todd        8: {-#-} Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
1.1       todd        9: {-#-}
1.60      todd       10: {-#-} Permission to use, copy, modify, and distribute this software for any
                     11: {-#-} purpose with or without fee is hereby granted, provided that the above
                     12: {-#-} copyright notice and this permission notice appear in all copies.
1.1       todd       13: {-#-}
1.60      todd       14: {-#-} THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     15: {-#-} WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     16: {-#-} MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     17: {-#-} ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     18: {-#-} WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     19: {-#-} ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     20: {-#-} OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       todd       21: {-#-}
1.72      miod       22: define(quote,{-"$1" -})dnl
                     23: include(MAKEDEV.common)dnl
1.1       todd       24: dnl
1.72      miod       25: __devtitle(make, {-Device "make" file.  Valid arguments-})dnl
                     26: __devitem({-all-}, {-all-}, {-makes all known devices{-,-} including local devices.
1.1       todd       27: {-#-}          Tries to make the ``standard'' number of each type.-})dnl
1.72      miod       28: __devitem(std,{-std-},Standard devices)dnl
                     29: __devitem(local,local,Configuration specific devices)dnl
1.18      todd       30: dnl
1.1       todd       31: dnl _std
                     32: dnl
                     33: dnl $1: tty
                     34: dnl $2: memstuff
                     35: dnl $3: ksyms
1.79    ! miod       36: dnl $4: klog
1.1       todd       37: dnl
1.72      miod       38: define({-_std-},{-dnl
1.1       todd       39: std)
                     40:        M console       c 0 0 600
                     41:        M tty           c $1 0
                     42:        M mem           c $2 0 640 kmem
                     43:        M kmem          c $2 1 640 kmem
                     44:        M null          c $2 2
                     45:        M zero          c $2 12
                     46:        M stdin         c major_fdesc_c 0
                     47:        M stdout        c major_fdesc_c 1
                     48:        M stderr        c major_fdesc_c 2
                     49:        M ksyms         c $3 0 640 kmem
1.79    ! miod       50:        M klog          c $4 0 600-})dnl
1.1       todd       51: dnl
                     52: divert(1)dnl
1.72      miod       53: define(__mddivert,7)dnl
1.78      todd       54: include(MAKEDEV.md)dnl
1.1       todd       55: dnl
                     56: dnl
                     57: divert(0)dnl
                     58: #!/bin/sh -
                     59: #
                     60: # THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
                     61: # generated from:
                     62: #
                     63: show_vers()dnl <-- now that all files are included, show versions
                     64: #
                     65: dnl
                     66: divert(2)dnl
                     67: PATH=/sbin:/usr/sbin:/bin:/usr/bin
                     68: T=$0
                     69:
                     70: # set this to echo for Echo-Only debugging
                     71: [ "$eo" ] || eo=
                     72:
                     73: hex()
                     74: {
                     75:        case ${--}1 in
1.26      deraadt    76:        [0-9]) echo -n {-$-}1;;
                     77:        10) echo -n a;;
                     78:        11) echo -n b;;
                     79:        12) echo -n c;;
                     80:        13) echo -n d;;
                     81:        14) echo -n e;;
                     82:        15) echo -n f;;
1.1       todd       83:        esac
1.65      todd       84: }
                     85:
                     86: alph2d()
                     87: {
1.73      david      88:        local t="$1"
1.65      todd       89:        local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
                     90:        local sub=${p%${t}*}
                     91:        echo ${#sub}
1.1       todd       92: }
1.26      deraadt    93:
1.62      todd       94: h2d()
1.1       todd       95: {
1.62      todd       96:        local s="$1"
                     97:        local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*}
                     98:
                     99:        echo $(($(_h2d $f)*16+ $(_h2d $n) ))
                    100: }
                    101:
                    102: _h2d()
                    103: {
                    104:        case $1 in
                    105:        [0-9]) echo -n $1;;
                    106:        a) echo -n 10;;
                    107:        b) echo -n 11;;
                    108:        c) echo -n 12;;
                    109:        d) echo -n 13;;
                    110:        e) echo -n 14;;
                    111:        f) echo -n 15;;
1.1       todd      112:        esac
                    113: }
1.26      deraadt   114:
1.1       todd      115: unt()
                    116: {
                    117:        # XXX pdksh can't seem to deal with locally scoped variables
                    118:        # in ${foo#$bar} expansions
                    119:        arg="{-$-}1"
                    120:        tmp="${arg#[a-zA-Z]*}"
                    121:        tmp="${tmp%*[a-zA-Z]}"
                    122:        while [ "$tmp" != "$arg" ]
                    123:        do
                    124:                arg=$tmp
                    125:                tmp="${arg#[a-zA-Z]*}"
                    126:                tmp="${tmp%*[a-zA-Z]}"
                    127:        done
                    128:        echo $arg
                    129: }
                    130: dnl
1.29      todd      131: dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.5       todd      132: dnl   arg: 1    2    3      4      5    6    7
1.1       todd      133: dnl
1.26      deraadt   134:
1.1       todd      135: dodisk()
                    136: {
1.27      todd      137:        [ "$DEBUG" ] && set -x
1.29      todd      138:        n=Add(Mult(${5}, ${7:-16}), ${6}) count=0
1.13      todd      139:        [ 0$7 -ne 8 ] && l="i j k l m n o p"
                    140:        for d in a b c d e f g h $l
1.1       todd      141:        do
1.76      otto      142:                M {-$-}1{-$-}2$d        b {-$-}3 Add($n, $count) 640 operator
1.75      otto      143:                M r{-$-}1{-$-}2$d       c {-$-}4 Add($n, $count) 640 operator
1.1       todd      144:                let count=count+1
                    145:        done
                    146: }
                    147: dnl
1.29      todd      148: dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.1       todd      149: dnl
                    150: dnl 1. name    - prefix name of the device
                    151: dnl 2. unit    - beginning unit number for block devices
                    152: dnl 3. blkmaj  - block device major number
                    153: dnl 4. chrmaj  - character device major number
                    154: dnl 5. unit    - beginning unit number for character devices
                    155: dnl 6. off     - offset from 0 for all minor numbers (see svnd for an example)
1.5       todd      156: dnl 7. step    - optional, defaults to 16, number of partitions per device
1.1       todd      157: dnl
1.26      deraadt   158:
1.1       todd      159: dodisk2()
                    160: {
1.29      todd      161:        n=Add(Mult({-$-}5, ${7:-16}), {-$-}6)
1.1       todd      162:        M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
                    163:        M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
1.29      todd      164:        n=Add($n, 2)
1.1       todd      165:        M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
                    166:        M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
                    167: }
                    168:
                    169: # M name b/c major minor [mode] [group]
1.77      otto      170: RMlist[0]="rm -f"
1.26      deraadt   171:
1.1       todd      172: mkl() {
                    173: dnl
                    174: dnl non multi mknod
                    175: dnl
1.77      otto      176:        mklist[{-$-}{#mklist[*]}]=";mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
1.1       todd      177: }
1.26      deraadt   178:
1.1       todd      179: M() {
1.77      otto      180:        RMlist[{-$-}{#RMlist[*]}]={-$-}1
1.1       todd      181:        mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
                    182:        G={-$-}{6:-wheel}
                    183:        [ "{-$-}7" ] && {
1.77      otto      184:                MKlist[{-$-}{#MKlist[*]}]=";chown {-$-}7:{-$-}G {-$-}1"
1.1       todd      185:        } || {
                    186:                case $G in
1.77      otto      187:                wheel)
                    188:                        [ {-$-}{#whlist[*]} = 0 ] && whlist[0]=";chgrp wheel"
                    189:                        whlist[{-$-}{#whlist[*]}]="$1"
                    190:                ;;
                    191:                operator)
                    192:                        [ {-$-}{#oplist[*]} = 0 ] && oplist[0]=";chgrp operator"
                    193:                        oplist[{-$-}{#oplist[*]}]="$1"
                    194:                ;;
                    195:                *)
                    196:                        MKlist[{-$-}{#MKlist[*]}]=";chgrp $G $1";
1.1       todd      197:                esac
                    198:        }
                    199:        return 0
                    200: }
                    201: divert(7)dnl
                    202: dnl
                    203: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
                    204: dnl on the following line:
                    205:
                    206: show_devs()dnl
                    207: dnl
                    208: divert(9)dnl
                    209: *)
                    210:        echo $i: unknown device
                    211:        ;;
                    212: esac
                    213: done
                    214: }
                    215: _recurse "$@"
1.77      otto      216: {
                    217: echo -n ${RMlist[*]}
                    218: echo -n ${mklist[*]}
                    219: echo -n ${MKlist[*]}
                    220: echo -n ${whlist[*]}
                    221: echo ${oplist[*]}
                    222: } | if [ "$eo" = "echo" ]; then
                    223:         cat
1.1       todd      224: else
1.77      otto      225:        sh
1.1       todd      226: fi
1.41      todd      227: divert(3)dnl
1.1       todd      228: dnl
1.26      deraadt   229:
1.1       todd      230: R() {
1.23      todd      231: [ "$DEBUG" ] && set -x
1.1       todd      232: for i in "$@"
                    233: do
                    234: U=`unt $i`
                    235: [ "$U" ] || U=0
                    236:
                    237: case $i in
                    238: dnl