libata-sff: ap->[last_]ctl are SFF specific
[safe/jmp/linux-2.6] / include / linux / notifier.h
index 10a43ed..fee6c2f 100644 (file)
@@ -112,32 +112,44 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);
 
 #ifdef __KERNEL__
 
-extern int atomic_notifier_chain_register(struct atomic_notifier_head *,
-               struct notifier_block *);
-extern int blocking_notifier_chain_register(struct blocking_notifier_head *,
-               struct notifier_block *);
-extern int raw_notifier_chain_register(struct raw_notifier_head *,
-               struct notifier_block *);
-extern int srcu_notifier_chain_register(struct srcu_notifier_head *,
-               struct notifier_block *);
-
-extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *,
-               struct notifier_block *);
-extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *,
-               struct notifier_block *);
-extern int raw_notifier_chain_unregister(struct raw_notifier_head *,
-               struct notifier_block *);
-extern int srcu_notifier_chain_unregister(struct srcu_notifier_head *,
-               struct notifier_block *);
-
-extern int atomic_notifier_call_chain(struct atomic_notifier_head *,
+extern int atomic_notifier_chain_register(struct atomic_notifier_head *nh,
+               struct notifier_block *nb);
+extern int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
+               struct notifier_block *nb);
+extern int raw_notifier_chain_register(struct raw_notifier_head *nh,
+               struct notifier_block *nb);
+extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
+               struct notifier_block *nb);
+
+extern int blocking_notifier_chain_cond_register(
+               struct blocking_notifier_head *nh,
+               struct notifier_block *nb);
+
+extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
+               struct notifier_block *nb);
+extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,
+               struct notifier_block *nb);
+extern int raw_notifier_chain_unregister(struct raw_notifier_head *nh,
+               struct notifier_block *nb);
+extern int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh,
+               struct notifier_block *nb);
+
+extern int atomic_notifier_call_chain(struct atomic_notifier_head *nh,
                unsigned long val, void *v);
