Writing Device Drivers

Entry Points for Block Device Drivers

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

A block device driver can also provide a character driver interface to enable utility programs to bypass the file system and to access the device directly. This device access is commonly referred to as the raw interface to a block device.

The following table lists additional entry points that can be used by block device drivers. See also Entry Points Common to All Drivers.

Table 1–2 Additional Entry Points for Block Drivers

Entry Point 

Usage 

Description 

aread(9E)

Optional 

Performs an asynchronous read. Drivers that do not support an aread() entry point should use the nodev(9F) error return function. Additional information:

awrite(9E)

Optional 

Performs an asynchronous write. Drivers that do not support an awrite() entry point should use the nodev(9F) error return function. Additional information:

print(9E)

Required 

Displays a driver message on the system console. Additional information: print() Entry Point (Block Drivers)

strategy(9E)

Required 

Perform block I/O. Additional information: