/[baselayout]/trunk/sbin/MAKEDEV
Gentoo

Contents of /trunk/sbin/MAKEDEV

Parent Directory Parent Directory | Revision Log Revision Log


Revision 334 - (show annotations) (download)
Sun Mar 9 09:06:23 2003 UTC (15 years, 7 months ago) by azarah
File size: 44178 byte(s)
some updates and fixes

1 #! /bin/sh -
2
3 RCSID='$Id$'
4
5 #---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
6 # Customisation:
7 # The devices fall into various classes. This section contains the mapping
8 # from a class name into a group name and permission.
9 # You will almost certainly need to edit the group name to match your
10 # system, and you may change the permissions to suit your preference. These
11 # lines _must_ be of the format "user group perm".
12
13 public=" root root 0666"
14 private=" root root 0600"
15 system=" root root 0660"
16 kmem=" root kmem 0640"
17 tty=" root tty 0666"
18 cons=" root tty 0600"
19 vcs=" root root 0600"
20 dialout=" root dialout 0660"
21 dip=" root dip 0660"
22 mouse=" root root 0660"
23 printer=" root lp 0660"
24 floppy=" root floppy 0660"
25 disk=" root disk 0660"
26 scsi=" root root 0600"
27 cdrom=" root cdrom 0660"
28 tape=" root tape 0660"
29 audio=" root audio 0660"
30 video=" root video 0660"
31 fb=" root video 0620"
32 ibcs2=" root root 0666"
33 scanner=" root root 0666"
34 coda=" root root 0600"
35 ipsec=" root root 0200"
36 readable=" root root 0444"
37
38 MAXVT=63
39
40 # defaults for $major_*
41 major_ide0=3
42 major_ide1=22
43 major_sd=8
44 major_lp=6
45
46 # Remark: OSS/Linux becomes major_OSSLinux
47
48 #---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
49
50 # don't stomp on devfs users
51 if [ -c .devfsd ]
52 then
53 echo ".devfsd presence implies active DevFS. Aborting MAKEDEV invocation."
54 # use exit 0, not 1, so postinst scripts don't fail on this
55 exit 0
56 fi
57
58 #---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
59
60 procfs=/proc
61
62 opt_v=
63 opt_d=
64 opt_n=
65
66 while [ $# -ge 1 ]
67 do
68 case $1 in
69 --) shift; break ;;
70 -v) shift; opt_v=1 ;;
71 -d) shift; opt_d=1 ;;
72 -n) shift; opt_n=1; opt_v=1 ;;
73 -V) shift; opt_V=1 ;;
74 -*) echo "$0: unknown flag \"$1\"" >&2; exit 1 ;;
75 *) break ;;
76 esac
77 done
78
79 if [ "$opt_V" ]
80 then
81 echo "$RCSID"
82 exit 0
83 fi
84
85 opts="${opt_n:+-n} ${opt_v:+-v} ${opt_d:+-d}"
86
87 #---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
88
89 makedev () { # usage: makedev name [bcu] major minor owner group mode
90 if [ "$opt_v" ]
91 then if [ "$opt_d" ]
92 then echo "delete $1"
93 else echo "create $1 $2 $3 $4 $5:$6 $7"
94 fi
95 fi
96 if [ ! "$opt_n" ]
97 then if [ "$opt_d" ]
98 then
99 rm -f $1
100 else
101 rm -f $1-
102 mknod $1- $2 $3 $4 &&
103 chown $5:$6 $1- &&
104 chmod $7 $1- &&
105 mv $1- $1
106 fi
107 fi
108 }
109 symlink () { # usage: symlink name target
110 if [ "$opt_v" ]
111 then if [ "$opt_d" ]
112 then echo "delete $1"
113 else echo "create $1 -> $2"
114 fi
115 fi
116 [ ! "$opt_n" ] && rm -f $1 &&
117 [ ! "$opt_d" ] && ln -s $2 $1
118 }
119
120 #---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
121
122 # Debian allows us to assume /bin/sh is a POSIX compliant shell, so go for it!
123
124 math () {
125 eval echo "\$(($*))"
126 }
127 index () { # index string c
128 eval "I=\${1%$2*}"
129 eval echo "\${#I}"
130 }
131 suffix () {
132 eval echo "\${1#$2}"
133 }
134 strip () {
135 eval echo "\${1% $2 *} \${1#* $2 }"
136 }
137 first () {
138 eval echo "\${1:0:1}"
139 }
140 second () {
141 eval echo "\${1:1:1}"
142 }
143 substr () {
144 echo $1 | cut -c $2
145 }
146
147 #---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
148
149 devices=
150 if [ ! -f $procfs/devices ]
151 then
152 echo "$0: warning: can't read $procfs/devices" >&2
153 else
154 exec 3<$procfs/devices
155 while read major device <&3
156 do
157 device=`echo $device | sed 's#/.*##'`
158 case "$major" in
159 Character|Block|'')
160 ;;
161 *)
162 eval "major_$device=$major"
163 devices="$devices $device"
164 ;;
165 esac
166 done
167 exec 3<&-
168 fi
169
170 Major () {
171 device=$2
172 if [ "$opt_d" ]
173 then
174 echo -1 # don't care
175 else
176 eval echo \${major_$1:-\${device:?\"unknown major number for $1\"}}
177 fi
178 }
179
180 cvt () {
181 while [ $# -ne 0 ]
182 do
183 case "$1" in
184 mem|tty|ttyp|cua|cub|cui) ;;
185 hd) (for d in a b c d e f g h ; do
186 echo -n hd$d " "
187 done) ; echo
188 ;;
189 ide0) echo hda hdb ;;
190 ide1) echo hdc hdd ;;
191 ide2) echo hde hdf ;;
192 ide3) echo hdg hdh ;;
193 ide4) echo hdi hdj ;;
194 ide5) echo hdk hdl ;;
195 sd) echo sda sdb sdc sdd ;;
196 dasd) (for d in a b c d e f g h i j k l m \
197 n o p q r s t u v w x y z ; do
198 echo -n dasd$d " "
199 done) ; echo
200 ;;
201 raw) echo raw ;;
202 sg) echo sg ;;
203 sr) echo scd ;;
204 st) echo st0 ;;
205 xd) echo xda xdb ;;
206 ad) echo ada adb ;;
207 fd) echo fd0 fd1 ;;
208 lp) echo lp ;;
209 mt) echo ftape ;;
210 qft) echo ftape ;;
211 loop) echo loop ;;
212 md) echo md ;;
213 ibcs2) echo ibcs2 ;;
214 tpqic02) echo qic ;;
215 sound) echo audio ;;
216 logiscan) echo logiscan ;;
217 ac4096) echo ac4096 ;;
218 hw) echo helloworld ;;
219 sbpcd | sbpcd[123]) echo $1 ;;
220 joystick) echo js ;;
221 input) echo input ;;
222 apm_bios) echo apm ;;
223 dcf) echo dcf ;;
224 aztcd) echo aztcd ;;
225 cm206cd) echo cm206cd ;;
226 gscd) echo gscd ;;
227 pcmcia) ;; # taken care of by its own driver
228 ttyC) echo cyclades ;;
229 isdn) echo isdnmodem isdnbri dcbri ;;
230 vcs) ;;
231 pty) echo pty ;;
232 misc) echo misc ;;
233 3dfx) echo 3dfx ;;
234 agpgart) echo agpgart ;;
235 microcode) echo microcode ;;
236 ipmi|ipmikcs) echo ipmi ;;
237 fb) echo fb ;;
238 nb) echo nb0 nb1 ;;
239 netlink) echo netlink ;;
240 tap) echo netlink ;;
241 hamradio) echo hamradio ;;
242 snd) ;;
243 ptm) ;;
244 pts) ;;
245 ttyS) echo ttyS0 ttyS1 ttyS2 ttyS3 ;;
246 ttyI) echo ttyI0 ttyI1 ttyI2 ttyI3 ;;
247 ircomm|irlpt) irda ;;
248 ppp) echo ppp ;;
249 usb) echo usb ;;
250 lvm) ;; # taken care of by LVM userspace tools
251 ramdisk) echo ram ;;
252 *) echo "$0: don't know what \"$1\" is" >&2 ;;
253 esac
254 shift
255 done
256 }
257
258 for arg
259 do
260 # case `cvt $arg` in
261 case $arg in
262 generic)
263 if [ -n "`which dpkg 2> /dev/null`" ]
264 then
265 # pick the right generic-<arch> using dpkg's knowledge
266 case `dpkg --print-installation-architecture` in
267 alpha)
268 $0 $opts generic-alpha
269 ;;
270 arm)
271 $0 $opts generic-arm
272 ;;
273 hppa)
274 $0 $opts generic-hppa
275 ;;
276 i386)
277 $0 $opts generic-i386
278 ;;
279 ia64)
280 $0 $opts generic-ia64
281 ;;
282 m68k)
283 $0 $opts generic-m68k
284 ;;
285 mips)
286 $0 $opts generic-mips
287 ;;
288 mipsel)
289 $0 $opts generic-mipsel
290 ;;
291 powerpc)
292 $0 $opts generic-powerpc
293 ;;
294 s390)
295 $0 $opts generic-s390
296 ;;
297 sparc)
298 $0 $opts generic-sparc
299 ;;
300 *)
301 echo "$0: no support for generic on this arch" >&2
302 exit 1
303 ;;
304 esac
305 else
306 $0 $opts std
307 $0 $opts fd
308 $0 $opts fd0 fd1
309 $0 $opts hda hdb
310 $0 $opts xda xdb
311 $0 $opts sda sdb
312 $0 $opts pty
313 $0 $opts console
314 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
315 $0 $opts busmice
316 $0 $opts lp
317 $0 $opts par
318 fi
319 ;;
320 generic-alpha)
321 export MDARCH="alpha"
322 $0 $opts std
323 $0 $opts fd
324 $0 $opts fd0 fd1
325 $0 $opts hda hdb hdc hdd
326 $0 $opts xda xdb
327 $0 $opts sda sdb sdc sdd
328 $0 $opts scd0 scd1
329 $0 $opts st0 st1
330 $0 $opts sg
331 $0 $opts pty
332 $0 $opts console
333 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
334 $0 $opts busmice
335 $0 $opts lp
336 $0 $opts par
337 $0 $opts audio
338 $0 $opts fb
339 ;;
340 generic-arm)
341 export MDARCH="arm"
342 $0 $opts std
343 $0 $opts fd
344 $0 $opts fd0 fd1
345 $0 $opts hda hdb hdc hdd
346 $0 $opts xda xdb
347 $0 $opts sda sdb sdc sdd
348 $0 $opts scd0 scd1
349 $0 $opts st0 st1
350 $0 $opts sg
351 $0 $opts pty
352 $0 $opts console
353 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
354 $0 $opts busmice
355 $0 $opts lp
356 $0 $opts par
357 $0 $opts audio
358 $0 $opts fb
359 ;;
360 generic-hppa)
361 export MDARCH="hppa"
362 $0 $opts std
363 $0 $opts fd
364 $0 $opts fd0 fd1
365 $0 $opts sda sdb sdc sdd
366 $0 $opts scd0 scd1
367 $0 $opts st0 st1
368 $0 $opts sg
369 $0 $opts pty
370 $0 $opts console
371 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
372 $0 $opts busmice
373 $0 $opts lp
374 $0 $opts par
375 $0 $opts audio
376 $0 $opts fb
377 $0 $opts rtc
378 ;;
379 generic-i386)
380 export MDARCH="i386"
381 $0 $opts std
382 $0 $opts fd
383 $0 $opts fd0 fd1
384 $0 $opts hda hdb hdc hdd
385 $0 $opts xda xdb
386 $0 $opts sda sdb sdc sdd
387 $0 $opts scd0 scd1
388 $0 $opts st0 st1
389 $0 $opts sg
390 $0 $opts pty
391 $0 $opts console
392 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
393 $0 $opts busmice
394 $0 $opts lp
395 $0 $opts par
396 $0 $opts audio
397 $0 $opts fb
398 $0 $opts isdn-io eda edb sonycd mcd mcdx cdu535
399 $0 $opts optcd sjcd cm206cd gscd
400 $0 $opts lmscd sbpcd aztcd bpcd dac960 ida ataraid cciss
401 ;;
402 generic-ia64)
403 export MDARCH="ia64"
404 $0 $opts std
405 $0 $opts fd
406 $0 $opts fd0 fd1
407 $0 $opts hda hdb hdc hdd
408 $0 $opts xda xdb
409 $0 $opts sda sdb sdc sdd
410 $0 $opts scd0 scd1
411 $0 $opts st0 st1
412 $0 $opts sg
413 $0 $opts pty
414 $0 $opts console
415 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4 ttyS5
416 $0 $opts busmice
417 $0 $opts lp
418 $0 $opts par
419 $0 $opts audio
420 $0 $opts fb
421 $0 $opts efirtc
422 ;;
423 generic-m68k)
424 export MDARCH="m68k"
425 $0 $opts std
426 $0 $opts fd
427 $0 $opts fd0 fd1
428 $0 $opts hda hdb hdc hdd
429 $0 $opts sda sdb sdc sdd
430 $0 $opts sg
431 $0 $opts ada adb adc add ade adf
432 $0 $opts pty
433 $0 $opts console
434 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS5
435 $0 $opts m68k-mice
436 $0 $opts lp
437 $0 $opts par
438 $0 $opts nvram
439 $0 $opts audio
440 $0 $opts fb
441 ;;
442 generic-mips)
443 export MDARCH="mips"
444 $0 $opts std
445 $0 $opts fd
446 $0 $opts fd0 fd1
447 $0 $opts hda hdb
448 $0 $opts sda sdb sdc sdd
449 $0 $opts scd0 scd1
450 $0 $opts st0 st1
451 $0 $opts sg
452 $0 $opts pty
453 $0 $opts console
454 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
455 $0 $opts lp
456 $0 $opts par
457 $0 $opts audio
458 $0 $opts fb
459 $0 $opts busmice
460 ;;
461 generic-mipsel)
462 export MDARCH="mipsel"
463 $0 $opts std
464 $0 $opts fd
465 $0 $opts fd0 fd1
466 $0 $opts hda hdb
467 $0 $opts sda sdb sdc sdd
468 $0 $opts scd0 scd1
469 $0 $opts st0 st1
470 $0 $opts sg
471 $0 $opts pty
472 $0 $opts console
473 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
474 $0 $opts lp
475 $0 $opts par
476 $0 $opts audio
477 $0 $opts fb
478 $0 $opts rtc
479 ;;
480 generic-powerpc)
481 export MDARCH="powerpc"
482 $0 $opts std
483 $0 $opts fd
484 $0 $opts fd0 fd1
485 $0 $opts hda hdb hdc hdd
486 $0 $opts sda sdb sdc sdd
487 $0 $opts scd0 scd1
488 $0 $opts st0 st1
489 $0 $opts sg
490 $0 $opts pty
491 $0 $opts console
492 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
493 $0 $opts busmice
494 $0 $opts m68k-mice
495 $0 $opts input
496 $0 $opts lp
497 $0 $opts par
498 $0 $opts nvram
499 $0 $opts audio
500 $0 $opts adb
501 $0 $opts fb
502 $0 $opts rtc
503 $0 $opts isdn-io
504 ;;
505 generic-s390)
506 export MDARCH="s390"
507 $0 $opts std
508 $0 $opts fd
509 $0 $opts dasda dasdb dasdc dasdd dasde dasdf dasdg dasdh \
510 dasdi dasdj dasdk dasdl dasdm dasdn dasdo dasdp \
511 dasdq dasdr dasds dasdt dasdu dasdv dasdw dasdx \
512 dasdy dasdz
513 $0 $opts pty
514 $0 $opts consoleonly
515 $0 $opts rtc
516 ;;
517 generic-sparc)
518 export MDARCH="sparc"
519 $0 $opts std
520 $0 $opts fd0-bare fd1-bare
521 $0 $opts hda hdb hdc hdd
522 $0 $opts sda sdb sdc sdd
523 $0 $opts scd0 scd1
524 $0 $opts st0 st1
525 $0 $opts sg
526 $0 $opts pty
527 $0 $opts console
528 $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
529 $0 $opts busmice
530 $0 $opts fb
531 $0 $opts rtc
532 makedev kbd c 11 0 $cons
533 makedev sunmouse c 10 6 $mouse
534 symlink mouse sunmouse
535 makedev openprom c 10 139 $mouse
536 ;;
537 local)
538 $0.local $opts
539 ;;
540 std)
541 makedev mem c 1 1 $kmem
542 makedev kmem c 1 2 $kmem
543 makedev null c 1 3 $public
544 makedev port c 1 4 $kmem
545 makedev zero c 1 5 $public
546 symlink core $procfs/kcore
547 makedev full c 1 7 $public
548 makedev random c 1 8 $public
549 makedev urandom c 1 9 $readable
550 makedev tty c 5 0 $tty
551 $0 $opts ram
552 $0 $opts loop
553 ;;
554 hamradio)
555 $0 $opts scc
556 $0 $opts bc
557 ;;
558 scc)
559 for unit in 0 1 2 3 4 5 6 7
560 do
561 makedev scc$unit c 34 $unit $system
562 done
563 ;;
564 bc)
565 for unit in 0 1 2 3
566 do
567 makedev bc$unit c 51 $unit $system
568 done
569 ;;
570 random)
571 makedev random c 1 8 $public
572 ;;
573 urandom)
574 makedev urandom c 1 9 $readable
575 ;;
576 ram)
577 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
578 makedev ram$i b 1 $i $disk
579 done
580 symlink ram ram1
581 ;;
582 ram[0-9]|ram1[0-6])
583 unit=`suffix $arg ram`
584 makedev ram$unit b 1 $unit $disk
585 ;;
586 initrd)
587 makedev initrd b 1 250 $disk
588 ;;
589 raw)
590 makedev raw c 162 0 $disk
591 symlink rawctl raw
592 for i in 1 2 3 4 5 6 7 8; do
593 makedev raw$i c 162 $i $disk
594 done
595 ;;
596 consoleonly)
597 makedev tty0 c 4 0 $cons
598 # new kernels need a device, old ones a symlink... sigh
599 kern_rev1=`uname -r | awk -F'.' '{print $1}'`
600 kern_rev2=`uname -r | awk -F'.' '{print $2}'`
601 if [ $kern_rev1 -gt 2 ]
602 then
603 makedev console c 5 1 $cons
604 else
605 if [ $kern_rev1 -eq 2 -a $kern_rev2 -ge 1 ]
606 then
607 makedev console c 5 1 $cons
608 else
609 symlink console tty0
610 fi
611 fi
612 ;;
613 console)
614 $0 $opts consoleonly
615 major=`Major vcs 7` # not fatal
616 [ "$major" ] && makedev vcs0 c $major 0 $vcs
617 symlink vcs vcs0
618 [ "$major" ] && makedev vcsa0 c $major 128 $vcs
619 symlink vcsa vcsa0
620 # individual vts
621 line=1
622 while [ $line -le $MAXVT -a $line -le 63 ]
623 do
624 makedev tty$line c 4 $line $tty
625 [ "$major" ] && makedev vcs$line c $major $line $vcs
626 [ "$major" ] && makedev vcsa$line c $major `math $line + 128` $vcs
627 line=`math $line + 1`
628 done
629 ;;
630 adb)
631 myarch=
632
633 if [ -n "`which dpkg 2> /dev/null`" ]
634 then
635 # pick the right arch device using dpkg's knowledge
636 myarch="`dpkg --print-installation-architecture`"
637
638 elif [ -n "${MDARCH}" ]
639 then
640 myarch="${MDARCH}"
641 fi
642
643 case $myarch in
644 powerpc)
645 # ADB bus devices (char)
646 makedev adb c 56 0 $mouse
647 makedev adbmouse c 10 10 $mouse
648 ;;
649 m68k)
650 # ACSI disk 2, whole device (block)
651 makedev adb b 28 16 $disk
652 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
653 do
654 minor=$(( 16 + $part ))
655 makedev adb$part b 28 $minor $disk
656 done
657 ;;
658 *)
659 echo "no support for adb on this arch" >&2
660 exit 1
661 ;;
662 esac
663 ;;
664 raw1394)
665 makedev raw1394 c 171 0 $disk
666 ;;
667 nvram)
668 makedev nvram c 10 144 $mouse
669 ;;
670 tty[1-9]|tty[1-5][0-9]|tty[6][0-3])
671 line=`suffix $arg tty`
672 makedev tty$line c 4 $line $tty
673 ;;
674 ttyS[0-9]|ttyS[1-5][0-9]|ttyS[6][0-3])
675 line=`suffix $arg ttyS`
676 minor=`math 64 + $line`
677 makedev ttyS$line c 4 $minor $dialout
678 ;;
679 pty[a-ep-z])
680 bank=`suffix $arg pty`
681 base=`index pqrstuvwxyzabcde $bank`
682 base=`math $base \* 16`
683 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f
684 do
685 j=`index 0123456789abcdef $i`
686 makedev pty$bank$i c 2 `math $base + $j` $tty
687 makedev tty$bank$i c 3 `math $base + $j` $tty
688 done
689 ;;
690 pty)
691 ptysufs=""
692 for i in p q r s t u v w x y z a b c d e
693 do
694 ptysufs="$ptysufs pty$i"
695 done
696 $0 $opts $ptysufs ptmx
697 ;;
698 ptmx)
699 # master pty multiplexer for 2.1 kernels
700 makedev ptmx c 5 2 $tty
701 ;;
702 cyclades|ttyC)
703 major1=`Major ttyC 19` || continue
704 #major2=`Major cub 20` || continue
705 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 \
706 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
707 do
708 makedev ttyC$i c $major1 $i $dialout
709 #makedev cub$i c $major2 $i $dialout
710 done
711 ;;
712 stallion|ttyE)
713 major1=`Major ttyE 24` || continue
714 #major2=`Major cue 25` || continue
715 majorc=28
716 minor=0
717 until [ $minor -gt 256 ]
718 do
719 makedev ttyE$minor c $major1 $minor $dialout
720 #makedev cue$minor c $major2 $minor $dialout
721 minor=`math $minor + 1`
722 done
723 for i in 0 1 2 3
724 do
725 makedev staliomem$i c $majorc $i $private
726 done
727 ;;
728 chase|ttyH)
729 major1=`Major ttyH 17` || continue
730 #major2=`Major cuh 18` || continue
731 minor=0
732 until [ $minor -gt 16 ] # tell me if 16 is wrong
733 do
734 makedev ttyH$minor c $major1 $minor $dialout
735 #makedev cuh$minor c $major2 $minor $dialout
736 minor=`math $minor + 1`
737 done
738 ;;
739 rocketport|ttyR)
740 major1=`Major ttyR 46` || continue
741 #major2=`Major cur 47` || continue
742 minor=0
743 until [ $minor -gt 64 ] # tell me if 64 is wrong
744 do
745 makedev ttyR$minor c $major1 $minor $dialout
746 #makedev cur$minor c $major2 $minor $dialout
747 minor=`math $minor + 1`
748 done
749 ;;
750 ttyV)
751 major1=`Major ttyV 105` || continue
752 #major2=`Major cuv 106` || continue
753 minor=0
754 until [ $minor -gt 16 ] # tell me if 16 is wrong
755 do
756 makedev ttyV$minor c $major1 $minor $dialout
757 #makedev cuv$minor c $major2 $minor $dialout
758 minor=`math $minor + 1`
759 done
760 ;;
761 digi|ttyD)
762 major1=`Major ttyD 22` || continue
763 #major2=`Major cud 23` || continue
764 minor=0
765 until [ $minor -gt 16 ] # tell me if 16 is wrong
766 do
767 makedev ttyD$minor c $major1 $minor $dialout
768 #makedev cud$minor c $major2 $minor $dialout
769 minor=`math $minor + 1`
770 done
771 ;;
772 specialix|ttyX)
773 major1=`Major ttyX 32` || continue
774 #major2=`Major cux 33` || continue
775 minor=0
776 until [ $minor -gt 16 ] # tell me if 16 is wrong
777 do
778 makedev ttyX$minor c $major1 $minor $dialout
779 #makedev cux$minor c $major2 $minor $dialout
780 minor=`math $minor + 1`
781 done
782 ;;
783 specialixIO8|ttyW)
784 major1=`Major ttyW 75` || continue
785 #major2=`Major cuw 76` || continue
786 minor=0
787 until [ $minor -gt 16 ] # tell me if 16 is wrong
788 do
789 makedev ttyW$minor c $major1 $minor $dialout
790 #makedev cuw$minor c $major2 $minor $dialout
791 minor=`math $minor + 1`
792 done
793 ;;
794 PAM|ttyM)
795 major1=`Major ttyM 79` || continue
796 #major2=`Major cum 80` || continue
797 minor=0
798 until [ $minor -gt 16 ] # tell me if 16 is wrong
799 do
800 makedev ttyM$minor c $major1 $minor $dialout
801 #makedev cum$minor c $major2 $minor $dialout
802 minor=`math $minor + 1`
803 done
804 ;;
805 riscom|ttyL)
806 major=`Major ttyL 48` || continue
807 minor=0
808 until [ $minor -gt 16 ] # tell me if 16 is wrong
809 do
810 makedev ttyL$minor c $major $minor $dialout
811 minor=`math $minor + 1`
812 done
813 ;;
814 computone|ttyF)
815 major=`Major ttyF 71` || continue
816 #major2=`Major cuf 72` || continue
817 minor=0
818 until [ $minor -gt 255 ]
819 do
820 makedev ttyF$minor c $major $minor $dialout
821 #makedev cuf$minor c $major2 $minor $dialout
822 minor=`math $minor + 1`
823 done
824 major=73
825 for i in 0 4 8 12
826 do
827 makedev ip2ipl$i c $major $i $private
828 makedev ip2stat$i c $major `math $i + 1` $private
829 done
830 ;;
831 ESP|ttyP)
832 major=`Major ttyP 57` || continue
833 #major2=`Major cup 58` || continue
834 minor=0
835 until [ $minor -gt 4 ] # tell me if 4 is wrong
836 do
837 makedev ttyP$minor c $major $minor $dialout
838 #makedev cup$minor c $major2 $minor $dialout
839 minor=`math $minor + 1`
840 done
841 ;;
842 COMX|comx)
843 major=`Major comx 88` || continue
844 minor=0
845 until [ $minor -gt 4 ] # tell me if 4 is wrong
846 do
847 makedev comx$minor c $major $minor $private
848 minor=`math $minor + 1`
849 done
850 ;;
851 isdnmodem|ttyI)
852 major1=`Major ttyI 43` || continue
853 #major2=`Major cui 44` || continue
854 minor=0
855 until [ $minor -gt 63 ]
856 do
857 makedev ttyI$minor c $major1 $minor $dialout
858 #makedev cui$minor c $major2 $minor $dialout
859 minor=`math $minor + 1`
860 done
861 ;;
862 isdnbri)
863 major=45
864 minor=0
865 until [ $minor -gt 63 ]
866 do
867 makedev isdn$minor c $major $minor $dialout
868 makedev isdnctrl$minor c $major `math $minor + 64` $dialout
869 makedev ippp$minor c $major `math $minor + 128` $dialout
870 minor=`math $minor + 1`
871 done
872 makedev isdninfo c $major 255 $private
873 ;;
874 dcbri)
875 major=52
876 for i in 0 1 2 3
877 do
878 makedev dcbri$i c $major $i $dialout
879 done
880 ;;
881 capi)
882 major=68
883 makedev capi20 c $major 0 $dialout
884 for i in 0 1 2 3 4 5 6 7 8 9
885 do
886 makedev capi20.0$i c $major `math $i + 1` $dialout
887 done
888 for i in 10 11 12 13 14 15 16 17 18 19
889 do
890 makedev capi20.$i c $major `math $i + 1` $dialout
891 done
892 ;;
893 ubd)
894 major=98
895 minor=0
896 until [ $minor -gt 255 ]
897 do
898 makedev ubd$minor b $major $minor $disk
899 minor=`math $minor + 1`
900 done
901 ;;
902 fb)
903 for i in 0 1 2 3 4 5 6 7
904 do
905 makedev fb$i c 29 `math 32 \* $i` $fb
906 makedev fb${i}current c 29 `math 32 \* $i` $fb
907 makedev fb${i}autodetect c 29 `math 32 \* $i + 1` $fb
908 done
909 ;;
910 fb[0-7])
911 dev=`suffix $arg fb`
912 base=`math 32 \* $dev`
913 makedev fb$dev c 29 $base $fb
914 makedev fb${dev}current c 29 $base $fb
915 makedev fb${dev}autodetect c 29 `math $base + 1` $fb
916 for i in 0 1 2 3 4 5 6 7
917 do
918 makedev fb${dev}user$i c 29 `math $base + 24 + $i` $fb
919 done
920 ;;
921 netlink|tap|tap[0-9]|tap1[0-5])
922 makedev route c 36 0 $coda
923 makedev skip c 36 1 $coda
924 makedev fwmonitor c 36 3 $coda
925 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
926 do
927 makedev tap$i c 36 `math $i + 16` $coda
928 done
929 ;;
930 lp)
931 major=`Major lp 6` || continue
932 makedev ${arg}0 c $major 0 $printer
933 makedev ${arg}1 c $major 1 $printer
934 makedev ${arg}2 c $major 2 $printer
935 ;;
936 par)
937 major=`Major lp 6` || continue
938 makedev ${arg}0 c $major 0 $printer
939 makedev ${arg}1 c $major 1 $printer
940 makedev ${arg}2 c $major 2 $printer
941 ;;
942 parport)
943 major=`Major parport 99` || continue
944 makedev ${arg}0 c $major 0 $printer
945 makedev ${arg}1 c $major 1 $printer
946 makedev ${arg}2 c $major 2 $printer
947 ;;
948 slm)
949 major=`Major slm 28` || continue
950 for i in 0 1 2 3
951 do
952 makedev slm c $major $i $printer
953 done
954 ;;
955 input)
956 major=`Major pcsp 13` || continue
957 mkdir -p input
958 for i in 0 1 2 3
959 do
960 makedev input/js$i c $major $i $mouse
961 makedev input/mouse$i c $major `math $i + 32` $mouse
962 makedev input/event$i c $major `math $i + 64` $mouse
963 done
964 makedev input/mice c $major 63 $mouse
965 ;;
966 busmice)
967 major=`Major mouse 10` || continue
968 makedev logibm c $major 0 $mouse
969 makedev psaux c $major 1 $mouse
970 makedev inportbm c $major 2 $mouse
971 makedev atibm c $major 3 $mouse
972 makedev jbm c $major 4 $mouse
973 ;;
974 m68k-mice)
975 major=`Major mouse 10` || continue
976 makedev amigamouse c $major 4 $mouse
977 makedev atarimouse c $major 5 $mouse
978 makedev amigamouse1 c $major 7 $mouse
979 makedev adbmouse c $major 10 $mouse
980 ;;
981 3dfx)
982 major=`Major $arg 107` || continue
983 makedev $arg c $major 0 $video
984 ;;
985 agpgart)
986 major=`Major $arg 10` || continue
987 makedev $arg c $major 175 $video
988 ;;
989 intel_rng)
990 major=`Major $arg 10` || continue
991 makedev $arg c $major 183 $private
992 ;;
993 cpu|microcode)
994 mkdir -p cpu
995 makedev cpu/microcode c 10 184 $private
996 for i in 0 1 2 3
997 do
998 mkdir -p cpu/$i
999 makedev cpu/$i/msr c 202 $i $private
1000 makedev cpu/$i/cpuid c 203 $i $private
1001 done
1002 ;;
1003 ipmi|ipmikcs)
1004 major=`Major ipmikcs 10` || continue
1005 makedev ipmikcs c $major 173 $private
1006 ;;
1007 irda)
1008 for i in 0 1
1009 do
1010 makedev ircomm$i c 161 $i $dialout
1011 makedev irlpt$i c 161 `math $i + 16` $printer
1012 done
1013 ;;
1014 misc)
1015 major=`Major mouse 10` || continue
1016 makedev logibm c $major 0 $mouse
1017 makedev psaux c $major 1 $mouse
1018 makedev inportbm c $major 2 $mouse
1019 makedev atibm c $major 3 $mouse
1020 makedev jbm c $major 4 $mouse
1021 makedev amigamouse c $major 4 $mouse
1022 makedev atarimouse c $major 5 $mouse
1023 makedev sunmouse c $major 6 $mouse
1024 makedev amigamouse1 c $major 7 $mouse
1025 makedev smouse c $major 8 $mouse
1026 makedev pc110pad c $major 9 $mouse
1027 makedev adbmouse c $major 10 $mouse
1028 makedev beep c $major 128 $mouse
1029 makedev modreq c $major 129 $mouse
1030 makedev watchdog c $major 130 $mouse
1031 makedev temperature c $major 131 $mouse
1032 makedev hwtrap c $major 132 $mouse
1033 makedev exttrp c $major 133 $mouse
1034 makedev apm_bios c $major 134 $mouse
1035 makedev rtc c $major 135 $mouse
1036 makedev openprom c $major 139 $mouse
1037 makedev relay8 c $major 140 $mouse
1038 makedev relay16 c $major 141 $mouse
1039 makedev msr c $major 142 $mouse
1040 makedev pciconf c $major 143 $mouse
1041 makedev nvram c $major 144 $mouse
1042 makedev hfmodem c $major 145 $mouse
1043 makedev led c $major 151 $mouse
1044 makedev mergemem c $major 153 $mouse
1045 makedev pmu c $major 154 $mouse
1046 ;;
1047 smapi|thinkpad)
1048 major=`Major mouse 10` || continue
1049 makedev smapi c $major 170 $mouse
1050 symlink thinkpad smapi
1051 ;;
1052 rtc)
1053 major=`Major mouse 10` || continue
1054 makedev rtc c $major 135 $mouse
1055 ;;
1056 efirtc)
1057 major=`Major mouse 10` || continue
1058 makedev efirtc c $major 136 $mouse
1059 ;;
1060 js)
1061 major=`Major Joystick 13` || continue
1062 for unit in 0 1 2 3
1063 do
1064 makedev js$unit c $major $unit $readable
1065 makedev djs$unit c $major `math $unit + 128` $readable
1066 done
1067 ;;
1068 fd[0-7]-bare)
1069 sarg="${arg%-bare}"
1070 major=`Major fd 2` || continue
1071 base=`suffix $sarg fd`
1072 if [ $base -ge 4 ]
1073 then
1074 base=`math $base + 124`
1075 fi
1076 makedev ${sarg} b $major $base $floppy
1077 ;;
1078 fd[0-7])
1079 major=`Major fd 2` || continue
1080 base=`suffix $arg fd`
1081 if [ $base -ge 4 ]
1082 then
1083 base=`math $base + 124`
1084 fi
1085 makedev ${arg} b $major $base $floppy
1086 makedev ${arg}d360 b $major `math $base + 4` $floppy
1087 makedev ${arg}h1200 b $major `math $base + 8` $floppy
1088 makedev ${arg}u360 b $major `math $base + 12` $floppy
1089 makedev ${arg}u720 b $major `math $base + 16` $floppy
1090 makedev ${arg}h360 b $major `math $base + 20` $floppy
1091 makedev ${arg}h720 b $major `math $base + 24` $floppy
1092 makedev ${arg}u1440 b $major `math $base + 28` $floppy
1093 makedev ${arg}u2880 b $major `math $base + 32` $floppy
1094 makedev ${arg}CompaQ b $major `math $base + 36` $floppy
1095
1096 makedev ${arg}h1440 b $major `math $base + 40` $floppy
1097 makedev ${arg}u1680 b $major `math $base + 44` $floppy
1098 makedev ${arg}h410 b $major `math $base + 48` $floppy
1099 makedev ${arg}u820 b $major `math $base + 52` $floppy
1100 makedev ${arg}h1476 b $major `math $base + 56` $floppy
1101 makedev ${arg}u1722 b $major `math $base + 60` $floppy
1102 makedev ${arg}h420 b $major `math $base + 64` $floppy
1103 makedev ${arg}u830 b $major `math $base + 68` $floppy
1104 makedev ${arg}h1494 b $major `math $base + 72` $floppy
1105 makedev ${arg}u1743 b $major `math $base + 76` $floppy
1106 makedev ${arg}h880 b $major `math $base + 80` $floppy
1107 makedev ${arg}u1040 b $major `math $base + 84` $floppy
1108 makedev ${arg}u1120 b $major `math $base + 88` $floppy
1109 makedev ${arg}h1600 b $major `math $base + 92` $floppy
1110 makedev ${arg}u1760 b $major `math $base + 96` $floppy
1111 makedev ${arg}u1920 b $major `math $base + 100` $floppy
1112 makedev ${arg}u3200 b $major `math $base + 104` $floppy
1113 makedev ${arg}u3520 b $major `math $base + 108` $floppy
1114 makedev ${arg}u3840 b $major `math $base + 112` $floppy
1115 makedev ${arg}u1840 b $major `math $base + 116` $floppy
1116 makedev ${arg}u800 b $major `math $base + 120` $floppy
1117 makedev ${arg}u1600 b $major `math $base + 124` $floppy
1118 ;;
1119 ed[a-b])
1120 major=`Major ed 36` || continue
1121 unit=`suffix $arg ed`
1122 base=`index ab $unit`
1123 base=`math $base \* 64`
1124 makedev ed$unit b $major $base $disk
1125 for part in 1 2 3 4 5 6 7 8 # 9 10 11 12 13 14 15 16 17 18 19 20
1126 do
1127 makedev ed$unit$part b $major `math $base + $part` $disk
1128 done
1129 ;;
1130 hd[a-b])
1131 major=`Major ide0` || major=`Major hd 3` || continue
1132 unit=`suffix $arg hd`
1133 base=`index ab $unit`
1134 base=`math $base \* 64`
1135 makedev hd$unit b $major $base $disk
1136 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1137 do
1138 makedev hd$unit$part b $major `math $base + $part` $disk
1139 done
1140 ;;
1141 hd[c-d])
1142 major=`Major ide1 22` || continue
1143 unit=`suffix $arg hd`
1144 base=`index cd $unit`
1145 base=`math $base \* 64`
1146 makedev hd$unit b $major $base $disk
1147 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1148 do
1149 makedev hd$unit$part b $major $(( $base + $part )) $disk
1150 done
1151 ;;
1152 hd[e-f])
1153 major=`Major ide2 33` || continue
1154 unit=`suffix $arg hd`
1155 base=`index ef $unit`
1156 base=`math $base \* 64`
1157 makedev hd$unit b $major $base $disk
1158 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1159 do
1160 makedev hd$unit$part b $major $(( $base + $part )) $disk
1161 done
1162 ;;
1163 hd[g-h])
1164 major=`Major ide3 34` || continue
1165 unit=`suffix $arg hd`
1166 base=`index gh $unit`
1167 base=`math $base \* 64`
1168 makedev hd$unit b $major $base $disk
1169 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1170 do
1171 makedev hd$unit$part b $major $(( $base + $part )) $disk
1172 done
1173 ;;
1174 hd[i-j])
1175 major=`Major ide4 56` || continue
1176 unit=`suffix $arg hd`
1177 base=`index ij $unit`
1178 base=`math $base \* 64`
1179 makedev hd$unit b $major $base $disk
1180 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1181 do
1182 makedev hd$unit$part b $major $(( $base + $part )) $disk
1183 done
1184 ;;
1185 hd[k-l])
1186 major=`Major ide5 57` || continue
1187 unit=`suffix $arg hd`
1188 base=`index kl $unit`
1189 base=`math $base \* 64`
1190 makedev hd$unit b $major $base $disk
1191 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1192 do
1193 makedev hd$unit$part b $major $(( $base + $part )) $disk
1194 done
1195 ;;
1196 ht0)
1197 major=`Major ht0 37` || continue
1198 # Only one IDE tape drive is currently supported; ht0.
1199 makedev ht0 c $major 0 $tape
1200 makedev nht0 c $major 128 $tape
1201 ;;
1202 pt)
1203 major=`Major pt 96` || continue
1204 for i in 0 1 2 3
1205 do
1206 makedev pt$i c $major $i $tape
1207 makedev npt$i c $major `math $i + 128` $tape
1208 done
1209 ;;
1210 xd[a-d])
1211 major=`Major xd 13` || continue
1212 unit=`suffix $arg xd`
1213 base=`index abcd $unit`
1214 base=`math $base \* 64`
1215 makedev xd$unit b $major $base $disk
1216 for part in 1 2 3 4 5 6 7 8 # 9 10 11 12 13 14 15 16 17 18 19 20
1217 do
1218 makedev xd$unit$part b $major $(( $base + $part )) $disk
1219 done
1220 ;;
1221 sd[a-z])
1222 major=`Major sd 8` || continue
1223 unit=`suffix $arg sd`
1224 base=`index abcdefghijklmnopqrstuvwxyz $unit`
1225 base=$(( $base * 16 ))
1226 if [ $base -lt 256 ]; then
1227 major=8
1228 else
1229 major=65
1230 base=$(( $base - 256 ))
1231 fi
1232 makedev sd$unit b $major $base $disk
1233 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1234 do
1235 minor=$(( $base + $part ))
1236 makedev sd$unit$part b $major $minor $disk
1237 done
1238 ;;
1239 sd[a-d][a-z])
1240 unit=`suffix $arg sd`
1241 unitmaj=`first $unit`
1242 unitmin=`second $unit`
1243 basemaj=`index Xabcd $unitmaj`
1244 basemin=`index abcdefghijklmnopqrstuvwxyz $unitmin`
1245 basemaj=`math $basemaj \* 416`
1246 basemin=`math $basemin \* 16`
1247 base=`math $basemaj + $basemin`
1248 basemaj=`math $base / 256`
1249 base=`math $base % 256`
1250 major=`math basemaj \+ 64`
1251 if [ $major -gt 71 ]; then
1252 echo "$0: don't know how to make device \"$arg\"" >&2
1253 exit 0
1254 fi
1255 makedev sd$unit b $major $base $disk
1256 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1257 do
1258 minor=$(( $base + $part ))
1259 makedev sd$unit$part b $major $minor $disk
1260 done
1261 ;;
1262 dasd[a-z])
1263 major=`Major dasd 94` || continue
1264 unit=`suffix $arg dasd`
1265 base=`index abcdefghijklmnopqrstuvwxyz $unit`
1266 base=$(( $base * 4 ))
1267 if [ $base -lt 256 ]; then
1268 major=94
1269 else
1270 major=65
1271 base=$(( $base - 256 ))
1272 fi
1273 makedev dasd$unit b $major $base $disk
1274 # Not yet implemented. (Feb. 8, 2001)
1275 # for part in 1 2 3
1276 for part in 1
1277 do
1278 minor=$(( $base + $part ))
1279 makedev dasd$unit$part b $major $minor $disk
1280 done
1281 ;;
1282 ad[a-p])
1283 major=`Major ad 28` || continue
1284 unit=`suffix $arg ad`
1285 base=`index abcdefghijklmnop $unit`
1286 base=`math $base \* 16`
1287 makedev ad$unit b $major $base $disk
1288 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1289 do
1290 minor=$(( $base + $part ))
1291 makedev ad$unit$part b $major $minor $disk
1292 done
1293 ;;
1294 dac960)
1295 for ctr in 0 1 2 3 4 5 6 7
1296 do
1297 $0 $opts dac960.$ctr
1298 done
1299 ;;
1300 dac960.[0-7])
1301 [ -d rd ] || {
1302 mkdir rd
1303 chown root.root rd
1304 chmod 755 rd
1305 }
1306 unit=`suffix $arg dac960.`
1307 major=`math 48 + $unit`
1308 minor=0
1309 for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \
1310 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1311 do
1312 makedev rd/c${unit}d${ld} b $major $minor $disk
1313 minor=`math $minor + 1`
1314 for part in 1 2 3 4 5 6 7
1315 do
1316 makedev rd/c${unit}d${ld}p$part b $major $minor $disk
1317 minor=`math $minor + 1`
1318 done
1319 done
1320 ;;
1321 ataraid)
1322 for ctr in 0 1 2 # 3 4 5 6 7
1323 do
1324 $0 $opts ataraid.$ctr
1325 done
1326 ;;
1327 ataraid.[0-7])
1328 [ -d ataraid ] || {
1329 mkdir ataraid
1330 chown root.root ataraid
1331 chmod 755 ataraid
1332 }
1333 unit=`suffix $arg ataraid.`
1334 major=114
1335 minor=`math $unit \* 16`
1336 makedev ataraid/d${unit} b $major $minor $disk
1337 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1338 do
1339 minor=`math $minor + 1`
1340 makedev ataraid/d${unit}p$part b $major $minor $disk
1341 done
1342 ;;
1343 ida)
1344 for ctr in 0 1 2 # 3 4 5 6 7
1345 do
1346 $0 $opts ida.$ctr
1347 done
1348 ;;
1349 ida.[0-7])
1350 [ -d ida ] || {
1351 mkdir ida
1352 chown root.root ida
1353 chmod 755 ida
1354 }
1355 unit=`suffix $arg ida.`
1356 major=`math 72 + $unit`
1357 minor=0
1358 for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1359 do
1360 makedev ida/c${unit}d${ld} b $major $minor $disk
1361 minor=`math $minor + 1`
1362 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1363 do
1364 makedev ida/c${unit}d${ld}p$part b $major $minor $disk
1365 minor=`math $minor + 1`
1366 done
1367 done
1368 ;;
1369 cciss)
1370 for ctr in 0 1 2 # 3 4 5 6 7
1371 do
1372 $0 $opts cciss.$ctr
1373 done
1374 ;;
1375 cciss.[0-7])
1376 [ -d cciss ] || {
1377 mkdir cciss
1378 chown root.root cciss
1379 chmod 755 cciss
1380 }
1381 unit=`suffix $arg cciss.`
1382 major=`math 104 + $unit`
1383 minor=0
1384 for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1385 do
1386 makedev cciss/c${unit}d${ld} b $major $minor $disk
1387 minor=`math $minor + 1`
1388 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1389 do
1390 makedev cciss/c${unit}d${ld}p$part b $major $minor $disk
1391 minor=`math $minor + 1`
1392 done
1393 done
1394 ;;
1395 rom)
1396 major=`Major rom 31`
1397 for i in 0 1 2 3 4 5 6 7
1398 do
1399 makedev rom$i b $major $i $disk
1400 makedev rrom$i b $major `math $i +8` $disk
1401 makedev flash$i b $major `math $i +16` $disk
1402 makedev rflash$i b $major `math $i +24` $disk
1403 done
1404 ;;
1405 nb[0-7])
1406 major=`Major nbd 43` || continue
1407 minor=`suffix $arg nb`
1408 makedev nb$minor b $major $minor $disk
1409 ;;
1410 loop)
1411 for part in 0 1 2 3 4 5 6 7
1412 do
1413 makedev loop$part b 7 $part $disk
1414 done
1415 ;;
1416 md)
1417 major=`Major md 9` || continue
1418 for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1419 do
1420 makedev md$part b $major $part $disk
1421 done
1422 ;;
1423 st[0-7])
1424 major=`Major st 9`
1425 unit=`suffix $arg st`
1426 makedev st${unit} c $major $unit $tape
1427 makedev nst${unit} c $major `math 128 + $unit` $tape
1428
1429 makedev st${unit}l c $major `math 32 + $unit` $tape
1430 makedev nst${unit}l c $major `math 160 + $unit` $tape
1431
1432 makedev st${unit}m c $major `math 64 + $unit` $tape
1433 makedev nst${unit}m c $major `math 192 + $unit` $tape
1434
1435 makedev st${unit}a c $major `math 96 + $unit` $tape
1436 makedev nst${unit}a c $major `math 224 + $unit` $tape
1437 ;;
1438 qic)
1439 major=`Major tpqic02 12`
1440 makedev ntpqic11 c $major 2 $tape
1441 makedev tpqic11 c $major 3 $tape
1442 makedev ntpqic24 c $major 4 $tape
1443 makedev tpqic24 c $major 5 $tape
1444 makedev ntpqic120 c $major 6 $tape
1445 makedev tpqic120 c $major 7 $tape
1446 makedev ntpqic150 c $major 8 $tape
1447 makedev tpqic150 c $major 9 $tape
1448 makedev rmt8 c $major 6 $tape
1449 makedev rmt16 c $major 8 $tape
1450 makedev tape-d c $major 136 $tape
1451 makedev tape-reset c $major 255 $tape
1452 $0 $opts qft
1453 ;;
1454 ftape)
1455 major=`Major qft 27` || continue
1456 for unit in 0 1 2 3
1457 do
1458 makedev qft$unit c $major $unit $tape
1459 makedev nqft$unit c $major `math $unit + 4` $tape
1460 makedev zqft$unit c $major `math $unit + 16` $tape
1461 makedev nzqft$unit c $major `math $unit + 20` $tape
1462 makedev rawqft$unit c $major `math $unit + 32` $tape
1463 makedev nrawqft$unit c $major `math $unit + 36` $tape
1464 done
1465 symlink ftape qft0
1466 symlink nftape nqft0
1467 ;;
1468 sr|scd|scd-all)
1469 major=`Major sr 11` || continue
1470 for unit in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1471 do
1472 makedev scd$unit b $major $unit $cdrom
1473 symlink sr$unit scd$unit
1474 done
1475 ;;
1476 pktcdvd)
1477 major=97
1478 for unit in 0 1 2 3
1479 do
1480 makedev pktcdvd$unit b $major $unit $cdrom
1481 done
1482 ;;
1483 cfs0)
1484 makedev cfs0 c 67 0 $coda
1485 ;;
1486 scd[0-9]|scd[0-1][0-9])
1487 major=`Major sr 11` || continue
1488 unit=`suffix $arg scd`
1489 makedev scd$unit b $major $unit $cdrom
1490 ln -f scd$unit sr$unit
1491 ;;
1492 ttyI[0-9]|ttyI[1-5][0-9]|ttyI[6][0-3])
1493 major=43
1494 unit=`suffix $arg ttyI`
1495 makedev ttyI$unit c $major $unit $dialout
1496 ;;
1497 ppp)
1498 major=108
1499 makedev ppp c $major 0 $dip
1500 ;;
1501 ippp[0-9]|ippp[1-5][0-9]|ippp[6][0-3])
1502 major=45
1503 unit=`suffix $arg ippp`
1504 minor=`math $unit + 128`
1505 makedev ippp$unit c $major $minor $dialout
1506 ;;
1507 isdn[0-9]|isdn[1-5][0-9]|isdn[6][0-3])
1508 major=45
1509 unit=`suffix $arg isdn`
1510 minor=`math $unit + 0`
1511 makedev isdn$unit c $major $minor $dialout
1512 ;;
1513 isdnctrl[0-9]|isdnctrl[1-5][0-9]|isdnctrl[6][0-3])
1514 major=45
1515 unit=`suffix $arg isdnctrl`
1516 minor=`math $unit + 64`
1517 makedev isdnctrl$unit c $major $minor $dialout
1518 ;;
1519 isdninfo)
1520 makedev isdninfo c 45 255 $private
1521 ;;
1522 isdn-tty)
1523 major=43
1524 for unit in 0 1 2 3 4 5 6 7
1525 do
1526 makedev ttyI$unit c $major $unit $dialout
1527 done
1528 ;;
1529 isdn-ippp)
1530 major=45
1531 for unit in 0 1 2 3 4 5 6 7
1532 do
1533 makedev ippp$unit c $major `math $unit + 128` $dialout
1534 done
1535 ;;
1536 isdn-io)
1537 for unit in 0 1 2 3 4 5 6 7
1538 do
1539 makedev isdn$unit c 45 $unit $dialout
1540 makedev isdnctrl$unit c 45 `math $unit + 64` $dialout
1541 makedev ippp$unit c 45 `math $unit + 128` $dialout
1542 done
1543 makedev isdninfo c 45 255 $dialout
1544 ;;
1545 sonycd)
1546 major=`Major sonycd 15` || continue
1547 makedev $arg b $major 0 $cdrom
1548 ;;
1549 mcd)
1550 major=`Major mcd 23` || continue
1551 makedev $arg b $major 0 $cdrom
1552 ;;
1553 mcdx|mcdx[0-4])
1554 major=`Major $arg 20` || continue
1555 for unit in 0 1 2 3 4
1556 do
1557 makedev mcdx$unit b $major $unit $cdrom
1558 done
1559 test -r mcdx || symlink mcdx mcdx0
1560 ;;
1561 cdu535)
1562 makedev $arg b 24 0 $cdrom
1563 ;;
1564 lmscd)
1565 makedev $arg b 24 0 $cdrom
1566 ;;
1567 sbpcd|sbpcd[123])
1568 major=`Major $arg 25` || continue
1569 base=`suffix ${arg}0 sbpcd`
1570 for minor in 0 1 2 3
1571 do
1572 # XXX
1573 unit=$(substr 0123456789abcdef $(( $base * 4 + $minor + 1 )) )
1574 makedev sbpcd$unit b $major $minor $cdrom
1575 done
1576 [ $arg = sbpcd ] && symlink $arg ${arg}0
1577 ;;
1578 aztcd)
1579 major=`Major $arg 29` || continue
1580 makedev ${arg}0 b $major 0 $cdrom
1581 ;;
1582 cm206cd)
1583 major=`Major $arg 30` || continue
1584 makedev ${arg}0 b $major 0 $cdrom
1585 ;;
1586 gscd)
1587 major=`Major $arg 16` || continue
1588 makedev ${arg}0 b $major 0 $cdrom
1589 ;;
1590 pcd)
1591 for unit in 0 1 2 3
1592 do
1593 makedev pcd$unit b 46 $unit $cdrom
1594 done
1595 ;;
1596 bpcd)
1597 makedev $arg b 41 0 $cdrom
1598 ;;
1599 optcd)
1600 makedev $arg b 17 0 $cdrom
1601 ;;
1602 sjcd)
1603 makedev $arg b 18 0 $cdrom
1604 ;;
1605 cfs|coda)
1606 makedev cfs0 c 67 0 $private
1607 ;;
1608 xfs|arla)
1609 makedev xfs0 c 103 0 $private
1610 ;;
1611 logiscan)
1612 major=`Major logiscan` || continue
1613 makedev $arg c $major 0 $scanner
1614 ;;
1615 toshiba)
1616 major=`Major $arg 10` || continue
1617 makedev $arg c $major 181 root root 0666
1618 ;;
1619 m105scan)
1620 major=`Major m105` || continue
1621 makedev $arg c $major 0 $scanner
1622 ;;
1623 ac4096)
1624 major=`Major ac4096` || continue
1625 makedev $arg c $major 0 $scanner
1626 ;;
1627 audio)
1628 major=`Major sound 14`
1629 makedev mixer c $major 0 $audio
1630 makedev mixer1 c $major 16 $audio
1631 makedev mixer2 c $major 32 $audio
1632 makedev mixer3 c $major 48 $audio
1633 makedev sequencer c $major 1 $audio
1634 makedev midi00 c $major 2 $audio
1635 makedev midi01 c $major 18 $audio
1636 makedev midi02 c $major 34 $audio
1637 makedev midi03 c $major 50 $audio
1638 makedev dsp c $major 3 $audio
1639 makedev dsp1 c $major 19 $audio
1640 makedev dsp2 c $major 35 $audio
1641 makedev dsp3 c $major 51 $audio
1642 makedev audio c $major 4 $audio
1643 makedev audio1 c $major 20 $audio
1644 makedev audio2 c $major 36 $audio
1645 makedev audio3 c $major 52 $audio
1646 makedev sndstat c $major 6 $audio
1647 makedev audioctl c $major 7 $audio
1648 major=31
1649 makedev mpu401data c $major 0 $audio
1650 makedev mpu401stat c $major 1 $audio
1651 major=35
1652 for i in 0 1 2 3
1653 do
1654 makedev midi$i c $major $i $audio
1655 makedev rmidi$i c $major `math $i + 64` $audio
1656 makedev smpte$i c $major `math $i + 128` $audio
1657 done
1658 ;;
1659 pcaudio)
1660 major=`Major pcsp 13` || continue
1661 makedev pcmixer c $major 0 $audio
1662 makedev pcsp c $major 3 $audio
1663 makedev pcaudio c $major 4 $audio
1664 ;;
1665 video|video4linux|v4l|radio)
1666 # video4linux api includes radio, teletext, etc.
1667 major=`Major video 81` || continue
1668 minor=0
1669 until [ $minor -gt 63 ]
1670 do
1671 makedev video$minor c $major $minor $video
1672 makedev radio$minor c $major `math $minor + 64` $video
1673 minor=`math $minor + 1`
1674 done
1675 symlink radio radio0
1676 minor=0
1677 until [ $minor -gt 31 ]
1678 do
1679 makedev vtx$minor c $major `math $minor + 192` $video
1680 makedev vbi$minor c $major `math $minor + 224` $video
1681 minor=`math $minor + 1`
1682 done
1683 symlink video video0
1684 symlink vbi vbi0
1685 major=82
1686 minor=0
1687 until [ $minor -gt 1 ]
1688 do
1689 makedev winradio$minor c $major $minor $video
1690 minor=`math $minor + 1`
1691 done
1692 major=83
1693 makedev vtx c $major 0 $video
1694 makedev vttuner c $major 16 $video
1695 ;;
1696 i2c)
1697 # making it possible to create an arbitrary number of i2c
1698 # devices might be good, but 8 should suffice for now
1699 major=`Major i2c 89` || continue
1700 minor=0
1701 until [ $minor -gt 7 ]
1702 do
1703 makedev i2c-$minor c $major $minor $private
1704 minor=`math $minor + 1`
1705 done
1706 ;;
1707 tlk)
1708 major=102
1709 minor=0
1710 until [ $minor -gt 3 ] # tell me if 3 is wrong...
1711 do
1712 makedev tlk$minor c $major $minor $video
1713 minor=`math $minor + 1`
1714 done
1715 ;;
1716 srnd)
1717 makedev srnd0 c 110 0 $video
1718 makedev srnd1 c 110 1 $video
1719 ;;
1720 fgrab)
1721 makedev mmetfgrab c 40 0 $video
1722 makedev wvisfgrab c 26 0 $video
1723 for i in 0 1 # more?
1724 do
1725 makedev iscc$i c 93 $i $video
1726 makedev isccctl$i c 93 `math $i + 128` $video
1727 done
1728 for i in 0 1 # more?
1729 do
1730 makedev dcxx$i c 94 $i $video
1731 done
1732 ;;
1733 sg|sg-all)
1734 major=`Major sg 21`
1735 for unit in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1736 do
1737 makedev sg$unit c $major $unit $scsi
1738 done
1739 ;;
1740 pg)
1741 major=`Major pg 97`
1742 for unit in 0 1 2 3
1743 do
1744 makedev pg$unit c $major $unit $scsi
1745 done
1746 ;;
1747 fd)
1748 # not really devices, we use the /proc filesystem
1749 symlink fd $procfs/self/fd
1750 symlink stdin fd/0
1751 symlink stdout fd/1
1752 symlink stderr fd/2
1753 ;;
1754 ibcs2)
1755 major=`Major ibcs2 30` || continue
1756 makedev socksys c $major 0 $ibcs2
1757 symlink nfsd socksys
1758 makedev spx c $major 1 $ibcs2
1759 symlink X0R null
1760 ;;
1761 netlink)
1762 major=36
1763 makedev route c $major 0 $private
1764 makedev skip c $major 1 $private
1765 ;;
1766 enskip)
1767 major=64
1768 makedev enskip c $major 0 $private
1769 ;;
1770 ipfilt*)
1771 major=95
1772 makedev ipl c $major 0 $private
1773 makedev ipnat c $major 1 $private
1774 makedev ipstate c $major 2 $private
1775 makedev ipauth c $major 3 $private
1776 ;;
1777 qng)
1778 makedev qng c 77 0 $private
1779 ;;
1780 apm)
1781 major=`Major mouse 10` || continue
1782 makedev apm_bios c $major 134 $mouse
1783 ;;
1784 dcf)
1785 major=`Major dcf` || continue
1786 makedev $arg c $major 0 $system
1787 ;;
1788 helloworld)
1789 major=`Major hw` || continue
1790 makedev helloworld c $major 0 $public
1791 ;;
1792 ipsec)
1793 # For the Free S/WAN (http://www.xs4all.nl/~freeswan/)
1794 # implementation of IPSEC
1795 makedev ipsec c 36 10 $ipsec
1796 ;;
1797 comedi)
1798 major=98
1799 for minor in 0 1 2 3
1800 do
1801 makedev comedi$minor c $major $minor $public
1802 done
1803 ;;
1804 usb)
1805 mkdir -p usb
1806 major=180
1807 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1808 do
1809 makedev usb/lp$i c $major $i $printer
1810 makedev usb/mouse$i c $major `math $i + 16` $mouse
1811 makedev usb/ez$i c $major `math $i + 32` $system
1812 makedev usb/scanner$i c $major `math $i + 48` $scanner
1813 makedev ttyACM$i c 166 $i $dialout
1814 makedev ttyUSB$i c 188 $i $dialout
1815 done
1816 makedev usb/rio500 c $major 64 $audio
1817 ;;
1818 paride)
1819 major=45
1820 for unit in a b c d
1821 do
1822 base=`index abcd $unit`
1823 base=`math $base \* 16`
1824 makedev pd$unit b $major $base $disk
1825 for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1826 do
1827 makedev pd$unit$part b $major $(( $base + $part )) $disk
1828 done
1829 done
1830 for i in 0 1 2 3
1831 do
1832 makedev pcd$i b 46 $i $cdrom
1833 makedev pf$i b 47 $i $floppy
1834 done
1835 ;;
1836 update)
1837 if [ ! "$devices" ]
1838 then
1839 echo "$0: don't appear to have any devices" >&2
1840 continue
1841 fi
1842 if [ "$opt_d" ]
1843 then
1844 echo "$0: can't delete an update" >&2
1845 continue
1846 fi
1847 create=
1848 delete=
1849 devs="$devices"
1850 if [ -f DEVICES ]
1851 then
1852 exec 3<DEVICES
1853 while read device major <&3
1854 do
1855 eval now=\$major_$device
1856 if [ "$now" = "" ]
1857 then
1858 delete="$delete `cvt $device`"
1859 continue
1860 elif [ "$now" != $major ]
1861 then
1862 create="$create "`cvt $device`
1863 fi
1864 devs=`strip " $devs " $device`
1865 done
1866 exec 3<&-
1867 fi
1868 create="$create "`cvt $devs`
1869 [ "$delete" != "" ] && $0 $opts -d $delete
1870 [ "$create" != " " ] && $0 $opts $create
1871 [ "$opt_n" ] && continue
1872 for device in $devices
1873 do
1874 if [ "`cvt $device`" ]
1875 then
1876 eval echo $device \$major_$device
1877 fi
1878 done > DEVICES
1879 ;;
1880 *)
1881 echo "$0: don't know how to make device \"$arg\"" >&2
1882 exit 1
1883 ;;
1884 esac
1885 done
1886
1887 exit 0

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20