mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Greatly speedup MAKEDEV by using arrays instead of very long strings
that get copied around a lot. Needs sh(1) max array index bump I committed earlier. ok todd@ deraadt@
This commit is contained in:
parent
69485dd93e
commit
449c289590
@ -1,4 +1,4 @@
|
|||||||
vers(a, {-$OpenBSD: MAKEDEV.common,v 1.20 2005/08/01 22:22:12 deraadt Exp $-})dnl
|
vers(a, {-$OpenBSD: MAKEDEV.common,v 1.21 2005/10/06 06:43:19 otto Exp $-})dnl
|
||||||
divert(1)dnl
|
divert(1)dnl
|
||||||
dnl
|
dnl
|
||||||
dnl Common device definitions.
|
dnl Common device definitions.
|
||||||
@ -226,8 +226,8 @@ __devitem(ss, ss*, SCSI scanners)dnl
|
|||||||
_mkdev(ss, ss*, {-M ss$U c major_ss_c Mult($U,16) 640 operator
|
_mkdev(ss, ss*, {-M ss$U c major_ss_c Mult($U,16) 640 operator
|
||||||
M nss$U c major_ss_c Add(Mult($U,16),1) 640 operator
|
M nss$U c major_ss_c Add(Mult($U,16),1) 640 operator
|
||||||
M enss$U c major_ss_c Add(Mult($U,16),3) 640 operator
|
M enss$U c major_ss_c Add(Mult($U,16),3) 640 operator
|
||||||
RMlist="$RMlist scan$U"
|
RMlist[${#RMlist[*]}]="scan$U"
|
||||||
MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl
|
MKlist[${#MKlist[*]}]=";umask 77;ln -s ss$U scan$U"-})dnl
|
||||||
dnl XXX see ramdisk above
|
dnl XXX see ramdisk above
|
||||||
__devitem(ramd, ramdisk, Ramdisk kernel devices,nothing)dnl
|
__devitem(ramd, ramdisk, Ramdisk kernel devices,nothing)dnl
|
||||||
_mkdev(ramd, ramdisk, {-dnl
|
_mkdev(ramd, ramdisk, {-dnl
|
||||||
@ -450,10 +450,10 @@ _mkdev(au, audio*, {-M sound$U c major_au_c $U
|
|||||||
M mixer$U c major_au_c Add($U, 16)
|
M mixer$U c major_au_c Add($U, 16)
|
||||||
M audio$U c major_au_c Add($U, 128)
|
M audio$U c major_au_c Add($U, 128)
|
||||||
M audioctl$U c major_au_c Add($U, 192)
|
M audioctl$U c major_au_c Add($U, 192)
|
||||||
MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
|
MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio"
|
||||||
MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
|
MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer"
|
||||||
MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
|
MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound"
|
||||||
MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
|
MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
|
||||||
__devitem(asc, asc*, ASC Audio device)dnl
|
__devitem(asc, asc*, ASC Audio device)dnl
|
||||||
_mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
|
_mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
|
||||||
__devitem(bio, bio, {-ioctl tunnel pseudo-device-})dnl
|
__devitem(bio, bio, {-ioctl tunnel pseudo-device-})dnl
|
||||||
@ -461,15 +461,15 @@ _mkdev(bio, bio, {-M bio c major_bio_c 0 600-})dnl
|
|||||||
__devitem(music, music*, MIDI devices,midi)dnl
|
__devitem(music, music*, MIDI devices,midi)dnl
|
||||||
_mkdev(music, music*, {-M music$U c major_music_c $U
|
_mkdev(music, music*, {-M music$U c major_music_c $U
|
||||||
M sequencer$U c major_music_c Add($U, 128)
|
M sequencer$U c major_music_c Add($U, 128)
|
||||||
MKlist="$MKlist;[ -e music ] || ln -s music$U music"
|
MKlist[${#MKlist[*]}]=";[ -e music ] || ln -s music$U music"
|
||||||
MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
|
MKlist[${#MKlist[*]}]=";[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
|
||||||
__devitem(radio, radio*, FM tuner devices)dnl
|
__devitem(radio, radio*, FM tuner devices)dnl
|
||||||
_mkdev(radio, radio*, {-M radio$U c major_radio_c $U
|
_mkdev(radio, radio*, {-M radio$U c major_radio_c $U
|
||||||
MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl
|
MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio"-})dnl
|
||||||
__devitem(fdesc, fd, fd/* nodes for fdescfs,mount_fdesc 8)dnl
|
__devitem(fdesc, fd, fd/* nodes for fdescfs,mount_fdesc 8)dnl
|
||||||
_mkdev(fdesc, fd, {-RMlist="mkdir -p fd;$RMlist" n=0
|
_mkdev(fdesc, fd, {-RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0
|
||||||
while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
|
while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
|
||||||
MKlist="$MKlist;chmod 555 fd"-})dnl
|
MKlist[${#MKlist[*]}]=";chmod 555 fd"-})dnl
|
||||||
__devitem(grf_mac, grf*, Raw interface to the mac68k graphics devices,grf)dnl
|
__devitem(grf_mac, grf*, Raw interface to the mac68k graphics devices,grf)dnl
|
||||||
__devitem(oppr, openprom,PROM settings,openprom)dnl
|
__devitem(oppr, openprom,PROM settings,openprom)dnl
|
||||||
_cdev(oppr, openprom, 70, 0)dnl
|
_cdev(oppr, openprom, 70, 0)dnl
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
define(COMM,`#')dnl
|
define(COMM,`#')dnl
|
||||||
include(MAKEDEV.sub)dnl
|
include(MAKEDEV.sub)dnl
|
||||||
dnl
|
dnl
|
||||||
vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.76 2005/10/04 18:33:52 otto Exp $-})dnl
|
vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.77 2005/10/06 06:43:19 otto Exp $-})dnl
|
||||||
dnl
|
dnl
|
||||||
divert(1)dnl
|
divert(1)dnl
|
||||||
{-#-}
|
{-#-}
|
||||||
@ -169,45 +169,34 @@ dodisk2()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# M name b/c major minor [mode] [group]
|
# M name b/c major minor [mode] [group]
|
||||||
RMlist="rm -f"
|
RMlist[0]="rm -f"
|
||||||
MKlist=":"
|
|
||||||
|
|
||||||
mkl() {
|
mkl() {
|
||||||
dnl
|
dnl
|
||||||
dnl uncomment if multi mknod happens
|
|
||||||
dnl
|
|
||||||
ifelse(1, 0,
|
|
||||||
[ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
|
|
||||||
mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
|
|
||||||
modes="$modes {-$-}1"
|
|
||||||
},
|
|
||||||
dnl
|
|
||||||
dnl non multi mknod
|
dnl non multi mknod
|
||||||
dnl
|
dnl
|
||||||
[ "${mklist[{-$-}1]}" ] && {
|
mklist[{-$-}{#mklist[*]}]=";mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
|
||||||
mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
|
|
||||||
} || {
|
|
||||||
mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
|
|
||||||
modes="$modes {-$-}1"
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
M() {
|
M() {
|
||||||
RMlist="$RMlist {-$-}1"
|
RMlist[{-$-}{#RMlist[*]}]={-$-}1
|
||||||
mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
|
mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
|
||||||
G={-$-}{6:-wheel}
|
G={-$-}{6:-wheel}
|
||||||
[ "{-$-}7" ] && {
|
[ "{-$-}7" ] && {
|
||||||
MKlist="$MKlist;chown {-$-}7:{-$-}G {-$-}1"
|
MKlist[{-$-}{#MKlist[*]}]=";chown {-$-}7:{-$-}G {-$-}1"
|
||||||
} || {
|
} || {
|
||||||
case $G in
|
case $G in
|
||||||
wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;_lkm)g=61;;
|
wheel)
|
||||||
|
[ {-$-}{#whlist[*]} = 0 ] && whlist[0]=";chgrp wheel"
|
||||||
|
whlist[{-$-}{#whlist[*]}]="$1"
|
||||||
|
;;
|
||||||
|
operator)
|
||||||
|
[ {-$-}{#oplist[*]} = 0 ] && oplist[0]=";chgrp operator"
|
||||||
|
oplist[{-$-}{#oplist[*]}]="$1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
MKlist[{-$-}{#MKlist[*]}]=";chgrp $G $1";
|
||||||
esac
|
esac
|
||||||
[ "${grplist[$g]}" ] && {
|
|
||||||
grplist[$g]="${grplist[$g]} {-$-}1"
|
|
||||||
} || {
|
|
||||||
groups="$groups $g"
|
|
||||||
grplist[$g]="chgrp $G {-$-}1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -226,18 +215,16 @@ esac
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
_recurse "$@"
|
_recurse "$@"
|
||||||
list="$RMlist"
|
{
|
||||||
for mode in $modes; do
|
echo -n ${RMlist[*]}
|
||||||
list="$list;${mklist[$mode]}"
|
echo -n ${mklist[*]}
|
||||||
done
|
echo -n ${MKlist[*]}
|
||||||
for group in $groups; do
|
echo -n ${whlist[*]}
|
||||||
list="$list;${grplist[$group]}"
|
echo ${oplist[*]}
|
||||||
done
|
} | if [ "$eo" = "echo" ]; then
|
||||||
list="$list;$MKlist"
|
cat
|
||||||
if [ "$eo" = "echo" ]; then
|
|
||||||
$eo "$list"
|
|
||||||
else
|
else
|
||||||
echo "$list" | sh
|
sh
|
||||||
fi
|
fi
|
||||||
divert(3)dnl
|
divert(3)dnl
|
||||||
dnl
|
dnl
|
||||||
|
Loading…
Reference in New Issue
Block a user