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.

481 lines
9.0 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
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
  274. M mixer$U c 44 $(($U+16))
  275. M audioctl$U c 44 $(($U+192))
  276. MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer"
  277. ;;
  278. fido)
  279. RMlist[${#RMlist[*]}]=";mkdir -p fido;rm -f" n=0
  280. while [ $n -lt 4 ];do M fido/$n c 76 $n 666;n=$(($n+1));done
  281. MKlist[${#MKlist[*]}]=";chmod 555 fido"
  282. ;;
  283. uhid*)
  284. M uhid$U c 62 $U 600
  285. ;;
  286. usb*)
  287. [ "$i" = "usb" ] && u= || u=$U
  288. M usb$u c 61 $U 640
  289. ;;
  290. uall)
  291. R ttyU0 ttyU1 ttyU2 ttyU3 fido uhid0 uhid1 uhid2 uhid3 uhid4
  292. R uhid5 uhid6 uhid7 usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7
  293. ;;
  294. ttyU[0-9a-zA-Z])
  295. U=${i#ttyU*}
  296. o=$(alph2d $U)
  297. M ttyU$U c 66 $o 660 dialer root
  298. M cuaU$U c 66 $(($o+128)) 660 dialer root
  299. ;;
  300. wsmouse[0-9]*)
  301. M wsmouse$U c 27 $U 600
  302. ;;
  303. wsmux|wsmouse|wskbd)
  304. M wsmouse c 28 0 600
  305. M wskbd c 28 1 600
  306. ;;
  307. wskbd[0-9]*)
  308. M wskbd$U c 26 $U 600
  309. ;;
  310. wscons)
  311. R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wsmouse4 wsmouse5
  312. R wsmouse6 wsmouse7 wsmouse8 wsmouse9 wskbd0 wskbd1 wskbd2
  313. R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5
  314. R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb
  315. ;;
  316. tty[C-J]*)
  317. U=${i##tty[C-J]}
  318. case $i in
  319. ttyC*) n=C m=0;;
  320. ttyD*) n=D m=256;;
  321. ttyE*) n=E m=512;;
  322. ttyF*) n=F m=768;;
  323. ttyG*) n=G m=1024;;
  324. ttyH*) n=H m=1280;;
  325. ttyI*) n=I m=1536;;
  326. ttyJ*) n=J m=1792;;
  327. esac
  328. case $U in
  329. [0-9a-f]) M tty$n$U c 25 $((16#$U+$m)) 600;;
  330. cfg) M tty${n}cfg c 25 $((255+$m)) 600;;
  331. *) echo bad unit $U for $i; exit 1;;
  332. esac
  333. ;;
  334. pty*)
  335. if [ $U -gt 15 ]; then
  336. echo bad unit for pty in: $i
  337. continue
  338. fi
  339. set -A letters p q r s t u v w x y z P Q R S T
  340. 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 \
  341. 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 \
  342. Y Z
  343. name=${letters[$U]}
  344. n=0
  345. while [ $n -lt 62 ]
  346. do
  347. nam=$name${suffixes[$n]}
  348. off=$(($U*62))
  349. M tty$nam c 4 $(($off+$n))
  350. M pty$nam c 5 $(($off+$n))
  351. n=$(($n+1))
  352. done
  353. ;;
  354. ptm)
  355. M ptm c 52 0 666
  356. ;;
  357. tty[0-7][0-9a-f])
  358. U=${i#tty*}
  359. o=$(h2d $U)
  360. M tty$U c 17 $o 660 dialer root
  361. M cua$U c 17 $(($o+128)) 660 dialer root
  362. ;;
  363. st*)
  364. n=$(($U*16))
  365. for pre in " " n e en
  366. do
  367. M ${pre}rst$U c 10 $n 660 operator
  368. n=$(($n+1))
  369. done
  370. ;;
  371. ch*)
  372. M ch$U c 36 $U 660 operator
  373. ;;
  374. vnd*)
  375. dodisk vnd $U 2 11 $U 0
  376. ;;
  377. rd*)
  378. dodisk2 rd $U 8 22 $U 0
  379. ;;
  380. cd*)
  381. dodisk2 cd $U 3 8 $U 0
  382. ;;
  383. local)
  384. test -s $T.local && sh $T.local
  385. ;;
  386. ramdisk)
  387. R octcf0 diskmap bio pty0 rd0 cd0 cd1 st0 st1 wd0 wd1 wd2 wd3
  388. R wd4 sd0 sd1 sd2 sd3 sd4 tty00 tty01 bpf std
  389. ;;
  390. all)
  391. R switch0 switch1 switch2 switch3 octcf0 vnd0 vnd1 vnd2 vnd3
  392. R sd0 sd1 sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9 cd0 cd1 rd0 tap0
  393. R tap1 tap2 tap3 tun0 tun1 tun2 tun3 bio pty0 pty1 pty2
  394. R diskmap vscsi0 ch0 audio0 audio1 audio2 dt bpf fuse pppac
  395. R pppx hotplug ptm local wscons pci0 pci1 pci2 pci3 uall
  396. R video0 video1 uk0 random tty00 tty01 tty02 tty03 tty04 tty05
  397. R tty06 tty07 tty08 tty09 tty0a tty0b pf wd0 wd1 wd2 wd3 std
  398. R st0 st1 fd
  399. ;;
  400. octcf*|wd*|sd*)
  401. case $i in
  402. octcf*) dodisk octcf $U 15 15 $U 0;;
  403. wd*) dodisk wd $U 4 18 $U 0;;
  404. sd*) dodisk sd $U 0 9 $U 0;;
  405. esac
  406. ;;
  407. *)
  408. echo $i: unknown device
  409. ;;
  410. esac
  411. done
  412. }
  413. R "$@"
  414. {
  415. echo -n ${RMlist[*]}
  416. echo -n ${mklist[*]}
  417. echo -n ${MKlist[*]}
  418. echo -n ${whlist[*]}
  419. echo ${oplist[*]}
  420. } | if [ "$eo" = "echo" ]; then
  421. cat
  422. else
  423. sh
  424. fi