Академический Документы
Профессиональный Документы
Культура Документы
files
which
are
used
to
contains
interfaces
for
initialization
sequence
Initialization routine of
a module
void cleanup_module(void)
{
printk("%s : Module Detached\n",__func__);
}
Exit routine of a
module
now can go to anyone who understands the source for help, need
not go to only that particular author. Free term in open source
community means freedom to access of source.
Module can be either copy left or copyright, if I specify
proprietary the license will become copyright. Specifying Module
license is mandatory, default is proprietary and Linux will throw
a warning module license not specified.
Modules can use appropriate commenting MACROs to retain
essential code information and description into binary file.
Module.h provides various macros for this.
For Ex.:
of
Module>);
MODULE_LICENSE (<license>);
Modules can be composed of various data and functions.
Module is the means of loading something into kernel.
Module itself is not a driver. A body of module can be a driver.
Body of a module can be a file system. What we are trying to add
to kernel is the body of a module. Module is the means of loading
a service dynamically. The service is then referred to as body of a
module. Its the carrier through which we are loading some pay
load (Service). This part of the code will repeat in every module
only body will change depending on what we are trying to do.
Module is not a process its a carrier, it is a method to wrap some
code and carry into kernel space. In the below example body is a
func ().
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/version.h>
void func(void)
{
printk("%s : Body of the Module\n",__func__);
}
int init_module(void)
{
printk("%s : Module inserted\n",__func__);
return 0;
}
Initialization routine of
a module
void cleanup_module(void)
{
printk("%s : Module Detached\n",__func__);
}
Exit routine of a
module