Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

531 lines
10 KiB

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