Go to the previous, next section.

Devices

A device driver is a module used to control all accesses that the system makes to a specific hardware resource. This chapter explains how to use some of the system's device drivers, the drivers not documented here are either invisible to the user or totally trivial.

Some of the modules documented here are not really device drivers, this part of the manual seemed the best place for them though.

The Hard Disk Device Driver

The hard disk device driver allows the system (and especially, the filing system, see section The Filing System) to talk to any IDE hard disks connected to the host computer.

When the hard disk driver is initialised it probes for IDE disks (only on the first controller at present), and recognised disks are added to the system's list of hard-disk-like devices. Each device is then scanned for partitions, each partition is given a unique name and added to the list of hard disk partitions that the system maintains.n

The name of each partition is made from the name of the disk (either `hda' or `hdb') and a number defining which partition it is. The primary partitions are given numbers one to four, any extended partitions are given numbers starting at five. For example `hda1' refers to the first primary partition of the first IDE hard disk, while `hdb6' refers to the second extended partition of the second IDE disk.

A special partition is created which spans the whole of the hard disk, it has the same name as the device it spans (i.e. `hda').

The hard disk defines the following shell commands.

Command: hdinfo

List the currently recognised hard disk devices, and the partitions which they contain.

Command: hdperf partition blocks [blocks-per-request]

This command times the performance of hard disk reads from the hard disk partition partition. It reads blocks number of 512-byte blocks from the partition calculating the amount of time it takes.

If the blocks-per-request parameter is defined it specifies the number of blocks to read in each request made to the device driver. Normally the data throughput should increase as this value is raised.

The time period is measured in ticks, each tick is 1/1024 of a second.

This command actually makes two timings: the first by requesting the device driver to read the blocks, the second by reading the blocks from the filing system's buffer cache. The second timing will not work if the partition is not mounted in the filing system (see section The Filing System). Also, the blocks-per-request argument is not used when reading from the buffer-cache, a standard value of 2 is used.

For details on how to mount a hard disk partition in the filing system see section Devices.

The Floppy Disk Device Driver

The floppy driver provides support for up to two floppy drives, numbered `fd0' and {fd1}. The geometry of these drives is obtained from the CMOS information of the machine.

Command: fdinfo

Lists the floppy devices that floppy driver is supporting. This is the information obtained from the kernel, and if mounted, the information of the physical disks.

To mount a floppy drive for use by the filing system, see section Devices.

The Ramdisk

The ramdisk is a simple means of utilising memory in a way accessible through the filing system.

Once a suitable region of memory has been allocated for the purpose, a device becomes available for file storage, and any accesses to that device are reflected into the allocated memory. The devices are numbered `rd0' onwards, the numeric part representing the number of the device.

Once the ramdisk device driver is loaded, management of the ramdisks is achieved with the commands listed below.

Command: rdinfo

This command lists information on the allocated ramdisks present in the system, including their device name, the address of their memory regions and the size of the region.

Command: addrd blocks

This enables the user to add a ramdisk to the system of blocks blocks in size. A block is 512 bytes in size (unlike the file system, where a block is in fact 1024 bytes in size) and memory will be allocated for it, if possible. Once allocated, the area is initialised and mounted ready for use. Numbering of the ramdisk is incremental from the last created ramdisk, starting at zero.

Command: delrd device

Removes the device device from the system, making it unavailable for use. Any information stored on it is lost. In removing it from the driver, the device is unmounted and the memory it was using is returned returned to the system.

The TTY Device Driver

A tty is a virtual console. Multiple tty's may be open at any one time, the tty actually being displayed is known as the foreground tty. Any characters typed at the keyboard are always transmitted to the foreground tty.

TTY's are put to two main purposes by the system

  1. To give the shell (or any other task) a place to input and output. Each shell opens a new tty from which it reads command lines, all output from the shell goes to the same tty.

  2. To provide each virtual machine with virtual display hardware and a virtual keyboard. All virtual machines have a tty allocated for them when they are created.

All tty's respond to the following hot keys (a key sequence that can be typed at any time)

Alt-KpMinus
(That's the `-' key on the numeric key-pad while the Alt key is held down.) Switch to the previous tty.

Alt-KpPlus
Switch to the next tty.

Alt-SysReq
Switch to the tty of the shell that was created when the system initialised itself.

Alt-ESC
Spawn a new shell task in a new tty.

Ctrl-Alt-DEL
Reboot the system immediately.

When a line of input is being read from a tty (i.e. in a shell) that is not in a virtual machine, the following commands are available to edit the line being entered. In general these will be bound to the same keys as the equivalent functions in the Emacs editor. The following table lists the available commands, where the variable arg is mentioned it refers to the prefix argument entered by the metafied numeric keys.

C-f
Right
Move forward arg characters.

C-b
Left
Move backward arg characters.

C-a
Move to the beginning of the line.

C-e
Move to the end of the line.

C-d
Either delete the arg characters starting with the one under the cursor or if the cursor is at the end of the line accept the current contents of the buffer (an end-of-line character).

Backspace
Delete the arg characters preceding the cursor.

RET
Insert a newline character at the end of the line and accept the contents of the buffer.

C-l
Redisplay the buffer.

C-SPC
Set the value of the mark to the current cursor position.

C-x C-x
Exchange the cursor position with that of the mark.

C-n
Down
Move forward arg lines in the history list.

C-p
Up
Move back arg lines in the history list.

M-<
Display the first line in the history list.

M->
Display the last line in the history list.

M-0
M-1
M-2
M-3
M-4
M-5
M-6
M-7
M-8
M-9
Append the number typed to the end of the (decimal) prefix argument for the following command. For example typing M-1 M-0 C-f moves the cursor ten characters forwards.

M--
(That's Meta-minus.) Negate the value of the prefix argument for the next command. For example typing M-- M-4 C-f moves backwards four characters.

The notation C-x and M-x means the x key with the Control modifier and the Meta qualifier respectively. To generate a M-x event either type Alt-x or ESC x.

The Printer Spooler

The printer spooler allows sharing of a single printer device by more than one process. The user can submit files to be printed along with files printed by other processes and access to the printer by virtual machines.

The spooler defines the following commands.

Command: lpr files...

This command adds the listed files to the printer spooler queue.

It makes a copy of the file in the spooler directory and adds it to the spooler queue. It then reports the result of each file it attempts to spool.

Command: lpq

This command lists all the files currently in the spool queue with a job number for each file spooled. This number can be used in conjunction with the lprm command.

Command: lprm job-numbers...

This command removes the files from the printer spooler queue with the job numbers listed in the commands parameters before they are printed. It reports if the job was successfully dequeued or not.

The job numbers can be obtained from the lpq command.

The Syslog Daemon

The system log daemon allows processes to send status and debugging output to a common file. The operation of the log daemon process can be controlled by the user to set how much information goes to the file or can completely stop all output to the logfile.

Command: syslog command

This command controls operation of the system log daemon. The command parameter defines the operation performed, it can be one of the following:

-stop
Prevents any output going to the logfile.

-start
Allows output to go to the logfile.

-level new-level
This sets the logging level. Only processes which have a logging level less than or equal to new-level will have output present in the logfile.

-status
Prints information regarding the current status of the log daemon.

Go to the previous, next section.