The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | **************************************************************************** |
| 11 | ****************************************************************************/ |
| 12 | #ifndef _LINUX_NOTIFIER_H |
| 13 | #define _LINUX_NOTIFIER_H |
| 14 | #include <linux/errno.h> |
| 15 | #include <linux/mutex.h> |
| 16 | #include <linux/rwsem.h> |
| 17 | |
| 18 | struct notifier_block { |
| 19 | int (*notifier_call)(struct notifier_block *, unsigned long, void *); |
| 20 | struct notifier_block *next; |
| 21 | int priority; |
| 22 | }; |
| 23 | |
| 24 | struct atomic_notifier_head { |
| 25 | spinlock_t lock; |
| 26 | struct notifier_block *head; |
| 27 | }; |
| 28 | |
| 29 | struct blocking_notifier_head { |
| 30 | struct rw_semaphore rwsem; |
| 31 | struct notifier_block *head; |
| 32 | }; |
| 33 | |
| 34 | struct raw_notifier_head { |
| 35 | struct notifier_block *head; |
| 36 | }; |
| 37 | |
| 38 | #define ATOMIC_INIT_NOTIFIER_HEAD(name) do { spin_lock_init(&(name)->lock); (name)->head = NULL; } while (0) |
| 39 | #define BLOCKING_INIT_NOTIFIER_HEAD(name) do { init_rwsem(&(name)->rwsem); (name)->head = NULL; } while (0) |
| 40 | #define RAW_INIT_NOTIFIER_HEAD(name) do { (name)->head = NULL; } while (0) |
| 41 | |
| 42 | #define ATOMIC_NOTIFIER_INIT(name) { .lock = __SPIN_LOCK_UNLOCKED(name.lock), .head = NULL } |
| 43 | #define BLOCKING_NOTIFIER_INIT(name) { .rwsem = __RWSEM_INITIALIZER((name).rwsem), .head = NULL } |
| 44 | #define RAW_NOTIFIER_INIT(name) { .head = NULL } |
| 45 | |
| 46 | #define ATOMIC_NOTIFIER_HEAD(name) struct atomic_notifier_head name = ATOMIC_NOTIFIER_INIT(name) |
| 47 | #define BLOCKING_NOTIFIER_HEAD(name) struct blocking_notifier_head name = BLOCKING_NOTIFIER_INIT(name) |
| 48 | #define RAW_NOTIFIER_HEAD(name) struct raw_notifier_head name = RAW_NOTIFIER_INIT(name) |
| 49 | |
| 50 | #endif |