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 /* values of module.state */
  11 #define MOD_UNINITIALIZED 0
  12 #define MOD_RUNNING 1
  13 #define MOD_DELETED 2
  14 
  15 /* maximum length of module name */
  16 #define MOD_MAX_NAME 64
  17 
  18 /* maximum length of symbol name */
  19 #define SYM_MAX_NAME 60
  20 
  21 struct kernel_sym { /* sent to "insmod" */
  22         unsigned long value;            /* value of symbol */
  23         char name[SYM_MAX_NAME];        /* name of symbol */
  24 };
  25 
  26 struct module_ref {
  27         struct module *module;
  28         struct module_ref *next;
  29 };
  30 
  31 struct internal_symbol {
  32         void *addr;
  33         char *name;
  34         };
  35 
  36 struct symbol_table { /* received from "insmod" */
  37         int size; /* total, including string table!!! */
  38         int n_symbols;
  39         int n_refs;
  40         struct internal_symbol symbol[0]; /* actual size defined by n_symbols */
  41         struct module_ref ref[0]; /* actual size defined by n_refs */
  42 };
  43 /*
  44  * Note: The string table follows immediately after the symbol table in memory!
  45  */
  46 
  47 struct module {
  48         struct module *next;
  49         struct module_ref *ref; /* the list of modules that refer to me */
  50         struct symbol_table *symtab;
  51         char *name;
  52         int size;                       /* size of module in pages */
  53         void* addr;                     /* address of module */
  54         int state;
  55         void (*cleanup)(void);          /* cleanup routine */
  56 };
  57 
  58 struct mod_routines {
  59         int (*init)(void);              /* initialization routine */
  60         void (*cleanup)(void);          /* cleanup routine */
  61 };
  62 
  63 /* rename_module_symbol(old_name, new_name)  WOW! */
  64 extern int rename_module_symbol(char *, char *);
  65 
  66 
  67 /*
  68  * The first word of the module contains the use count.
  69  */
  70 #define GET_USE_COUNT(module)   (* (int *) (module)->addr)
  71 /*
  72  * define the count variable, and usage macros.
  73  */
  74 
  75 extern int mod_use_count_;
  76 
  77 #define MOD_INC_USE_COUNT      mod_use_count_++
  78 #define MOD_DEC_USE_COUNT      mod_use_count_--
  79 #define MOD_IN_USE             (mod_use_count_ != 0)
  80 
  81 #endif

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