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

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