1#!/bin/sh - 2# 3# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 4# generated from: 5# 6# OpenBSD: etc.luna88k/MAKEDEV.md,v 1.35 2020/07/06 06:11:27 dlg Exp 7# OpenBSD: MAKEDEV.common,v 1.111 2020/07/06 06:11:26 dlg Exp 8# OpenBSD: MAKEDEV.mi,v 1.83 2016/09/11 03:06:31 deraadt Exp 9# OpenBSD: MAKEDEV.sub,v 1.14 2005/02/07 06:14:18 david Exp 10# 11# 12# Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org> 13# 14# Permission to use, copy, modify, and distribute this software for any 15# purpose with or without fee is hereby granted, provided that the above 16# copyright notice and this permission notice appear in all copies. 17# 18# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 19# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 20# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 21# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 22# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 23# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 24# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25# 26# Device "make" file. Valid arguments: 27# all makes all known devices, including local devices. 28# Tries to make the ``standard'' number of each type. 29# ramdisk Ramdisk kernel devices 30# std Standard devices 31# local Configuration specific devices 32# Disks: 33# cd* ATAPI and SCSI CD-ROM drives 34# rd* "rd" pseudo-disks 35# sd* SCSI disks, including flopticals 36# vnd* "file" pseudo-disk devices 37# wd* "winchester" disk drives (ST506, IDE, ESDI, RLL, ...) 38# Tapes: 39# ch* SCSI media changers 40# st* SCSI tape drives 41# Terminal ports: 42# ttya On-board serial console port 43# tty[0-7][0-9a-f] NS16x50 serial ports 44# Pseudo terminals: 45# ptm pty master device 46# pty* Set of 62 master pseudo terminals 47# tty* Set of 62 slave pseudo terminals 48# Console ports: 49# ttyC-J* wscons display devices 50# wscons Minimal wscons devices 51# wskbd* wscons keyboards 52# wsmux wscons keyboard/mouse mux devices 53# Pointing devices: 54# wsmouse* wscons mice 55# Special purpose devices: 56# audio* Audio devices 57# bio ioctl tunnel pseudo-device 58# bpf Berkeley Packet Filter 59# dt Dynamic Tracer 60# diskmap Disk mapper 61# fd fd/* nodes 62# fuse Userland Filesystem 63# lcd front panel LCD display 64# pcex* PC-9801 extension board slot 65# pf* Packet Filter 66# pppx* PPP Multiplexer 67# pppac* PPP Access Concentrator 68# *random In-kernel random data source 69# tun* Network tunnel driver 70# tap* Ethernet tunnel driver 71# uk* Unknown SCSI devices 72# vscsi* Virtual SCSI controller 73# switch* Switch driver 74# xp HD647180 I/O processor 75# kstat Kernel Statistics 76PATH=/sbin:/usr/sbin:/bin:/usr/bin 77T=$0 78 79# set this to echo for Echo-Only debugging 80[ "$eo" ] || eo= 81 82hex() 83{ 84 case $1 in 85 [0-9]) echo -n $1;; 86 10) echo -n a;; 87 11) echo -n b;; 88 12) echo -n c;; 89 13) echo -n d;; 90 14) echo -n e;; 91 15) echo -n f;; 92 esac 93} 94 95alph2d() 96{ 97 local t="$1" 98 local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 99 local sub=${p%${t}*} 100 echo ${#sub} 101} 102 103h2d() 104{ 105 local s="$1" 106 local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*} 107 108 echo $(($(_h2d $f)*16+ $(_h2d $n) )) 109} 110 111_h2d() 112{ 113 case $1 in 114 [0-9]) echo -n $1;; 115 a) echo -n 10;; 116 b) echo -n 11;; 117 c) echo -n 12;; 118 d) echo -n 13;; 119 e) echo -n 14;; 120 f) echo -n 15;; 121 esac 122} 123 124unt() 125{ 126 # XXX pdksh can't seem to deal with locally scoped variables 127 # in ${foo#$bar} expansions 128 arg="$1" 129 tmp="${arg#[a-zA-Z]*}" 130 tmp="${tmp%*[a-zA-Z]}" 131 while [ "$tmp" != "$arg" ] 132 do 133 arg=$tmp 134 tmp="${arg#[a-zA-Z]*}" 135 tmp="${tmp%*[a-zA-Z]}" 136 done 137 echo $arg 138} 139 140dodisk() 141{ 142 [ "$DEBUG" ] && set -x 143 n=$(($((${5}*${7:-16}))+${6})) count=0 144 [ 0$7 -ne 8 ] && l="i j k l m n o p" 145 for d in a b c d e f g h $l 146 do 147 M $1$2$d b $3 $(($n+$count)) 640 operator 148 M r$1$2$d c $4 $(($n+$count)) 640 operator 149 let count=count+1 150 done 151} 152 153dodisk2() 154{ 155 n=$(($(($5*${7:-16}))+$6)) 156 M $1$2a b $3 $n 640 operator 157 M r$1$2a c $4 $n 640 operator 158 n=$(($n+2)) 159 M $1$2c b $3 $n 640 operator 160 M r$1$2c c $4 $n 640 operator 161} 162 163# M name b/c major minor [mode] [group] 164RMlist[0]="rm -f" 165 166mkl() { 167 : ${mklist[0]:=";mknod"} 168 mklist[${#mklist[*]}]=" -m $1 $2 $3 $4 $5" 169} 170 171M() { 172 RMlist[${#RMlist[*]}]=$1 173 mkl ${5-666} $1 $2 $3 $4 174 G=${6:-wheel} 175 [ "$7" ] && { 176 MKlist[${#MKlist[*]}]="&& chown $7:$G $1" 177 } || { 178 case $G in 179 wheel) 180 [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel" 181 whlist[${#whlist[*]}]="$1" 182 ;; 183 operator) 184 [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator" 185 oplist[${#oplist[*]}]="$1" 186 ;; 187 *) 188 MKlist[${#MKlist[*]}]="&& chgrp $G $1"; 189 esac 190 } 191 return 0 192} 193 194R() { 195[ "$DEBUG" ] && set -x 196for i in "$@" 197do 198U=`unt $i` 199[ "$U" ] || U=0 200 201case $i in 202std) 203 M console c 0 0 600 204 M tty c 1 0 205 M mem c 2 0 640 kmem 206 M kmem c 2 1 640 kmem 207 M null c 2 2 208 M zero c 2 12 209 M stdin c 21 0 210 M stdout c 21 1 211 M stderr c 21 2 212 M ksyms c 43 0 640 kmem 213 M klog c 6 0 600 214 ;; 215 216 217kstat) 218 M kstat c 51 0 640 219 ;; 220 221xp) 222 M xp c 11 0 600 223 ;; 224 225switch*) 226 M switch$U c 57 $U 600 227 ;; 228 229vscsi*) 230 M vscsi$U c 53 $U 600 231 ;; 232 233uk*) 234 M uk$U c 41 $U 640 operator 235 ;; 236 237tap*) 238 M tap$U c 56 $U 600 239 ;; 240 241tun*) 242 M tun$U c 23 $U 600 243 ;; 244 245*random) 246 M urandom c 40 0 644 247 RMlist[${#RMlist[*]}]=random 248 MKlist[${#MKlist[*]}]=";ln -s urandom random" 249 ;; 250 251pppac*) 252 M pppac$U c 58 $U 600 253 ;; 254 255pppx*) 256 M pppx$U c 55 $U 600 257 ;; 258 259pf*) 260 M pf c 39 0 600 261 ;; 262 263pcex) 264 M pcexmem c 25 0 660 265 M pcexio c 25 1 660 266 ;; 267 268lcd) 269 M lcd c 10 0 644 270 ;; 271 272fuse) 273 M fuse$U c 45 $U 600 274 ;; 275 276fd) 277 RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0 278 while [ $n -lt 64 ];do M fd/$n c 21 $n;n=$(($n+1));done 279 MKlist[${#MKlist[*]}]=";chmod 555 fd" 280 ;; 281 282diskmap) 283 M diskmap c 54 0 640 operator 284 ;; 285 286dt) 287 M dt c 30 0 600 288 ;; 289 290bpf) 291 M bpf c 22 0 600 292 M bpf0 c 22 0 600 293 ;; 294 295bio) 296 M bio c 49 0 600 297 ;; 298 299audio*) 300 M audio$U c 26 $U 660 _sndiop 301 M audioctl$U c 26 $(($U+192)) 660 _sndiop 302 ;; 303 304wsmouse[0-9]*) 305 M wsmouse$U c 15 $U 600 306 ;; 307 308wsmux|wsmouse|wskbd) 309 M wsmouse c 16 0 600 310 M wskbd c 16 1 600 311 ;; 312 313wskbd[0-9]*) 314 M wskbd$U c 14 $U 600 315 ;; 316 317wscons) 318 R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wsmouse4 wsmouse5 319 R wsmouse6 wsmouse7 wsmouse8 wsmouse9 wskbd0 wskbd1 wskbd2 320 R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 321 R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb 322 ;; 323 324tty[C-J]*) 325 U=${i##tty[C-J]} 326 case $i in 327 ttyC*) n=C m=0;; 328 ttyD*) n=D m=256;; 329 ttyE*) n=E m=512;; 330 ttyF*) n=F m=768;; 331 ttyG*) n=G m=1024;; 332 ttyH*) n=H m=1280;; 333 ttyI*) n=I m=1536;; 334 ttyJ*) n=J m=1792;; 335 esac 336 case $U in 337 [0-9a-f]) M tty$n$U c 13 $((16#$U+$m)) 600;; 338 cfg) M tty${n}cfg c 13 $((255+$m)) 600;; 339 *) echo bad unit $U for $i; exit 1;; 340 esac 341 ;; 342 343pty*) 344 if [ $U -gt 15 ]; then 345 echo bad unit for pty in: $i 346 continue 347 fi 348 set -A letters p q r s t u v w x y z P Q R S T 349 set -A suffixes 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 \ 350 r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X \ 351 Y Z 352 353 name=${letters[$U]} 354 n=0 355 while [ $n -lt 62 ] 356 do 357 nam=$name${suffixes[$n]} 358 off=$(($U*62)) 359 M tty$nam c 4 $(($off+$n)) 360 M pty$nam c 5 $(($off+$n)) 361 n=$(($n+1)) 362 done 363 ;; 364 365ptm) 366 M ptm c 52 0 666 367 ;; 368 369tty[0-7][0-9a-f]) 370 U=${i#tty*} 371 o=$(h2d $U) 372 M tty$U c 27 $o 660 dialer root 373 M cua$U c 27 $(($o+128)) 660 dialer root 374 ;; 375 376ttya) 377 M ttya c 12 0 660 dialer root 378 M cuaa c 12 128 660 dialer root 379 ;; 380 381st*) 382 n=$(($U*16)) 383 for pre in " " n e en 384 do 385 M ${pre}rst$U c 20 $n 660 operator 386 n=$(($n+1)) 387 done 388 ;; 389 390ch*) 391 M ch$U c 44 $U 660 operator 392 ;; 393 394vnd*) 395 dodisk vnd $U 8 19 $U 0 396 ;; 397 398rd*) 399 dodisk2 rd $U 7 18 $U 0 400 ;; 401 402cd*) 403 dodisk2 cd $U 6 9 $U 0 404 ;; 405 406local) 407 test -s $T.local && sh $T.local 408 ;; 409 410ramdisk) 411 R diskmap bio pty0 ttya rd0 cd0 cd1 st0 st1 wd0 wd1 wd2 wd3 412 R wd4 sd0 sd1 sd2 sd3 sd4 tty00 tty01 bpf std 413 ;; 414 415all) 416 R xp pcex audio0 lcd ttya switch0 switch1 switch2 switch3 417 R vnd0 vnd1 vnd2 vnd3 sd0 sd1 sd2 sd3 sd4 cd0 cd1 rd0 tap0 418 R tap1 tap2 tap3 tun0 tun1 tun2 tun3 bio pty0 diskmap vscsi0 419 R ch0 kstat dt bpf fuse pppac pppx ptm local wscons uk0 random 420 R tty00 tty01 tty02 tty03 tty04 tty05 tty06 tty07 tty08 tty09 421 R tty0a tty0b pf wd0 wd1 wd2 wd3 std st0 st1 fd 422 ;; 423 424wd*|sd*) 425 case $i in 426 wd*) dodisk wd $U 9 28 $U 0;; 427 sd*) dodisk sd $U 4 8 $U 0;; 428 esac 429 ;; 430 431*) 432 echo $i: unknown device 433 ;; 434esac 435done 436} 437R "$@" 438{ 439echo -n ${RMlist[*]} 440echo -n ${mklist[*]} 441echo -n ${MKlist[*]} 442echo -n ${whlist[*]} 443echo ${oplist[*]} 444} | if [ "$eo" = "echo" ]; then 445 cat 446else 447 sh 448fi 449