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.

441 lines
8.4 KiB

10 years ago
11 years ago
11 years ago
11 years ago
11 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.5 2014/10/09 04:37:43 tedu Exp
  7. # OpenBSD: MAKEDEV.common,v 1.77 2014/10/09 04:33:50 tedu Exp
  8. # OpenBSD: MAKEDEV.mi,v 1.81 2012/11/05 08:07:09 jasper 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. # Special purpose devices:
  58. # audio* Audio devices
  59. # bio ioctl tunnel pseudo-device
  60. # bpf* Berkeley Packet Filter
  61. # diskmap Disk mapper
  62. # fd fd/* nodes
  63. # fuse Userland Filesystem
  64. # hotplug devices hot plugging
  65. # pci* PCI bus devices
  66. # pf* Packet Filter
  67. # pppx* PPP Multiplexer
  68. # *random In-kernel random data source
  69. # systrace* System call tracing device
  70. # tun* Network tunnel driver
  71. # uk* Unknown SCSI devices
  72. # video* Video V4L2 devices
  73. # vscsi* Virtual SCSI controller
  74. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  75. T=$0
  76. # set this to echo for Echo-Only debugging
  77. [ "$eo" ] || eo=
  78. hex()
  79. {
  80. case $1 in
  81. [0-9]) echo -n $1;;
  82. 10) echo -n a;;
  83. 11) echo -n b;;
  84. 12) echo -n c;;
  85. 13) echo -n d;;
  86. 14) echo -n e;;
  87. 15) echo -n f;;
  88. esac
  89. }
  90. alph2d()
  91. {
  92. local t="$1"
  93. local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  94. local sub=${p%${t}*}
  95. echo ${#sub}
  96. }
  97. h2d()
  98. {
  99. local s="$1"
  100. local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*}
  101. echo $(($(_h2d $f)*16+ $(_h2d $n) ))
  102. }
  103. _h2d()
  104. {
  105. case $1 in
  106. [0-9]) echo -n $1;;
  107. a) echo -n 10;;
  108. b) echo -n 11;;
  109. c) echo -n 12;;
  110. d) echo -n 13;;
  111. e) echo -n 14;;
  112. f) echo -n 15;;
  113. esac
  114. }
  115. unt()
  116. {
  117. # XXX pdksh can't seem to deal with locally scoped variables
  118. # in ${foo#$bar} expansions
  119. arg="$1"
  120. tmp="${arg#[a-zA-Z]*}"
  121. tmp="${tmp%*[a-zA-Z]}"
  122. while [ "$tmp" != "$arg" ]
  123. do
  124. arg=$tmp
  125. tmp="${arg#[a-zA-Z]*}"
  126. tmp="${tmp%*[a-zA-Z]}"
  127. done
  128. echo $arg
  129. }
  130. dodisk()
  131. {
  132. [ "$DEBUG" ] && set -x
  133. n=$(($((${5}*${7:-16}))+${6})) count=0
  134. [ 0$7 -ne 8 ] && l="i j k l m n o p"
  135. for d in a b c d e f g h $l
  136. do
  137. M $1$2$d b $3 $(($n+$count)) 640 operator
  138. M r$1$2$d c $4 $(($n+$count)) 640 operator
  139. let count=count+1
  140. done
  141. }
  142. dodisk2()
  143. {
  144. n=$(($(($5*${7:-16}))+$6))
  145. M $1$2a b $3 $n 640 operator
  146. M r$1$2a c $4 $n 640 operator
  147. n=$(($n+2))
  148. M $1$2c b $3 $n 640 operator
  149. M r$1$2c c $4 $n 640 operator
  150. }
  151. # M name b/c major minor [mode] [group]
  152. RMlist[0]="rm -f"
  153. mkl() {
  154. mklist[${#mklist[*]}]=";mknod -m $1 $2 $3 $4 $5"
  155. }
  156. M() {
  157. RMlist[${#RMlist[*]}]=$1
  158. mkl ${5-666} $1 $2 $3 $4
  159. G=${6:-wheel}
  160. [ "$7" ] && {
  161. MKlist[${#MKlist[*]}]="&& chown $7:$G $1"
  162. } || {
  163. case $G in
  164. wheel)
  165. [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel"
  166. whlist[${#whlist[*]}]="$1"
  167. ;;
  168. operator)
  169. [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator"
  170. oplist[${#oplist[*]}]="$1"
  171. ;;
  172. *)
  173. MKlist[${#MKlist[*]}]="&& chgrp $G $1";
  174. esac
  175. }
  176. return 0
  177. }
  178. R() {
  179. [ "$DEBUG" ] && set -x
  180. for i in "$@"
  181. do
  182. U=`unt $i`
  183. [ "$U" ] || U=0
  184. case $i in
  185. std)
  186. M console c 0 0 600
  187. M tty c 2 0
  188. M mem c 3 0 640 kmem
  189. M kmem c 3 1 640 kmem
  190. M null c 3 2
  191. M zero c 3 12
  192. M stdin c 7 0
  193. M stdout c 7 1
  194. M stderr c 7 2
  195. M ksyms c 35 0 640 kmem
  196. M klog c 6 0 600
  197. ;;
  198. vscsi*)
  199. M vscsi$U c 68 $U 600
  200. ;;
  201. video*)
  202. M video$U c 45 $U
  203. MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video"
  204. ;;
  205. uk*)
  206. M uk$U c 32 $U 640 operator
  207. ;;
  208. tun*)
  209. M tun$U c 13 $U 600
  210. ;;
  211. systrace)
  212. M systrace c 50 0 644
  213. ;;
  214. *random)
  215. n=0
  216. for pre in " " s u a
  217. do
  218. M ${pre}random c 33 $n 644
  219. n=$(($n+1))
  220. done
  221. ;;
  222. pppx*)
  223. M pppx$U c 70 $U 600
  224. ;;
  225. pf*)
  226. M pf c 31 0 600
  227. ;;
  228. pci*)
  229. M pci$U c 29 $U 600
  230. MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci"
  231. ;;
  232. hotplug)
  233. M hotplug c 67 $U 400
  234. ;;
  235. fuse)
  236. M fuse$U c 53 $U 600
  237. ;;
  238. fd)
  239. RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0
  240. while [ $n -lt 64 ];do M fd/$n c 7 $n;n=$(($n+1));done
  241. MKlist[${#MKlist[*]}]=";chmod 555 fd"
  242. ;;
  243. diskmap)
  244. M diskmap c 69 0 640 operator
  245. ;;
  246. bpf*)
  247. M bpf$U c 12 $U 600
  248. ;;
  249. bio)
  250. M bio c 49 0 600
  251. ;;
  252. audio*)
  253. M sound$U c 44 $U
  254. M mixer$U c 44 $(($U+16))
  255. M audio$U c 44 $(($U+128))
  256. M audioctl$U c 44 $(($U+192))
  257. MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio"
  258. MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer"
  259. MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound"
  260. MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U audioctl"
  261. ;;
  262. ttyU[0-9a-zA-Z])
  263. U=${i#ttyU*}
  264. o=$(alph2d $U)
  265. M ttyU$U c 66 $o 660 dialer uucp
  266. M cuaU$U c 66 $(($o+128)) 660 dialer uucp
  267. ;;
  268. wsmouse[0-9]*)
  269. M wsmouse$U c 27 $U 600
  270. ;;
  271. wsmux|wsmouse|wskbd)
  272. M wsmouse c 28 0 600
  273. M wskbd c 28 1 600
  274. ;;
  275. wskbd[0-9]*)
  276. M wskbd$U c 26 $U 600
  277. ;;
  278. wscons)
  279. R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wskbd0 wskbd1 wskbd2
  280. R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5
  281. R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb
  282. ;;
  283. tty[C-J]*)
  284. U=${i##tty[C-J]}
  285. case $i in
  286. ttyC*) n=C m=0;;
  287. ttyD*) n=D m=256;;
  288. ttyE*) n=E m=512;;
  289. ttyF*) n=F m=768;;
  290. ttyG*) n=G m=1024;;
  291. ttyH*) n=H m=1280;;
  292. ttyI*) n=I m=1536;;
  293. ttyJ*) n=J m=1792;;
  294. esac
  295. case $U in
  296. [0-9a-f]) M tty$n$U c 25 $((16#$U+$m)) 600;;
  297. cfg) M tty${n}cfg c 25 $((255+$m)) 600;;
  298. *) echo bad unit $U for $i; exit 1;;
  299. esac
  300. ;;
  301. pty*)
  302. if [ $U -gt 15 ]; then
  303. echo bad unit for pty in: $i
  304. continue
  305. fi
  306. set -A letters p q r s t u v w x y z P Q R S T
  307. 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 \
  308. 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 \
  309. Y Z
  310. name=${letters[$U]}
  311. n=0
  312. while [ $n -lt 62 ]
  313. do
  314. nam=$name${suffixes[$n]}
  315. off=$(($U*62))
  316. M tty$nam c 4 $(($off+$n))
  317. M pty$nam c 5 $(($off+$n))
  318. n=$(($n+1))
  319. done
  320. ;;
  321. ptm)
  322. M ptm c 52 0 666
  323. ;;
  324. tty[0-7][0-9a-f])
  325. U=${i#tty*}
  326. o=$(h2d $U)
  327. M tty$U c 17 $o 660 dialer uucp
  328. M cua$U c 17 $(($o+128)) 660 dialer uucp
  329. ;;
  330. st*)
  331. n=$(($U*16))
  332. for pre in " " n e en
  333. do
  334. M ${pre}st$U b 10 $n 660 operator
  335. M ${pre}rst$U c 10 $n 660 operator
  336. n=$(($n+1))
  337. done
  338. ;;
  339. ch*)
  340. M ch$U c 36 $U 660 operator
  341. ;;
  342. vnd*)
  343. dodisk vnd $U 2 11 $U 0
  344. ;;
  345. rd*)
  346. dodisk2 rd $U 8 22 $U 0
  347. ;;
  348. cd*)
  349. dodisk2 cd $U 3 8 $U 0
  350. ;;
  351. local)
  352. test -s $T.local && sh $T.local
  353. ;;
  354. ramdisk)
  355. R octcf0 diskmap bio pty0 rd0 cd0 cd1 st0 st1 wd0 wd1 wd2 wd3
  356. R wd4 sd0 sd1 sd2 sd3 sd4 tty00 tty01 bpf0 std
  357. ;;
  358. all)
  359. R octcf0 vnd0 vnd1 vnd2 vnd3 sd0 sd1 sd2 sd3 sd4 sd5 sd6 sd7
  360. R sd8 sd9 cd0 cd1 rd0 tun0 tun1 tun2 tun3 bio bpf0 bpf1 bpf2
  361. R bpf3 bpf4 bpf5 bpf6 bpf7 bpf8 bpf9 pty0 pty1 pty2 diskmap
  362. R vscsi0 ch0 audio0 audio1 audio2 fuse pppx hotplug ptm local
  363. R wscons pci0 pci1 pci2 pci3 video0 video1 uk0 random tty00
  364. R tty01 tty02 tty03 tty04 tty05 tty06 tty07 tty08 tty09 tty0a
  365. R tty0b pf systrace wd0 wd1 wd2 wd3 std st0 st1 fd
  366. ;;
  367. octcf*|wd*|sd*)
  368. case $i in
  369. octcf*) dodisk octcf $U 15 15 $U 0;;
  370. wd*) dodisk wd $U 4 18 $U 0;;
  371. sd*) dodisk sd $U 0 9 $U 0;;
  372. esac
  373. ;;
  374. *)
  375. echo $i: unknown device
  376. ;;
  377. esac
  378. done
  379. }
  380. R "$@"
  381. {
  382. echo -n ${RMlist[*]}
  383. echo -n ${mklist[*]}
  384. echo -n ${MKlist[*]}
  385. echo -n ${whlist[*]}
  386. echo ${oplist[*]}
  387. } | if [ "$eo" = "echo" ]; then
  388. cat
  389. else
  390. sh
  391. fi