root/include/linux/kerneld.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. request_module
  2. release_module
  3. delayed_release_module
  4. cancel_release_module
  5. ksystem
  6. kerneld_route
  7. kerneld_blanker

   1 #ifndef _LINUX_KERNELD_H
   2 #define _LINUX_KERNELD_H
   3 
   4 #define KERNELD_SYSTEM 1
   5 #define KERNELD_REQUEST_MODULE 2 /* "insmod" */
   6 #define KERNELD_RELEASE_MODULE 3 /* "rmmod" */
   7 #define KERNELD_DELAYED_RELEASE_MODULE 4 /* "rmmod" */
   8 #define KERNELD_CANCEL_RELEASE_MODULE 5 /* "rmmod" */
   9 #define KERNELD_REQUEST_ROUTE 6 /* from net/ipv4/route.c */
  10 #define KERNELD_BLANKER 7 /* from drivers/char/console.c */
  11 
  12 #define IPC_KERNELD 00040000   /* use the kerneld message channel */
  13 #define KERNELD_MAXCMD 0x7ffeffff
  14 #define KERNELD_MINSEQ 0x7fff0000 /* "commands" legal up to 0x7ffeffff */
  15 #define KERNELD_WAIT 0x80000000
  16 #define KERNELD_NOWAIT 0
  17 
  18 struct kerneld_msg {
  19         long mtype;
  20         long id;
  21 #ifdef __KERNEL__
  22         char *text;
  23 #else
  24         char text[1];
  25 #endif /* __KERNEL__ */
  26 };
  27 
  28 #ifdef __KERNEL__
  29 extern int kerneld_send(int msgtype, int ret_size, int msgsz,
  30                 const char *text, const char *ret_val);
  31 
  32 /*
  33  * Request that a module should be loaded.
  34  * Wait for the exit status from insmod/modprobe.
  35  * If it fails, it fails... at least we tried...
  36  */
  37 static inline int request_module(const char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  38 {
  39         return kerneld_send(KERNELD_REQUEST_MODULE,
  40                         0 | KERNELD_WAIT,
  41                         strlen(name), name, NULL);
  42 }
  43 
  44 /*
  45  * Request the removal of a module, maybe don't wait for it.
  46  * It doesn't matter if the removal fails, now does it?
  47  */
  48 static inline int release_module(const char *name, int waitflag)
     /* [previous][next][first][last][top][bottom][index][help] */
  49 {
  50         return kerneld_send(KERNELD_RELEASE_MODULE,
  51                         0 | (waitflag?KERNELD_WAIT:KERNELD_NOWAIT),
  52                         strlen(name), name, NULL);
  53 }
  54 
  55 /*
  56  * Request a delayed removal of a module, but don't wait for it.
  57  * The delay is done by kerneld (default: 60 seconds)
  58  */
  59 static inline int delayed_release_module(const char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  60 {
  61         return kerneld_send(KERNELD_DELAYED_RELEASE_MODULE,
  62                         0 | KERNELD_NOWAIT,
  63                         strlen(name), name, NULL);
  64 }
  65 
  66 /*
  67  * Attempt to cancel a previous request for removal of a module,
  68  * but don't wait for it.
  69  * This call can be made if the kernel wants to prevent a delayed
  70  * unloading of a module.
  71  */
  72 static inline int cancel_release_module(const char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  73 {
  74         return kerneld_send(KERNELD_CANCEL_RELEASE_MODULE,
  75                         0 | KERNELD_NOWAIT,
  76                         strlen(name), name, NULL);
  77 }
  78 
  79 /*
  80  * Perform an "inverted" system call, maybe return the exit status
  81  */
  82 static inline int ksystem(const char *cmd, int waitflag)
     /* [previous][next][first][last][top][bottom][index][help] */
  83 {
  84         return kerneld_send(KERNELD_SYSTEM,
  85                         0 | (waitflag?KERNELD_WAIT:KERNELD_NOWAIT),
  86                         strlen(cmd), cmd, NULL);
  87 }
  88 
  89 /*
  90  * Try to create a route, possibly by opening a ppp-connection
  91  */
  92 static inline int kerneld_route(const char *ip_route)
     /* [previous][next][first][last][top][bottom][index][help] */
  93 {
  94         return kerneld_send(KERNELD_REQUEST_ROUTE,
  95                         0 | KERNELD_WAIT,
  96                         strlen(ip_route), ip_route, NULL);
  97 }
  98 
  99 /*
 100  * Handle an external screen blanker
 101  */
 102 static inline int kerneld_blanker(int on_off) /* 0 => "off", else "on" */
     /* [previous][next][first][last][top][bottom][index][help] */
 103 {
 104         return kerneld_send(KERNELD_BLANKER,
 105                         0 | (on_off?KERNELD_NOWAIT:KERNELD_WAIT),
 106                         strlen(on_off?"on":"off"), on_off?"on":"off", NULL);
 107 }
 108 
 109 #endif /* __KERNEL__ */
 110 #endif

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