Managing and Developing Dynamically Loadable Kernel Modules
Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12 547
Example 12-8 WSIO Interface Driver _unload Function
int
module_name
_unload(void *arg)
{
int ret;
struct isc_table_type *isc;
void *token, *priv_ptr;
return (EINVAL);
/* Remove the attach function from the DLKM attach list. */
if (mod_wsio_attach_list_remove(MOD_WSIO_CORE,
&
module_name
_core_attach)) {
return(ENXIO);
}
/* Unregister the device probe. */
wsio_unregister_dev_probe(IF_CLASS, probe_func,
"
probe_name
");
/* For each ISC belonging to the driver:
* Cancel pending timeouts, free allocated memory,
* unregister ISR routine, etc.
*/
if (wsio_uninstall_driver(&
module_name
_wsio_info)) {
/* uninstall failed - go back to loaded state
* undo what has been done in _unload routine
*/
return ENXIO;
}
return(0);
}
WSIO Monolithic Drivers
The _load() function for a monolithic driver must effectively be the
union of the _load() functions for the class and interface drivers
described previously. Similarly, the _unload() function must effectively
be the union of the _unload() functions for the class and interface
drivers.
STREAMS Drivers
Initialization of STREAMS drivers is very similar for both the loadable
and statically linked module cases. The only difference is that loadable