summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorWilliam Lee Irwin III <wli@holomorphy.com>2004-10-18 17:59:41 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-18 17:59:41 -0700
commitfd4d36bf0d54e0b020b8ffeddf7552562eab17c5 (patch)
treecdae6036e287c806a7bae414b47ec4993ef2d471 /include/linux
parentd79889923f9c04f6f5592851dc3033236756c5dc (diff)
[PATCH] standardize bit waiting data type
Eliminate specialized page and bh waitqueue hashing structures in favor of a standardized structure, using wake_up_bit() to wake waiters using the standardized wait_bit_key structure. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/wait.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 21cd4df67b24..82068628327f 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -37,6 +37,16 @@ struct __wait_queue {
struct list_head task_list;
};
+struct wait_bit_key {
+ void *flags;
+ int bit_nr;
+};
+
+struct wait_bit_queue {
+ struct wait_bit_key key;
+ wait_queue_t wait;
+};
+
struct __wait_queue_head {
spinlock_t lock;
struct list_head task_list;
@@ -63,6 +73,9 @@ typedef struct __wait_queue_head wait_queue_head_t;
#define DECLARE_WAIT_QUEUE_HEAD(name) \
wait_queue_head_t name = __WAIT_QUEUE_HEAD_INITIALIZER(name)
+#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
+ { .flags = word, .bit_nr = bit, }
+
static inline void init_waitqueue_head(wait_queue_head_t *q)
{
q->lock = SPIN_LOCK_UNLOCKED;
@@ -125,6 +138,7 @@ static inline void __remove_wait_queue(wait_queue_head_t *head,
void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key));
extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode));
extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr));
+void FASTCALL(__wake_up_bit(wait_queue_head_t *, void *, int));
#define wake_up(x) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL)
#define wake_up_nr(x, nr) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL)
@@ -300,6 +314,7 @@ void FASTCALL(prepare_to_wait_exclusive(wait_queue_head_t *q,
wait_queue_t *wait, int state));
void FASTCALL(finish_wait(wait_queue_head_t *q, wait_queue_t *wait));
int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
+int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
#define DEFINE_WAIT(name) \
wait_queue_t name = { \
@@ -310,6 +325,17 @@ int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *
}, \
}
+#define DEFINE_WAIT_BIT(name, word, bit) \
+ struct wait_bit_queue name = { \
+ .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
+ .wait = { \
+ .task = current, \
+ .func = wake_bit_function, \
+ .task_list = \
+ LIST_HEAD_INIT(name.wait.task_list), \
+ }, \
+ }
+
#define init_wait(wait) \
do { \
wait->task = current; \