Specifications
D
evice Driver Programming
13-6
The mod_drvdetach routine is called by the driver's _unload
routine to disable and remove the driver's interrupts from the
running system. This routine is only called if the driver uses inter-
rupts, and is described on the mod_drvdetach(D3) manual
page.
prefixhalt The halt entry point is called by the DLM mechanism. If the
driver is loaded at the time the system is shut down, DLM calls the
driver's halt routine to shut down the driver when the halt rou-
tines for the statically configured kernel modules are called. If you
are converting a static driver to make it loadable, you probably can
use your static driver's halt routine in the loadable version of the
driver. This entry point is optional, and is described on the
halt(D2) manual page. Only device drivers and hardware con-
trollers might need this entry. Other module types do not need it.
Wrapper Data Structures 13
The wrapper data structures are initialized by the DLM mechanism using values taken
from your driver's configuration files. These structures provide information needed during
loading and unloading—such as the values needed to populate your driver's device switch
table entries for the major device numbers it supports.
Note that your driver does not need to use any of the wrapper data structures directly, and
your driver's wrapper needs only to point to these structures.
Wrapper Macros 13
To aid you in generating a wrapper for your loadable driver (or other loadable module
type), DLM provides a set of macros in sys/moddefs.h. The macros are of the form:
type(prefix, load, unload, halt, description);
The keyword type identifies the type of wrapper to be generated. Valid types are
MOD_DRV_WRAPPER generates wrappers for device drivers, including block
drivers, character drivers, STREAMS drivers and pseudo
drivers
MOD_HDRV_WRAPPER generates wrappers for any driver type that does not
require switch table entries, but does need to attach and
detach interrupts
MOD_STR_WRAPPER generates wrappers for STREAMS modules
MOD_FS_WRAPPER generates wrappers for file systems
MOD_MISC_WRAPPER generates wrappers for miscellaneous modules
MOD_EXEC_WRAPPER generates wrappers for exec modules