ADS

Tuesday 5 July 2011

LLKMHT-IndivualModules2

15.2. Block Device Drivers

15.2.1. floppy: floppy disk driver

This is the device driver for floppy disks. You need this in order to access a floppy disk in any way.

This LKM is documented in the file README.fd in the linux/drivers/block directory of the Linux source tree. For detailed up to date information refer directly to this file.



Note that if you boot (or might boot) from a floppy disk or with a root filesystem on a floppy disk, you must have this driver bound into the base kernel, because your system will need it before it has a chance to insert the LKM.

Example:



modprobe floppy 'floppy="daring two_fdc 0,thinkpad 0x8,fifo_depth"'

There is only one LKM parameter: floppy . But it contains many subparameters. The reason for this unusual parameter format is to be consistent with the way you would specify the same things in the kernel boot parameters if the driver were bound into the base kernel.

The value of floppy is a sequence of blank-delimited words. Each of those words is one of the following sequences of comma-delimited words:

asus_pci


Sets the bit mask of allowed drives to allow only units 0 and 1. Obsolete, as this is the default setting anyways

daring


Tells the floppy driver that you have a well behaved floppy controller. This allows more efficient and smoother operation, but may fail on certain controllers. This may speed up certain operations.

0,daring


Tells the floppy driver that your floppy controller should be used with caution.

one_fdc


Tells the floppy driver that you have only floppy controller (default).

address ,two_fdc


Tells the floppy driver that you have two floppy controllers. The second floppy controller is assumed to be at address . This option is not needed if the second controller is at address 0x370, and if you use the 'cmos' option

two_fdc


Like above, but with default address

thinkpad


Tells the floppy driver that you have an IBM Thinkpad model notebook computer. Thinkpads use an inverted convention for the disk change line.

0,thinkpad


Tells the floppy driver that you don't have a Thinkpad.

nodma


Tells the floppy driver not to use DMA for data transfers. This is needed on HP Omnibooks, which don't have a workable DMA channel for the floppy driver. This option is also useful if you frequently get "Unable to allocate DMA memory" messages. Indeed, DMA memory needs to be continuous in physical memory, and is thus harder to find, whereas non-DMA buffers may be allocated in virtual memory. However, I advise against this if you have an FDC without a FIFO (8272A or 82072). 82072A and later are OK). You also need at least a 486 to use nodma. If you use nodma mode, I suggest you also set the FIFO threshold to 10 or lower, in order to limit the number of data transfer interrupts.

If you have a FIFO-able FDC, the floppy driver automatically falls back on non DMA mode if it can't find any DMA-able memory. If you want to avoid this, explicitly specify "yesdma".

omnibook


Same as nodma .

yesdma


Tells the floppy driver that a workable DMA channel is available (the default).

nofifo


Disables the FIFO entirely. This is needed if you get "Bus master arbitration error" messages from your Ethernet card (or

from other devices) while accessing the floppy.


fifo


Enables the FIFO (default)

threshold ,fifo_depth


Sets the FIFO threshold. This is mostly relevant in DMA mode. If this is higher, the floppy driver tolerates more interrupt latency, but it triggers more interrupts (i.e. it imposes more load on the rest of the system). If this is lower, the interrupt latency should be lower too (faster processor). The benefit of a lower threshold is fewer interrupts.

To tune the fifo threshold, switch on over/underrun messages using 'floppycontrol --messages'. Then access a floppy disk. If you get a huge amount of "Over/Underrun - retrying" messages, then the fifo threshold is too low. Try with a higher value, until you only get an occasional Over/Underrun.

The value must be between 0 and 0xf, inclusive.

As you insert and remove the LKM to try different values, remember to redo the 'floppycontrol --messages' every time you insert the LKM. You shouldn't normally have to tune the fifo, because the default (0xa) is reasonable.

drive ,type ,cmos


Sets the CMOS type of drive to type . This is mandatory if you have more than two floppy drives (only two can be described in the physical CMOS), or if your BIOS uses non-standard CMOS types. The CMOS types are:

0


Use the value of the physical CMOS

1


5 1/4 DD

2


5 1/4 HD

3


3 1/2 DD

4


3 1/2 HD

5


3 1/2 ED

6


3 1/2 ED

16


unknown or not installed

