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.

478 lines
8.8 KiB

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