home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / Include / Linux / module.h < prev    next >
C/C++ Source or Header  |  2002-04-26  |  2KB  |  98 lines

  1. /* $Id: module.h,v 1.2 2002/04/26 23:09:11 smilcke Exp $ */
  2.  
  3. /*
  4.  * Dynamic loading of modules into the kernel.
  5.  *
  6.  * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996
  7.  */
  8.  
  9. #ifndef _LINUX_MODULE_H
  10. #define _LINUX_MODULE_H
  11.  
  12. /* Poke the use count of a module.  */
  13.  
  14. #define MOD_INC_USE_COUNT
  15. #define MOD_DEC_USE_COUNT
  16. #define MOD_IN_USE
  17.  
  18. #define EXPORT_NO_SYMBOLS
  19.  
  20. #define __MODULE_STRING_1(x)    #x
  21. #define __MODULE_STRING(x)    __MODULE_STRING_1(x)
  22.  
  23. /* For documentation purposes only.  */
  24.  
  25. #define MODULE_AUTHOR(name)                           \
  26. const char __module_author[] =        \
  27. "author=" name
  28.  
  29. #define MODULE_DESCRIPTION(desc)                       \
  30. const char __module_description[] =   \
  31. "description=" desc
  32.  
  33. /* Could potentially be used by kmod...  */
  34.  
  35. #define MODULE_SUPPORTED_DEVICE(dev)                       \
  36. const char __module_device[] =        \
  37. "device=" dev
  38.  
  39. /* Used to verify parameters given to the module.  The TYPE arg should
  40.    be a string in the following format:
  41.        [min[-max]]{b,h,i,l,s}
  42.    The MIN and MAX specifiers delimit the length of the array.  If MAX
  43.    is omitted, it defaults to MIN; if both are omitted, the default is 1.
  44.    The final character is a type specifier:
  45.     b    byte
  46.     h    short
  47.     i    int
  48.     l    long
  49.     s    string
  50. */
  51.  
  52. #ifndef TARGET_OS2
  53. #define MODULE_PARM(var,type)            \
  54. const char __module_parm_##var[]=        \
  55. "parm_" __MODULE_STRING(var) "=" type
  56. #endif
  57.  
  58. #define MODULE_PARM_DESC(var,desc)        \
  59. const char __module_parm_desc_##var[]=        \
  60. "parm_desc_" __MODULE_STRING(var) "=" desc
  61.  
  62. #ifdef TARGET_OS2
  63. struct os2lx_parm
  64. {
  65. // char name[32];
  66. // char type[10];
  67.  char *name;
  68.  char *type;
  69.  void *adress;
  70. };
  71.  
  72. struct os2lx_module
  73. {
  74.  char name[32];
  75.  int active;
  76.  int (*init_fn)(void);
  77.  void (*cleanup_fn)(void);
  78.  struct os2lx_parm **modParms;
  79.  int *numModParms;
  80. };
  81.  
  82. #define MODULE_PARM_LIST_HEAD(name) \
  83. struct os2lx_parm name[]={
  84.  
  85. #define MODULE_PARM(var,type) \
  86. {#var,type,&var},
  87.  
  88. #define MODULE_PARM_LIST_TAIL(name) \
  89. };\
  90. int num_##name=sizeof(name)/sizeof(struct os2lx_parm);
  91.  
  92. #define MODULE_PARM_NUM(name) \
  93. num_##name
  94.  
  95. #endif
  96.  
  97. #endif /* _LINUX_MODULE_H */
  98.