Rev 6936 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6936 | serge | 1 | /* |
2 | * Routines to manage notifier chains for passing status changes to any |
||
3 | * interested routines. We need this instead of hard coded call lists so |
||
4 | * that modules can poke their nose into the innards. The network devices |
||
5 | * needed them so here they are for the rest of you. |
||
6 | * |
||
7 | * Alan Cox |
||
8 | */ |
||
7143 | serge | 9 | |
6936 | serge | 10 | #ifndef _LINUX_NOTIFIER_H |
11 | #define _LINUX_NOTIFIER_H |
||
12 | #include |
||
13 | #include |
||
14 | #include |
||
15 | /* |
||
16 | * Notifier chains are of four types: |
||
17 | * |
||
18 | * Atomic notifier chains: Chain callbacks run in interrupt/atomic |
||
19 | * context. Callouts are not allowed to block. |
||
20 | * Blocking notifier chains: Chain callbacks run in process context. |
||
21 | * Callouts are allowed to block. |
||
22 | * Raw notifier chains: There are no restrictions on callbacks, |
||
23 | * registration, or unregistration. All locking and protection |
||
24 | * must be provided by the caller. |
||
25 | * SRCU notifier chains: A variant of blocking notifier chains, with |
||
26 | * the same restrictions. |
||
27 | * |
||
28 | * atomic_notifier_chain_register() may be called from an atomic context, |
||
29 | * but blocking_notifier_chain_register() and srcu_notifier_chain_register() |
||
30 | * must be called from a process context. Ditto for the corresponding |
||
31 | * _unregister() routines. |
||
32 | * |
||
33 | * atomic_notifier_chain_unregister(), blocking_notifier_chain_unregister(), |
||
34 | * and srcu_notifier_chain_unregister() _must not_ be called from within |
||
35 | * the call chain. |
||
36 | * |
||
37 | * SRCU notifier chains are an alternative form of blocking notifier chains. |
||
38 | * They use SRCU (Sleepable Read-Copy Update) instead of rw-semaphores for |
||
39 | * protection of the chain links. This means there is _very_ low overhead |
||
40 | * in srcu_notifier_call_chain(): no cache bounces and no memory barriers. |
||
41 | * As compensation, srcu_notifier_chain_unregister() is rather expensive. |
||
42 | * SRCU notifier chains should be used when the chain will be called very |
||
43 | * often but notifier_blocks will seldom be removed. Also, SRCU notifier |
||
44 | * chains are slightly more difficult to use because they require special |
||
45 | * runtime initialization. |
||
46 | */ |
||
47 | |||
48 | struct notifier_block; |
||
49 | |||
50 | typedef int (*notifier_fn_t)(struct notifier_block *nb, |
||
51 | unsigned long action, void *data); |
||
52 | |||
53 | struct notifier_block { |
||
54 | notifier_fn_t notifier_call; |
||
55 | struct notifier_block __rcu *next; |
||
56 | int priority; |
||
57 | }; |
||
58 | |||
59 | /* Console keyboard events. |
||
60 | * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and |
||
61 | * KBD_KEYSYM. */ |
||
62 | #define KBD_KEYCODE 0x0001 /* Keyboard keycode, called before any other */ |
||
63 | #define KBD_UNBOUND_KEYCODE 0x0002 /* Keyboard keycode which is not bound to any other */ |
||
64 | #define KBD_UNICODE 0x0003 /* Keyboard unicode */ |
||
65 | #define KBD_KEYSYM 0x0004 /* Keyboard keysym */ |
||
66 | #define KBD_POST_KEYSYM 0x0005 /* Called after keyboard keysym interpretation */ |
||
67 | |||
68 | |||
69 | #endif /* _LINUX_NOTIFIER_H */ |