Types of Device Drivers……….

There are several kinds of device drivers, each handling a different kind of I/O. Blockdevice drivers manage devices with physically addressable storage media, such as disks. All other devices are considered character devices. Two types of character devicedrivers are standard character device drivers and STREAMS device drivers.

Block Device Drivers

Devices that support a file system are known as block devices. Drivers written for thesedevices are known as block device drivers. Block device drivers take a file systemrequest, in the form of a buf(9S) structure, and issue the I/O operations to the disk totransfer the specified block. The main interface to the file system is the strategy(9E)routine.

Block device drivers can also provide a character driver interface that allows utilityprograms to bypass the file system and access the device directly. This device access iscommonly referred to as the raw interface to a block device.

Character Device

Drivers Character device drivers normally perform I/O in a byte stream. Examples of devicesusing character drivers include tape drives and serial ports. Character device driverscan also provide additional interfaces not present in block drivers, such as I/O control(ioctl) commands, memory mapping, and device polling. See Chapter 10 for more information.

Byte-Stream I/O

The main task of any device driver is to perform I/O, and many character devicedrivers do what is called byte-stream or character I/O. The driver transfers data to andfrom the device without using a specific device address. This is in contrast to blockdevice drivers, where part of the file system request identifies a specific location on the device.

The read(9E) and write(9E) entry points handle byte-stream I/O for standardcharacter drivers. See “I/O Request Handling” on page 156 for more information.

Memory Mapped Devices

For certain devices, such as frame buffers, application programs having direct accessto device memory is more efficient than byte-stream I/O. Applications can map devicememory into their address spaces using the mmap(2) system call. To support memory mapping, device drivers implement segmap(9E) and devmap(9E) entry points.

Drivers that define the devmap(9E) entry point usually do not define read(9E) andwrite(9E) entry points, as application programs perform I/O directly to the devicesafter calling mmap(2).

STREAMS Drivers

STREAMS is a separate programming model for writing a character driver. Devicesthat receive data asynchronously (such as terminal and network devices) are suited toa STREAMS implementation. STREAMS device drivers must provide the loading andautoconfiguration support described in Chapter 5. See the Streams Programming Guidefor additional information on how to write STREAMS drivers.

SHARE THE KNOWLEDGE


Advertisements

About Dinesh

I am engineering student........ I am selected in Microsoft Student Partner as MSP............

Posted on January 7, 2011, in Knowledge. Bookmark the permalink. 1 Comment.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: