Listing 4. Simple Module

#if defined(CONFIG_MODVERSIONS)
#define MODVERSIONS
#include <linux/modversions.h>
#endif

#include <linux/version.h>
#include <linux/wrapper.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/ioport.h>

#define MOD "simple"
#define SUCCESS 0
#define FAILURE -1

int init_module(void) {


  printk(KERN_ALERT"\nThe kernel module %s", MOD);
  printk(KERN_ALERT" has been loaded.\n");

  return SUCCESS;

} // end function init_module

void cleanup_module (void) {

  printk(KERN_ALERT"\nThe kernel module %s",MOD);
  printk(KERN_ALERT"has been removed.\n");

} // end function cleanup_module