Managing and Developing Dynamically Loadable Kernel Modules
Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12544
New support functions have been added to WSIO to allow interface
drivers to add and remove their _attach() functions from the attach
list. These functions are:
int mod_wsio_attach_list_add(
list_type
, &
attach_func
);
int mod_wsio_attach_list_remove(
list_type
, &
attach_func
);
list_type
specifies the attach list to use; valid entries are
MOD_WSIO_CORE, MOD_WSIO_PCI, and MOD_WSIO_EISA. Both functions
return 0 on success and 1 on failure.
These functions should only be called when the module is dynamically
loaded. Statically linked modules should continue to use the existing
attach chain.
Device probes are normally associated with interface drivers during the
initialization of the WSIO Context Dependent Input/Output (CDIO) at
boot time. Since this is only done once, loadable interface drivers must
explicitly connect the device probe to the driver's drv_info structure:
void wsio_activate_probe(char *
probe_name
, struct drv_info
*
drv_infop
);
probe_name
is the name of the probe as registered by
wsio_register_dev_probe() or wsio_register_probe_func().
drv_infop
is a pointer to the drv_info structure for this driver. In
general, use a probe provided by the system. For example,
parallel_scsi_probe or side_probe. See the HP-UX Driver
Development Guide for complete information.
Finally, similar to class drivers, the _load() function for interface
drivers is passed a pointer to an updated version of the drv_info_t
structure; the interface driver must use this version of the drv_info
structure when it registers itself with WSIO.
The sample code below puts all these concepts together to demonstrate
the loading and initialization steps for an interface driver. This sample
can be configured as either a loadable module or a statically linked
module.