blob: f1fc461b0acc45b96d78f9f09b8ef2eca726b1bb [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/****************************************************************************
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>
Ben Cheng4b29af02012-03-07 16:14:53 -080017
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018struct notifier_block {
19 int (*notifier_call)(struct notifier_block *, unsigned long, void *);
20 struct notifier_block *next;
21 int priority;
22};
Ben Cheng4b29af02012-03-07 16:14:53 -080023
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080024struct atomic_notifier_head {
25 spinlock_t lock;
26 struct notifier_block *head;
27};
Ben Cheng4b29af02012-03-07 16:14:53 -080028
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029struct blocking_notifier_head {
30 struct rw_semaphore rwsem;
31 struct notifier_block *head;
32};
Ben Cheng4b29af02012-03-07 16:14:53 -080033
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034struct raw_notifier_head {
35 struct notifier_block *head;
36};
Ben Cheng4b29af02012-03-07 16:14:53 -080037
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080038#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)
Ben Cheng4b29af02012-03-07 16:14:53 -080041
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080042#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 }
Ben Cheng4b29af02012-03-07 16:14:53 -080045
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080046#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)
Ben Cheng4b29af02012-03-07 16:14:53 -080049
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080050#endif