Managing and Developing Dynamically Loadable Kernel Modules

Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12532
ml_type_data – pointer to a mod_type_data structure
The elements of the mod_type_data structure are:
mtd_info – information string returned to modstat() system call
mtd_pdata – pointer to type-specific data that depend on the type of
loadable module being defined: for both STREAMS drivers and
STREAMS modules, use a pointer to the streams_info_t structure;
for all other types, use (void *)NULL
A sample wrapper for a WSIO driver is as follows:
Example 12-2 WSIO Driver Wrapper—Example
/*
* Wrapper Table
*/
extern struct mod_operations gio_mod_ops;
static drv_info_t
module_name
_drv_info;
extern struct mod_conf_data
module_name
_conf_data;
/* module type specific data */
static struct mod_type_data
module_name
_drv_link = {
module_name
- Loadable/Unloadable Test Module”,
(void *)NULL
};
static struct modlink
module_name
_mod_link[] = {
{ &gio_mod_ops, (void *)&
module_name
_drv_link },
/* WSIO */
{ NULL, (void *)NULL }
};
Table 12-3
Module Operations DLKM Module Type
gio_mod_ops WSIO class driver
gio_mod_ops WSIO interface driver
str_drv_ops STREAMS driver
str_mod_ops STREAMS module
mod_misc_ops Miscellaneous module