-extern int blocking_notifier_call_chain(struct blocking_notifier_head *,
+extern int __atomic_notifier_call_chain(struct atomic_notifier_head *nh,
+       unsigned long val, void *v, int nr_to_call, int *nr_calls);
+extern int blocking_notifier_call_chain(struct blocking_notifier_head *nh,
                unsigned long val, void *v);
-extern int raw_notifier_call_chain(struct raw_notifier_head *,
+extern int __blocking_notifier_call_chain(struct blocking_notifier_head *nh,
+       unsigned long val, void *v, int nr_to_call, int *nr_calls);
+extern int raw_notifier_call_chain(struct raw_notifier_head *nh,
                unsigned long val, void *v);
-extern int srcu_notifier_call_chain(struct srcu_notifier_head *,
+extern int __raw_notifier_call_chain(struct raw_notifier_head *nh,
+       unsigned long val, void *v, int nr_to_call, int *nr_calls);
+extern int srcu_notifier_call_chain(struct srcu_notifier_head *nh,
                unsigned long val, void *v);
+extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
+       unsigned long val, void *v, int nr_to_call, int *nr_calls);
 
 #define NOTIFY_DONE            0x0000          /* Don't care */
 #define NOTIFY_OK              0x0001          /* Suits me */
@@ -149,6 +161,19 @@ extern int srcu_notifier_call_chain(struct srcu_notifier_head *,
  */
 #define NOTIFY_STOP            (NOTIFY_OK|NOTIFY_STOP_MASK)
 
+/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */
+static inline int notifier_from_errno(int err)
+{
+       return NOTIFY_STOP_MASK | (NOTIFY_OK - err);
+}
+
+/* Restore (negative) errno value from notify return value. */
+static inline int notifier_to_errno(int ret)
+{
+       ret &= ~NOTIFY_STOP_MASK;
+       return ret > NOTIFY_OK ? NOTIFY_OK - ret : 0;
+}
+
 /*
  *     Declared notifiers so far. I can imagine quite a few more chains
  *     over time (eg laptop power reset chains, reboot chain (to clean 
@@ -172,6 +197,12 @@ extern int srcu_notifier_call_chain(struct srcu_notifier_head *,
 #define NETDEV_GOING_DOWN      0x0009
 #define NETDEV_CHANGENAME      0x000A
 #define NETDEV_FEAT_CHANGE     0x000B
+#define NETDEV_BONDING_FAILOVER 0x000C
+#define NETDEV_PRE_UP          0x000D
+#define NETDEV_BONDING_OLDTYPE  0x000E
+#define NETDEV_BONDING_NEWTYPE  0x000F
+#define NETDEV_POST_INIT       0x0010
+#define NETDEV_UNREGISTER_BATCH 0x0011
 
 #define SYS_DOWN       0x0001  /* Notify of system down */
 #define SYS_RESTART    SYS_DOWN
@@ -186,6 +217,57 @@ extern int srcu_notifier_call_chain(struct srcu_notifier_head *,
 #define CPU_DOWN_PREPARE       0x0005 /* CPU (unsigned)v going down */
 #define CPU_DOWN_FAILED                0x0006 /* CPU (unsigned)v NOT going down */
 #define CPU_DEAD               0x0007 /* CPU (unsigned)v dead */
+#define CPU_DYING              0x0008 /* CPU (unsigned)v not running any task,
+                                       * not handling interrupts, soon dead.
+                                       * Called on the dying cpu, interrupts
+                                       * are already disabled. Must not
+                                       * sleep, must not fail */
+#define CPU_POST_DEAD          0x0009 /* CPU (unsigned)v dead, cpu_hotplug
+                                       * lock is dropped */
+#define CPU_STARTING           0x000A /* CPU (unsigned)v soon running.
+                                       * Called on the new cpu, just before
+                                       * enabling interrupts. Must not sleep,
+                                       * must not fail */
+
+/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend
+ * operation in progress
+ */
+#define CPU_TASKS_FROZEN       0x0010
+
+#define CPU_ONLINE_FROZEN      (CPU_ONLINE | CPU_TASKS_FROZEN)
+#define CPU_UP_PREPARE_FROZEN  (CPU_UP_PREPARE | CPU_TASKS_FROZEN)
+#define CPU_UP_CANCELED_FROZEN (CPU_UP_CANCELED | CPU_TASKS_FROZEN)
+#define CPU_DOWN_PREPARE_FROZEN        (CPU_DOWN_PREPARE | CPU_TASKS_FROZEN)
+#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
+#define CPU_DEAD_FROZEN                (CPU_DEAD | CPU_TASKS_FROZEN)
+#define CPU_DYING_FROZEN       (CPU_DYING | CPU_TASKS_FROZEN)
+#define CPU_STARTING_FROZEN    (CPU_STARTING | CPU_TASKS_FROZEN)
+
+/* Hibernation and suspend events */
+#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */
+#define PM_POST_HIBERNATION    0x0002 /* Hibernation finished */
+#define PM_SUSPEND_PREPARE     0x0003 /* Going to suspend the system */
+#define PM_POST_SUSPEND                0x0004 /* Suspend finished */
+#define PM_RESTORE_PREPARE     0x0005 /* Going to restore a saved image */
+#define PM_POST_RESTORE                0x0006 /* Restore failed */
+
+/* Console keyboard events.
+ * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
+ * KBD_KEYSYM. */
+#define KBD_KEYCODE            0x0001 /* Keyboard keycode, called before any other */
+#define KBD_UNBOUND_KEYCODE    0x0002 /* Keyboard keycode which is not bound to any other */
+#define KBD_UNICODE            0x0003 /* Keyboard unicode */
+#define KBD_KEYSYM             0x0004 /* Keyboard keysym */
+#define KBD_POST_KEYSYM                0x0005 /* Called after keyboard keysym interpretation */
+
+extern struct blocking_notifier_head reboot_notifier_list;
+
+/* Virtual Terminal events. */
+#define VT_ALLOCATE            0x0001 /* Console got allocated */
+#define VT_DEALLOCATE          0x0002 /* Console will be deallocated */
+#define VT_WRITE               0x0003 /* A char got output */
+#define VT_UPDATE              0x0004 /* A bigger update occurred */
+#define VT_PREWRITE            0x0005 /* A char is about to be written to the console */
 
 #endif /* __KERNEL__ */
 #endif /* _LINUX_NOTIFIER_H */