1#!/bin/sh - 2# 3# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 4# generated from: 5# 6# OpenBSD: etc.octeon/MAKEDEV.md,v 1.19 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# octcf* octeon compact flash 39# Tapes: 40# ch* SCSI media changers 41# st* SCSI tape drives 42# Terminal ports: 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# USB devices: 56# ttyU* USB serial ports 57# uall All USB devices 58# usb* Bus control devices used by usbd for attach/detach 59# uhid* Generic HID devices 60# fido fido/* nodes 61# Special purpose devices: 62# audio* Audio devices 63# bio ioctl tunnel pseudo-device 64# bpf Berkeley Packet Filter 65# dt Dynamic Tracer 66# diskmap Disk mapper 67# fd fd/* nodes 68# fuse Userland Filesystem 69# hotplug devices hot plugging 70# pci* PCI bus devices 71# pf* Packet Filter 72# pppx* PPP Multiplexer 73# pppac* PPP Access Concentrator 74# *random In-kernel random data source 75# tun* Network tunnel driver 76# tap* Ethernet tunnel driver 77# uk* Unknown SCSI devices 78# video* Video V4L2 devices 79# vscsi* Virtual SCSI controller 80# switch* Switch driver 81# kstat Kernel Statistics 82PATH=/sbin:/usr/sbin:/bin:/usr/bin 83T=$0 84 85# set this to echo for Echo-Only debugging 86[ "$eo" ] || eo= 87 88hex() 89{ 90 case $1 in 91 [0-9]) echo -n $1;; 92 10) echo -n a;; 93 11) echo -n b;; 94 12) echo -n c;; 95 13) echo -n d;; 96 14) echo -n e;; 97 15) echo -n f;; 98 esac 99} 100 101alph2d() 102{ 103 local t="$1" 104 local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 105 local sub=${p%${t}*} 106 echo ${#sub} 107} 108 109h2d() 110{ 111 local s="$1" 112 local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*} 113 114 echo $(($(_h2d $f)*16+ $(_h2d $n) )) 115} 116 117_h2d() 118{ 119 case $1 in 120 [0-9]) echo -n $1;; 121 a) echo -n 10;; 122 b) echo -n 11;; 123 c) echo -n 12;; 124 d) echo -n 13;; 125 e) echo -n 14;; 126 f) echo -n 15;; 127 esac 128} 129 130unt() 131{ 132 # XXX pdksh can't seem to deal with locally scoped variables 133 # in ${foo#$bar} expansions 134 arg="$1" 135 tmp="${arg#[a-zA-Z]*}" 136 tmp="${tmp%*[a-zA-Z]}" 137 while [ "$tmp" != "$arg" ] 138 do 139 arg=$tmp 140 tmp="${arg#[a-zA-Z]*}" 141 tmp="${tmp%*[a-zA-Z]}" 142 done 143 echo $arg 144} 145 146dodisk() 147{ 148 [ "$DEBUG" ] && set -x 149 n=$(($((${5}*${7:-16}))+${6})) count=0 150 [ 0$7 -ne 8 ] && l="i j k l m n o p" 151 for d in a b c d e f g h $l 152 do 153 M $1$2$d b $3 $(($n+$count)) 640 operator 154 M r$1$2$d c $4 $(($n+$count)) 640 operator 155 let count=count+1 156 done 157} 158 159dodisk2() 160{ 161 n=$(($(($5*${7:-16}))+$6)) 162 M $1$2a b $3 $n 640 operator 163 M r$1$2a c $4 $n 640 operator 164 n=$(($n+2)) 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] 170RMlist[0]="rm -f" 171 172mkl() { 173 : ${mklist[0]:=";mknod"} 174 mklist[${#mklist[*]}]=" -m $1 $2 $3 $4 $5" 175} 176 177M() { 178 RMlist[${#RMlist[*]}]=$1 179 mkl ${5-666} $1 $2 $3 $4 180 G=${6:-wheel} 181 [ "$7" ] && { 182 MKlist[${#MKlist[*]}]="&& chown $7:$G $1" 183 } || { 184 case $G in 185 wheel) 186 [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel" 187 whlist[${#whlist[*]}]="$1" 188 ;; 189 operator) 190 [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator" 191 oplist[${#oplist[*]}]="$1" 192 ;; 193 *) 194 MKlist[${#MKlist[*]}]="&& chgrp $G $1"; 195 esac 196 } 197 return 0 198} 199 200R() { 201[ "$DEBUG" ] && set -x 202for i in "$@" 203do 204U=`unt $i` 205[ "$U" ] || U=0 206 207case $i in 208boot) 209 R ramdisk random 210 M octboot c 21 0 600 211 ;; 212std) 213 M console c 0 0 600 214 M tty c 2 0 215 M mem c 3 0 640 kmem 216 M kmem c 3 1 640 kmem 217 M null c 3 2 218 M zero c 3 12 219 M stdin c 7 0 220 M stdout c 7 1 221 M stderr c 7 2 222 M ksyms c 35 0 640 kmem 223 M klog c 6 0 600 224 M openprom c 20 0 600 225 ;; 226 227kstat) 228 M kstat c 51 0 640 229 ;; 230 231switch*) 232 M switch$U c 75 $U 600 233 ;; 234 235vscsi*) 236 M vscsi$U c 69 $U 600 237 ;; 238 239video*) 240 M video$U c 45 $U 600 241 MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video" 242 ;; 243 244uk*) 245 M uk$U c 32 $U 640 operator 246 ;; 247 248tap*) 249 M tap$U c 74 $U 600 250 ;; 251 252tun*) 253 M tun$U c 13 $U 600 254 ;; 255 256*random) 257 M urandom c 33 0 644 258 RMlist[${#RMlist[*]}]=random 259 MKlist[${#MKlist[*]}]=";ln -s urandom random" 260 ;; 261 262pppac*) 263 M pppac$U c 77 $U 600 264 ;; 265 266pppx*) 267 M pppx$U c 71 $U 600 268 ;; 269 270pf*) 271 M pf c 31 0 600 272 ;; 273 274pci*) 275 M pci$U c 29 $U 600 276 MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci" 277 ;; 278 279hotplug) 280 M hotplug c 67 $U 400 281 ;; 282 283fuse) 284 M fuse$U c 53 $U 600 285 ;; 286 287fd) 288 RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0 289 while [ $n -lt 64 ];do M fd/$n c 7 $n;n=$(($n+1));done 290 MKlist[${#MKlist[*]}]=";chmod 555 fd" 291 ;; 292 293diskmap) 294 M diskmap c 70 0 640 operator 295 ;; 296 297dt) 298 M dt c 30 0 600 299 ;; 300 301bpf) 302 M bpf c 12 0 600 303 M bpf0 c 12 0 600 304 ;; 305 306bio) 307 M bio c 49 0 600 308 ;; 309 310audio*) 311 M audio$U c 44 $U 660 _sndiop 312 M audioctl$U c 44 $(($U+192)) 660 _sndiop 313 ;; 314 315fido) 316 RMlist[${#RMlist[*]}]=";mkdir -p fido;rm -f" n=0 317 while [ $n -lt 4 ];do M fido/$n c 76 $n 666;n=$(($n+1));done 318 MKlist[${#MKlist[*]}]=";chmod 555 fido" 319 ;; 320 321uhid*) 322 M uhid$U c 62 $U 600 323 ;; 324 325usb*) 326 [ "$i" = "usb" ] && u= || u=$U 327 M usb$u c 61 $U 640 328 ;; 329 330uall) 331 R ttyU0 ttyU1 ttyU2 ttyU3 fido uhid0 uhid1 uhid2 uhid3 uhid4 332 R uhid5 uhid6 uhid7 usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7 333 ;; 334 335ttyU[0-9a-zA-Z]) 336 U=${i#ttyU*} 337 o=$(alph2d $U) 338 M ttyU$U c 66 $o 660 dialer root 339 M cuaU$U c 66 $(($o+128)) 660 dialer root 340 ;; 341 342wsmouse[0-9]*) 343 M wsmouse$U c 27 $U 600 344 ;; 345 346wsmux|wsmouse|wskbd) 347 M wsmouse c 28 0 600 348 M wskbd c 28 1 600 349 ;; 350 351wskbd[0-9]*) 352 M wskbd$U c 26 $U 600 353 ;; 354 355wscons) 356 R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wsmouse4 wsmouse5 357 R wsmouse6 wsmouse7 wsmouse8 wsmouse9 wskbd0 wskbd1 wskbd2 358 R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 359 R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb 360 ;; 361 362tty[C-J]*) 363 U=${i##tty[C-J]} 364 case $i in 365 ttyC*) n=C m=0;; 366 ttyD*) n=D m=256;; 367 ttyE*) n=E m=512;; 368 ttyF*) n=F m=768;; 369 ttyG*) n=G m=1024;; 370 ttyH*) n=H m=1280;; 371 ttyI*) n=I m=1536;; 372 ttyJ*) n=J m=1792;; 373 esac 374 case $U in 375 [0-9a-f]) M tty$n$U c 25 $((16#$U+$m)) 600;; 376 cfg) M tty${n}cfg c 25 $((255+$m)) 600;; 377 *) echo bad unit $U for $i; exit 1;; 378 esac 379 ;; 380 381pty*) 382 if [ $U -gt 15 ]; then 383 echo bad unit for pty in: $i 384 continue 385 fi 386 set -A letters p q r s t u v w x y z P Q R S T 387 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 \ 388 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 \ 389 Y Z 390 391 name=${letters[$U]} 392 n=0 393 while [ $n -lt 62 ] 394 do 395 nam=$name${suffixes[$n]} 396 off=$(($U*62)) 397 M tty$nam c 4 $(($off+$n)) 398 M pty$nam c 5 $(($off+$n)) 399 n=$(($n+1)) 400 done 401 ;; 402 403ptm) 404 M ptm c 52 0 666 405 ;; 406 407tty[0-7][0-9a-f]) 408 U=${i#tty*} 409 o=$(h2d $U) 410 M tty$U c 17 $o 660 dialer root 411 M cua$U c 17 $(($o+128)) 660 dialer root 412 ;; 413 414st*) 415 n=$(($U*16)) 416 for pre in " " n e en 417 do 418 M ${pre}rst$U c 10 $n 660 operator 419 n=$(($n+1)) 420 done 421 ;; 422 423ch*) 424 M ch$U c 36 $U 660 operator 425 ;; 426 427vnd*) 428 dodisk vnd $U 2 11 $U 0 429 ;; 430 431rd*) 432 dodisk2 rd $U 8 22 $U 0 433 ;; 434 435cd*) 436 dodisk2 cd $U 3 8 $U 0 437 ;; 438 439local) 440 test -s $T.local && sh $T.local 441 ;; 442 443ramdisk) 444 R octcf0 diskmap bio pty0 rd0 cd0 cd1 st0 st1 wd0 wd1 wd2 wd3 445 R wd4 sd0 sd1 sd2 sd3 sd4 tty00 tty01 bpf std 446 ;; 447 448all) 449 R switch0 switch1 switch2 switch3 octcf0 vnd0 vnd1 vnd2 vnd3 450 R sd0 sd1 sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9 cd0 cd1 rd0 tap0 451 R tap1 tap2 tap3 tun0 tun1 tun2 tun3 bio pty0 pty1 pty2 452 R diskmap vscsi0 ch0 audio0 audio1 audio2 audio3 kstat dt bpf 453 R fuse pppac pppx hotplug ptm local wscons pci0 pci1 pci2 pci3 454 R uall video0 video1 uk0 random tty00 tty01 tty02 tty03 tty04 455 R tty05 tty06 tty07 tty08 tty09 tty0a tty0b pf wd0 wd1 wd2 wd3 456 R std st0 st1 fd 457 ;; 458 459octcf*|wd*|sd*) 460 case $i in 461 octcf*) dodisk octcf $U 15 15 $U 0;; 462 wd*) dodisk wd $U 4 18 $U 0;; 463 sd*) dodisk sd $U 0 9 $U 0;; 464 esac 465 ;; 466 467*) 468 echo $i: unknown device 469 ;; 470esac 471done 472} 473R "$@" 474{ 475echo -n ${RMlist[*]} 476echo -n ${mklist[*]} 477echo -n ${MKlist[*]} 478echo -n ${whlist[*]} 479echo ${oplist[*]} 480} | if [ "$eo" = "echo" ]; then 481 cat 482else 483 sh 484fi 485