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.

500 lines
9.3 KiB

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