minix/commands/DESCRIBE/DESCRIBE.sh

253 lines
5.5 KiB
Bash
Raw Normal View History

2005-04-21 16:53:53 +02:00
#!/bin/sh
#
# DESCRIBE 2.2 - Describe the given devices. Author: Kees J. Bot
#
# BUGS
# - Arguments may not contain shell metacharacters.
case $# in
0) flag=; set -$- /dev ;;
*) flag=d ;;
esac
ls -l$flag $* | \
sed -e '/^total/d' \
-e '/^l/d' \
2005-04-21 16:53:53 +02:00
-e '/^[^bc]/s/.* /BAD BAD /' \
-e '/^[bc]/s/.* \([0-9][0-9]*\), *\([0-9][0-9]*\).* /\1 \2 /' \
| {
ex=0 # exit code
while read major minor path
do
case $path in
/*) name=`expr $path : '.*/\\(.*\\)$'`
;;
*) name=$path
esac
dev= des=
case $major in # One of the controllers? What is its controller nr?
3) ctrlr=0 ;;
8) ctrlr=1 ;;
10) ctrlr=2 ;;
12) ctrlr=3 ;;
esac
case $major,$minor in
1,0) des="RAM disk" dev=ram
;;
1,1) des="memory" dev=mem
;;
1,2) des="kernel memory" dev=kmem
;;
1,3) des="null device, data sink" dev=null
;;
1,4) des="boot device loaded from boot image" dev=boot
;;
1,5) des="null byte stream generator" dev=zero
;;
1,6) des="boot image RAM disk" dev=imgrd
;;
1,[789]|1,1[012])
ramdisk=`expr $minor - 7`
des="RAM disk $ramdisk" dev=ram$ramdisk
;;
2005-04-21 16:53:53 +02:00
2,*) drive=`expr $minor % 4`
case `expr $minor - $drive` in
0) des='auto density' dev="fd$drive"
;;
4) des='360k, 5.25"' dev="pc$drive"
;;
8) des='1.2M, 5.25"' dev="at$drive"
;;
12) des='360k in 720k, 5.25"' dev="qd$drive"
;;
16) des='720k, 3.5"' dev="ps$drive"
;;
20) des='360k in 1.2M, 5.25"' dev="pat$drive"
;;
24) des='720k in 1.2M, 5.25"' dev="qh$drive"
;;
28) des='1.44M, 3.5"' dev="PS$drive"
;;
112) des='auto partition 0' dev="fd${drive}p0"
;;
116) des='auto partition 1' dev="fd${drive}p1"
;;
120) des='auto partition 2' dev="fd${drive}p2"
;;
124) des='auto partition 3' dev="fd${drive}p3"
;;
*) dev=BAD
esac
des="floppy drive $drive ($des)"
;;
[38],[05]|[38],[123][05]|1[02],[05]|1[02],[123][05])
drive=`expr $minor / 5`
des="controller $ctrlr disk $drive" dev=c${ctrlr}d${drive}
;;
[38],?|[38],[123]?|1[02],?|1[02],[123]?)
drive=`expr $minor / 5`
par=`expr $minor % 5 - 1`
des="controller $ctrlr disk $drive partition $par"
dev=c${ctrlr}d${drive}p${par}
;;
[38],12[89]|[38],1[3-9]?|[38],2??|1[02],12[89]|1[02],1[3-9]?|1[02],2??)
drive=`expr \\( $minor - 128 \\) / 16`
par=`expr \\( \\( $minor - 128 \\) / 4 \\) % 4`
sub=`expr \\( $minor - 128 \\) % 4`
des="hard disk $drive, partition $par, subpartition $sub"
des="controller $ctrlr disk $drive partition $par slice $sub"
#par=`expr $drive '*' 5 + $par`
dev=c${ctrlr}d${drive}p${par}s${sub}
;;
[38],6[4-9]|[38],7?|1[02],6[4-9]|1[02],7?)
tape=`expr \\( $minor - 64 \\) / 2`
case $minor in
*[02468])
des="controller $ctrlr tape $tape (non-rewinding)"
dev=c${ctrlr}t${tape}n
;;
*[13579])
des="controller $ctrlr tape $tape (rewinding)"
dev=c${ctrlr}t${tape}
esac
;;
4,0) des="console device" dev=console
;;
4,[1-7])des="virtual console $minor" dev=ttyc$minor
;;
4,15) des="diagnostics device" dev=log
;;
4,1[6-9])
line=`expr $minor - 16`
des="serial line $line" dev=tty0$line
;;
4,125) des="video output" dev=video
;;
2005-04-21 16:53:53 +02:00
4,12[89]|4,1[3-8]?|4,19[01])
p=`expr \\( $minor - 128 \\) / 16 | tr '0123' 'pqrs'`
n=`expr $minor % 16`
test $n -ge 10 && n=`expr $n - 10 | tr '012345' 'abcdef'`
des="pseudo tty `expr $minor - 128`" dev=tty$p$n
;;
4,???)
p=`expr \\( $minor - 192 \\) / 16 | tr '0123' 'pqrs'`
n=`expr $minor % 16`
test $n -ge 10 && n=`expr $n - 10 | tr '012345' 'abcdef'`
des="controller of tty$p$n" dev=pty$p$n
;;
5,0) des="anonymous tty" dev=tty
;;
6,0) des="line printer, parallel port" dev=lp
;;
7,*)
d=`expr $minor % 8`
n=`expr $minor / 8`
case $d in
0) des="IP stat" dev=ipstat
;;
1) case $name in
2005-04-21 16:53:53 +02:00
psip*)
des="Pseudo IP #$n" dev=psip
;;
*) des="raw ethernet #$n" dev=eth
esac
;;
2) des="raw IP #$n" dev=ip
2005-04-21 16:53:53 +02:00
;;
3) des="TCP/IP #$n" dev=tcp
2005-04-21 16:53:53 +02:00
;;
4) des="UDP #$n" dev=udp
2005-04-21 16:53:53 +02:00
esac
case $d in
[0123])
if [ "$name" = "$dev" ]
then
des="$des (default)"
else
dev=$dev$n
fi
esac
;;
11,0)
des="block filter" dev=filter
;;
2005-04-21 16:53:53 +02:00
13,0)
des="audio" dev=audio
;;
14,0)
des="faulty block device driver" dev=fbd
2005-04-21 16:53:53 +02:00
;;
15,0)
des="kernel log" dev=klog
;;
16,0)
des="pseudo random number generator" dev=urandom
;;
New RS and new signal handling for system processes. UPDATING INFO: 20100317: /usr/src/etc/system.conf updated to ignore default kernel calls: copy it (or merge it) to /etc/system.conf. The hello driver (/dev/hello) added to the distribution: # cd /usr/src/commands/scripts && make clean install # cd /dev && MAKEDEV hello KERNEL CHANGES: - Generic signal handling support. The kernel no longer assumes PM as a signal manager for every process. The signal manager of a given process can now be specified in its privilege slot. When a signal has to be delivered, the kernel performs the lookup and forwards the signal to the appropriate signal manager. PM is the default signal manager for user processes, RS is the default signal manager for system processes. To enable ptrace()ing for system processes, it is sufficient to change the default signal manager to PM. This will temporarily disable crash recovery, though. - sys_exit() is now split into sys_exit() (i.e. exit() for system processes, which generates a self-termination signal), and sys_clear() (i.e. used by PM to ask the kernel to clear a process slot when a process exits). - Added a new kernel call (i.e. sys_update()) to swap two process slots and implement live update. PM CHANGES: - Posix signal handling is no longer allowed for system processes. System signals are split into two fixed categories: termination and non-termination signals. When a non-termination signaled is processed, PM transforms the signal into an IPC message and delivers the message to the system process. When a termination signal is processed, PM terminates the process. - PM no longer assumes itself as the signal manager for system processes. It now makes sure that every system signal goes through the kernel before being actually processes. The kernel will then dispatch the signal to the appropriate signal manager which may or may not be PM. SYSLIB CHANGES: - Simplified SEF init and LU callbacks. - Added additional predefined SEF callbacks to debug crash recovery and live update. - Fixed a temporary ack in the SEF init protocol. SEF init reply is now completely synchronous. - Added SEF signal event type to provide a uniform interface for system processes to deal with signals. A sef_cb_signal_handler() callback is available for system processes to handle every received signal. A sef_cb_signal_manager() callback is used by signal managers to process system signals on behalf of the kernel. - Fixed a few bugs with memory mapping and DS. VM CHANGES: - Page faults and memory requests coming from the kernel are now implemented using signals. - Added a new VM call to swap two process slots and implement live update. - The call is used by RS at update time and in turn invokes the kernel call sys_update(). RS CHANGES: - RS has been reworked with a better functional decomposition. - Better kernel call masks. com.h now defines the set of very basic kernel calls every system service is allowed to use. This makes system.conf simpler and easier to maintain. In addition, this guarantees a higher level of isolation for system libraries that use one or more kernel calls internally (e.g. printf). - RS is the default signal manager for system processes. By default, RS intercepts every signal delivered to every system process. This makes crash recovery possible before bringing PM and friends in the loop. - RS now supports fast rollback when something goes wrong while initializing the new version during a live update. - Live update is now implemented by keeping the two versions side-by-side and swapping the process slots when the old version is ready to update. - Crash recovery is now implemented by keeping the two versions side-by-side and cleaning up the old version only when the recovery process is complete. DS CHANGES: - Fixed a bug when the process doing ds_publish() or ds_delete() is not known by DS. - Fixed the completely broken support for strings. String publishing is now implemented in the system library and simply wraps publishing of memory ranges. Ideally, we should adopt a similar approach for other data types as well. - Test suite fixed. DRIVER CHANGES: - The hello driver has been added to the Minix distribution to demonstrate basic live update and crash recovery functionalities. - Other drivers have been adapted to conform the new SEF interface.
2010-03-17 02:15:29 +01:00
17,0)
des="hello" dev=hello
;;
18,0)
des="UNIX domain socket" dev=uds
;;
5[6-9],0|6[0-3],0)
drive=`expr $major - 56`
des="vnode disk $drive" dev=vnd$drive
;;
5[6-9],[1-4]|6[0-3],[1-4])
drive=`expr $major - 56`
par=`expr $minor - 1`
des="vnode disk $drive partition $par" dev=vnd${drive}p${par}
;;
5[6-9],12[89]|5[6-9],13[0-9]|5[6-9],14[0-3]|6[0-3],12[89]|5[6-9],13[0-9]|5[6-9],14[0-3])
drive=`expr $major - 56`
par=`expr \\( \\( $minor - 128 \\) / 4 \\) % 4`
sub=`expr \\( $minor - 128 \\) % 4`
des="vnode disk $drive partition $par slice $sub"
dev=vnd${drive}p${par}s${sub}
;;
Input infrastructure, INPUT server, PCKBD driver This commit separates the low-level keyboard driver from TTY, putting it in a separate driver (PCKBD). The commit also separates management of raw input devices from TTY, and puts it in a separate server (INPUT). All keyboard and mouse input from hardware is sent by drivers to the INPUT server, which either sends it to a process that has opened a raw input device, or otherwise forwards it to TTY for standard processing. Design by Dirk Vogt. Prototype by Uli Kastlunger. Additional changes made to the prototype: - the event communication is now based on USB HID codes; all input drivers have to use USB codes to describe events; - all TTY keymaps have been converted to USB format, with the effect that a single keymap covers all keys; there is no (static) escaped keymap anymore; - further keymap tweaks now allow remapping of literally all keys; - input device renumbering and protocol rewrite; - INPUT server rewrite, with added support for cancel and select; - PCKBD reimplementation, including PC/AT-to-USB translation; - support for manipulating keyboard LEDs has been added; - keyboard and mouse multiplexer devices have been added to INPUT, primarily so that an X server need only open two devices; - a new "libinputdriver" library abstracts away protocol details from input drivers, and should be used by all future input drivers; - both INPUT and PCKBD can be restarted; - TTY is now scheduled by KERNEL, so that it won't be punished for running a lot; without this, simply running "yes" on the console kills the system; - the KIOCBELL IOCTL has been moved to /dev/console; - support for the SCANCODES termios setting has been removed; - obsolete keymap compression has been removed; - the obsolete Olivetti M24 keymap has been removed. Change-Id: I3a672fb8c4fd566734e4b46d3994b4b7fc96d578
2013-09-28 14:46:21 +02:00
64,0)
des="keyboard input multiplexer"
dev=kbdmux
;;
64,[1-4])
n=`expr $minor - 1`
des="keyboard input $n"
dev=kbd$n
;;
64,64)
des="mouse input multiplexer"
dev=mousemux
;;
64,6[5-8])
n=`expr $minor - 65`
des="mouse input $n"
dev=mouse$n
;;
2005-04-21 16:53:53 +02:00
BAD,BAD)
des= dev=
;;
*) dev=BAD
esac
case $name:$dev in
*:)
echo "$path: not a device" >&2
ex=1
;;
*:*BAD*)
echo "$path: cannot describe: major=$major, minor=$minor" >&2
ex=1
;;
$dev:*)
echo "$path: $des"
;;
*:*) echo "$path: nonstandard name for $dev: $des"
esac
done
exit $ex
}