Writing Device Drivers

Entry Points

Associated with each device driver is a dev_ops(9S) structure, which in turn refers to a cb_ops(9S) structure. See Chapter 5, Autoconfiguration, for details regarding driver data structures. Table 10-1 lists the block driver entry points.

Table 10-1 Block Driver Entry Points

Entry Point 

Description 

_init(9E) 

Initializes a loadable driver module. 

_info(9E) 

Returns information on a loadable driver module. 

_fini(9E) 

Prepares a loadable driver module for unloading. 

identify(9E) 

Obsolete and no longer required. Set to nulldev(9F).

probe(9E)  

Determines if a device is present. 

attach(9E) 

Performs device-specific initialization and/or power management resume functionality.. 

detach(9E) 

Removes device-specific state and/or power management suspend functionality.. 

getinfo(9E) 

Gets device driver information. 

power(9E) 

Sets the power level of a device component. 

dump(9E) 

Dumps memory to the device during system failure. 

open(9E) 

Gains access to a device. 

close(9E) 

Relinquishes access to a device. 

prop_op(9E) 

Manages arbitrary driver properties. 

print(9E) 

Prints error message on driver failure. 

strategy(9E) 

I/O interface for block data. 


Note -

Some of the entry points listed in Table 10-1 can be replaced by nodev(9F) or nulldev(9F) as appropriate.