root/include/linux/module.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Dynamic loading of modules into the kernel.
   3  *
   4  * Modified by Bjorn Ekwall <bj0rn@blox.se>
   5  */
   6 
   7 #ifndef _LINUX_MODULE_H
   8 #define _LINUX_MODULE_H
   9 
  10 #ifdef __GENKSYMS__
  11 #  define _set_ver(sym,vers) sym
  12 #  undef  MODVERSIONS
  13 #  define MODVERSIONS
  14 #else /* ! __GENKSYMS__ */
  15 # ifdef MODVERSIONS
  16 #  ifndef MODULE
  17 #   ifdef EXPORT_SYMTAB
  18 #    define _set_ver(sym,vers) sym
  19 #    include <linux/modversions.h>
  20 #   endif /* EXPORT_SYMTAB */
  21 #  endif /* MODULE */
  22 # endif /* MODVERSIONS */
  23 #endif /* __GENKSYMS__ */
  24 
  25 /* values of module.state */
  26 #define MOD_UNINITIALIZED 0
  27 #define MOD_RUNNING 1
  28 #define MOD_DELETED 2
  29 
  30 /* maximum length of module name */
  31 #define MOD_MAX_NAME 64
  32 
  33 /* maximum length of symbol name */
  34 #define SYM_MAX_NAME 60
  35 
  36 struct kernel_sym { /* sent to "insmod" */
  37         unsigned long value;            /* value of symbol */
  38         char name[SYM_MAX_NAME];        /* name of symbol */
  39 };
  40 
  41 struct module_ref {
  42         struct module *module;
  43         struct module_ref *next;
  44 };
  45 
  46 struct internal_symbol {
  47         void *addr;
  48         const char *name;
  49         };
  50 
  51 struct symbol_table { /* received from "insmod" */
  52         int size; /* total, including string table!!! */
  53         int n_symbols;
  54         int n_refs;
  55         struct internal_symbol symbol[0]; /* actual size defined by n_symbols */
  56         struct module_ref ref[0]; /* actual size defined by n_refs */
  57 };
  58 /*
  59  * Note: The string table follows immediately after the symbol table in memory!
  60  */
  61 
  62 struct module {
  63         struct module *next;
  64         struct module_ref *ref; /* the list of modules that refer to me */
  65         struct symbol_table *symtab;
  66         const char *name;
  67         int size;                       /* size of module in pages */
  68         void* addr;                     /* address of module */
  69         int state;
  70         void (*cleanup)(void);          /* cleanup routine */
  71 };
  72 
  73 struct mod_routines {
  74         int (*init)(void);              /* initialization routine */
  75         void (*cleanup)(void);          /* cleanup routine */
  76 };
  77 
  78 /* rename_module_symbol(old_name, new_name)  WOW! */
  79 extern int rename_module_symbol(char *, char *);
  80 
  81 /* insert new symbol table */
  82 extern int register_symtab(struct symbol_table *);
  83 
  84 /*
  85  * The first word of the module contains the use count.
  86  */
  87 #define GET_USE_COUNT(module)   (* (long *) (module)->addr)
  88 /*
  89  * define the count variable, and usage macros.
  90  */
  91 
  92 #ifdef MODULE
  93 
  94 extern long mod_use_count_;
  95 #define MOD_INC_USE_COUNT      mod_use_count_++
  96 #define MOD_DEC_USE_COUNT      mod_use_count_--
  97 #define MOD_IN_USE             (mod_use_count_ != 0)
  98 
  99 #ifndef __NO_VERSION__
 100 #include <linux/version.h>
 101 char kernel_version[]=UTS_RELEASE;
 102 #endif
 103 
 104 #if defined(MODVERSIONS) && !defined(__GENKSYMS__)
 105 int Using_Versions; /* gcc will handle this global (used as a flag) correctly */
 106 #endif
 107 
 108 #else
 109 
 110 #define MOD_INC_USE_COUNT       do { } while (0)
 111 #define MOD_DEC_USE_COUNT       do { } while (0)
 112 #define MOD_IN_USE              1
 113 
 114 #endif
 115 
 116 #endif

/* [previous][next][first][last][top][bottom][index][help] */