The Inferno devices described in this chapter include:
Hardware devices are controlled in Inferno by a file system. This is an extension of a Unix concept in which devices such as disks are part of the file system. In Inferno, each device driver is a kernel-resident file system.
A kernel device driver is a server in the sense of the Inferno file protocol, Styx, with the messages implemented by local rather than remote procedure calls. (See Inferno Communications Protocol, Styx in Chapter 3.)
Advantages of Devices as File System
The representation of a device as a set of files using strings for communication has several advantages:
An Inferno device implements a file tree for client processes. A file name beginning with a pound sign, such as #c, names the root of a file tree implemented by a particular kernel device driver identified by the character after the pound sign. Such names are usually bound to conventional locations in the name space. For example, after
sys->bind("#c", "/dev", sys->MREPL)an ls of /dev will show that the files provided by the console device were added to the list of devices in /dev.
When a system call is passed a file name beginning with #, it looks at the next character, and if that is a valid device character, it performs an attach operation on the corresponding device to get a connection representing the root of that device's file tree. If there are any characters after the device character but before the next slash character ( / ) or end of string, those characters are passed as parameter aname to the attach. (See attach, nop - messages to initiate activity in Chapter 3.)
Each kernel device has a conventional place at which a device is bound to the name space. The device synopses in the following pages include an Inferno shell bind command to put the device in the conventional place. Most of these binds are done automatically by the system when it initializes.
Note: This table provides a summary of the most common characters. Other standard device characters are being added.
Introduction to Limbo Modules in Chapter 7
|
Inferno Communications Protocol, Styx in Chapter 3
|