Managing and Developing Dynamically Loadable Kernel Modules

Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12 541
NOTE The wsio_install_driver() function call returns 1 on success.
However (and inconsistently), the wsio_uninstall_driver()
function call returns 0 on success.
Initialization for a statically linked WSIO class driver is unchanged from
historical practice. That is, the initial driver entry point is
module_name
_install. This function typically installs an _init()
function in a list of functions that will be invoked later in the system boot
process, and then the driver registers itself with WSIO. For example:
Example 12-4 WSIO Class Driver _install Function
static void
module_name
_linked_init (void);
static int (*
module_name
_saved_init)();
/*
* INSTALL
* This function is called if module is statically linked.
*/
int
module_name
_install(void)
{
extern int (*dev_init)(void);
/* Link my init function into chain */
module_name
_saved_init = dev_init;
dev_init = (int (*)()) &
module_name
_linked_init;
/* Register driver with WSIO */
return ( wsio_install_driver(&
module_name
_wsio_info) );
}
The _init() function in the static case must call the next driver's
_init() function: