3 |
* |
* |
4 |
* Copyright (C) 2005-2010 NTT DATA CORPORATION |
* Copyright (C) 2005-2010 NTT DATA CORPORATION |
5 |
* |
* |
6 |
* Version: 1.8.0-pre 2010/09/01 |
* Version: 1.8.0-pre 2010/10/05 |
7 |
* |
* |
8 |
* This file is applicable to both 2.4.30 and 2.6.11 and later. |
* This file is applicable to both 2.4.30 and 2.6.11 and later. |
9 |
* See README.ccs for ChangeLog. |
* See README.ccs for ChangeLog. |
109 |
}) |
}) |
110 |
#endif |
#endif |
111 |
|
|
112 |
#ifndef list_for_each_entry_rcu |
#ifndef srcu_dereference |
113 |
#define list_for_each_entry_rcu(pos, head, member) \ |
#define srcu_dereference(p, ss) rcu_dereference(p) |
|
for (pos = list_entry(rcu_dereference((head)->next), \ |
|
|
typeof(*pos), member); \ |
|
|
prefetch(pos->member.next), &pos->member != (head); \ |
|
|
pos = list_entry(rcu_dereference(pos->member.next), \ |
|
|
typeof(*pos), member)) |
|
114 |
#endif |
#endif |
115 |
|
|
116 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) |
#ifndef list_for_each_entry_srcu |
117 |
#undef list_for_each_entry_rcu |
#define list_for_each_entry_srcu(pos, head, member, ss) \ |
118 |
#define list_for_each_entry_rcu(pos, head, member) \ |
for (pos = list_entry(srcu_dereference((head)->next, ss), \ |
119 |
for (pos = list_entry(srcu_dereference((head)->next, &ccs_ss), \ |
typeof(*pos), member); \ |
120 |
typeof(*pos), member); \ |
prefetch(pos->member.next), &pos->member != (head); \ |
121 |
prefetch(pos->member.next), &pos->member != (head); \ |
pos = list_entry(srcu_dereference(pos->member.next, ss), \ |
|
pos = list_entry(srcu_dereference(pos->member.next, &ccs_ss), \ |
|
122 |
typeof(*pos), member)) |
typeof(*pos), member)) |
123 |
#endif |
#endif |
124 |
|
|
155 |
} |
} |
156 |
#endif |
#endif |
157 |
|
|
158 |
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) |
159 |
|
#define __wait_event_interruptible_timeout(wq, condition, ret) \ |
160 |
|
do { \ |
161 |
|
wait_queue_t __wait; \ |
162 |
|
init_waitqueue_entry(&__wait, current); \ |
163 |
|
\ |
164 |
|
add_wait_queue(&wq, &__wait); \ |
165 |
|
for (;;) { \ |
166 |
|
set_current_state(TASK_INTERRUPTIBLE); \ |
167 |
|
if (condition) \ |
168 |
|
break; \ |
169 |
|
if (!signal_pending(current)) { \ |
170 |
|
ret = schedule_timeout(ret); \ |
171 |
|
if (!ret) \ |
172 |
|
break; \ |
173 |
|
continue; \ |
174 |
|
} \ |
175 |
|
ret = -ERESTARTSYS; \ |
176 |
|
break; \ |
177 |
|
} \ |
178 |
|
current->state = TASK_RUNNING; \ |
179 |
|
remove_wait_queue(&wq, &__wait); \ |
180 |
|
} while (0) |
181 |
|
|
182 |
|
#define wait_event_interruptible_timeout(wq, condition, timeout) \ |
183 |
|
({ \ |
184 |
|
long __ret = timeout; \ |
185 |
|
if (!(condition)) \ |
186 |
|
__wait_event_interruptible_timeout(wq, condition, __ret); \ |
187 |
|
__ret; \ |
188 |
|
}) |
189 |
|
#endif |
190 |
|
|
191 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 30) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 30) |
192 |
#undef ssleep |
#undef ssleep |
193 |
#define ssleep(secs) { \ |
#define ssleep(secs) { \ |
194 |
set_current_state(TASK_UNINTERRUPTIBLE); \ |
set_current_state(TASK_UNINTERRUPTIBLE); \ |
195 |
|
schedule_timeout((HZ * secs) + 1); \ |
196 |
|
} |
197 |
|
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 9) |
198 |
|
#undef ssleep |
199 |
|
#define ssleep(secs) { \ |
200 |
|
set_current_state(TASK_UNINTERRUPTIBLE); \ |
201 |
schedule_timeout((HZ * secs) + 1); \ |
schedule_timeout((HZ * secs) + 1); \ |
202 |
} |
} |
203 |
#endif |
#endif |