(Note: there are two valid types for ED drives. This is because 5 was initially chosen to represent floppy tapes , and 6 for ED drives. AMI ignored this, and used 5 for ED drives. That's why the floppy driver handles both)

unexpected_interrupts


Print a warning message when an unexpected interrupt is received. (default behavior)

no_unexpected_interrupts


Don't print a message when an unexpected interrupt is received. This is needed on IBM L40SX laptops in certain video modes. (There seems to be an interaction between video and floppy. The unexpected interrupts only affect performance, and can safely be ignored.)

L40SX


Same as no_unexpected_interrupts .

broken_dcl


Don't use the disk change line, but assume that the disk was changed whenever the device node is reopened. Needed on some boxes where the disk change line is broken or unsupported. This should be regarded as a stopgap measure, indeed it makes floppy operation less efficient due to unneeded cache flushings, and slightly more unreliable. Please verify your cable, connection and jumper settings if you have any DCL problems. However, some older drives, and also some laptops are known not to have a DCL.

debug


Print debugging messages

messages


Print informational messages for some operations (disk change notifications, warnings about over and underruns, and about autodetection)

silent_dcl_clear


Uses a less noisy way to clear the disk change line (which doesn't involve

seeks). Implied by daring.


nr ,irq


Tells the driver to expect interrupts on IRQ nr instead of the conventional IRQ 6.

nr ,dma


Tells the driver to use DMA channel nr instead of the conventional DMA channel 2.

slow


Use PS/2 stepping rate: PS/2 floppies have much slower step rates than regular floppies. It's been recommended that take about 1/4 of the default speed in some more extreme cases.

mask ,allowed_drive_mask


Sets the bitmask of allowed drives to mask . By default, only units 0 and 1 of each floppy controller are allowed. This is done because certain non-standard hardware (ASUS PCI motherboards) mess up the keyboard when accessing units 2 or 3. This option is somewhat obsoleted by the 'cmos' option.

all_drives


Sets the bitmask of allowed drives to all drives. Use this if you have more than two drives connected to a floppy controller.

15.2.2. loop: loop device driver

This module lets you mount a filesystem that is stored in a regular file (in another filesystem). That other file is called the backing file.

One use of this is to test an ISO 9660 filesystem before irreversibly burning it onto a CD. You build the filesystem in a 650 MB regular file. That file will be the input to the CD burning program. But you can define a loopback device based on that file as backing file and then mount the filesystem right from the backing file.

It can also give you a handy way to transmit collections of files over a network. It's like a tar file, only you don't have to pack and unpack it -- you just mount the original file.

Some people use loop devices on a machine that sometimes runs Windows and sometimes runs Linux to allow them to maintain the Linux system via the Windows system: put a Linux root filesystem in a file in a FAT filesystem that Windows can access, then mount the Linux root filesystem via a loop device when Linux is running.

You can keep the filesystem encrypted or compressed, or encoded in any arbitrary way, in the backing file. The loop device encodes (e.g. encrypts) as you write to it, and decodes (e.g. decrypts) as you read. (An alternative more popular strategy for encrypting and compressing a filesystem is to use an encrypted or compressed filesystem type, either a native one or one backed by a normal filesystem. Cfs, Tcfs, and Stegfs are examples of such filesystem types).

An encoding system is based on a "transfer function". There are two tranfer functions built into the loop module: the identify transfer function (which is for the normal no-encoding case -- What you see in the loop device is exactly what is in the backing file) and a simple XOR encryption function. A separate kernel module can add any transfer function by calling the loop module's exported loop_register_transfer() function.

There appear to be various modules floating around that provide transfer functions to do compression and encryption (DES, IDEA, Fish, etc.). Some of them appear to be part of current Linux kernel distributions. In addition, there appear to be various alternative loop device drivers, many of them also called loop , that have such transfer functions built in.

Do not confuse these loop devices with the "loopback device" used for network connections from the machine to itself. That isn't actually a device at all - it's a network interface.

This module is a block device driver. You set up a loop device by issuing an ioctl to it to bind a file to it. The typical program to issue this ioctl is losetup . See the documentation of losetup for more details. There are also options on the normal 'mount' command to do loop device setup under the covers, but because that confuses the logically separate operations of setting up a loop device and mounting a filesystem, for the sake of clarity
you're probably better off using losetup .

Example:




modprobe loop

Module Parameters:

max_loop


Number of loop devices that will exist. Contrary to what its name suggests, the number you specify is the number of loop devices that always exist. An existing device is not necessarily configured (bound to a backing file), though, so this number can be thought of as the maximum number of loop devices that you can configure.

The minor numbers for these loop devices are consecutive starting at 0.

There is more information on loop devices in the Loopback Encrypted Filesystem HOWTO and the Loopback Root Filesystem HOWTO and the manual for losetup .

15.2.3. linear: linear (non-RAID) disk array device driver

This driver lets you combine several disk partitions into one logical block device.

If you use this, then your multiple devices driver will be able to use the so-called linear mode, i.e. it will combine the disk partitions by simply appending one to the other.

See Software-RAID-HOWTO .

Example:




modprobe linear

There are no module parameters.

15.2.4. raid0: RAID-0 device driver

This driver lets you combine several disk partitions into one logical block device.

If you use this, then your multiple devices driver will be able to use the so-called raid0 mode, i.e. it will combine the disk partitions into one logical device in such a fashion as to fill them up evenly, one chunk here and one chunk there. This will increase the throughput rate if the partitions reside on distinct disks.

See Software-RAID-HOWTO .

Example:




modprobe raid0

There are no module parameters.

15.2.5. rd: ramdisk device driver

A ramdisk is a block device whose storage is composed of system memory (real memory; not virtual). You can use it like a very fast disk device and also in circumstances where you need a device, but don't have traditional hardware devices to play with.

A common example of the latter is for a rescue system -- a system you use to diagnose and repair your real system. Since you don't want to mess with your real disks, you run off ramdisks. You might load data into these ramdisks from external media such as floppy disks.

Sometimes, you have your boot loader (e.g. lilo ) create a ramdisk and load it with data (perhaps from a floppy disk). Of course, if you do this, you cannot use the LKM version of the ramdisk driver because the driver will have to be in the kernel at boot time.

A ramdisk is actually conceptually simple in Linux. Disk devices operate through memory because of the buffer cache. The only difference with a ramdisk is that you never actually get past the buffer cache to a real device. This is because with a ramdisk, 1) when you first access a particular block, Linux just assumes it is all zeroes; and 2) the device's buffer cache blocks are never written to the device, ergo never stolen for use with other devices. This means reads and writes are always to the buffer cache and never reach the device.

There is additional information about ramdisks in the file Documentation/ramdisk.txt in the Linux source tree.

Example:




modprobe rd

There are no module parameters that you can supply to the LKM, but if you bind the module into the base kernel, there are kernel parameters you can pass to it. See BootPrompt-HOWTO .

15.2.6. xd: XT disk device driver

Very old 8 bit hard disk controllers used in the IBM XT computer. No, the existence of XT disk support does NOT mean that you can run Linux on an IBM XT :).

Example:




modprobe xd

There are no module parameters.

No comments:

Post a Comment