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.

479 lines
8.9 KiB

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