3 |
* |
* |
4 |
* Copyright (C) 2005-2009 NTT DATA CORPORATION |
* Copyright (C) 2005-2009 NTT DATA CORPORATION |
5 |
* |
* |
6 |
* Version: 1.7.0-pre 2009/08/08 |
* Version: 1.7.0-pre 2009/08/24 |
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. |
80 |
#endif |
#endif |
81 |
|
|
82 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) |
83 |
#define kzalloc(size, flags) ({ \ |
#define kzalloc(size, flags) ({ \ |
84 |
void *ret = kmalloc((size), (flags)); \ |
void *ret = kmalloc((size), (flags)); \ |
85 |
if (ret) \ |
if (ret) \ |
86 |
memset(ret, 0, (size)); \ |
memset(ret, 0, (size)); \ |
87 |
ret; }) |
ret; }) |
88 |
#endif |
#endif |
89 |
|
|
96 |
#endif |
#endif |
97 |
|
|
98 |
#ifndef rcu_dereference |
#ifndef rcu_dereference |
99 |
#define rcu_dereference(p) ({ \ |
#define rcu_dereference(p) ({ \ |
100 |
typeof(p) _________p1 = ACCESS_ONCE(p); \ |
typeof(p) _________p1 = ACCESS_ONCE(p); \ |
101 |
smp_read_barrier_depends(); /* see RCU */ \ |
smp_read_barrier_depends(); /* see RCU */ \ |
102 |
(_________p1); \ |
(_________p1); \ |
103 |
}) |
}) |
104 |
#endif |
#endif |
105 |
|
|
106 |
#ifndef rcu_assign_pointer |
#ifndef rcu_assign_pointer |
107 |
#define rcu_assign_pointer(p, v) \ |
#define rcu_assign_pointer(p, v) \ |
108 |
({ \ |
({ \ |
109 |
if (!__builtin_constant_p(v) || \ |
if (!__builtin_constant_p(v) || \ |
110 |
((v) != NULL)) \ |
((v) != NULL)) \ |
111 |
smp_wmb(); /* see RCU */ \ |
smp_wmb(); /* see RCU */ \ |
112 |
(p) = (v); \ |
(p) = (v); \ |
113 |
}) |
}) |
114 |
#endif |
#endif |
115 |
|
|
116 |
#ifndef list_for_each_rcu |
#ifndef list_for_each_rcu |
117 |
#define list_for_each_rcu(pos, head) \ |
#define list_for_each_rcu(pos, head) \ |
118 |
for (pos = rcu_dereference((head)->next); \ |
for (pos = rcu_dereference((head)->next); \ |
119 |
prefetch(pos->next), pos != (head); \ |
prefetch(pos->next), pos != (head); \ |
120 |
pos = rcu_dereference(pos->next)) |
pos = rcu_dereference(pos->next)) |
121 |
#endif |
#endif |
122 |
|
|
123 |
#ifndef list_for_each_entry_rcu |
#ifndef list_for_each_entry_rcu |
124 |
#define list_for_each_entry_rcu(pos, head, member) \ |
#define list_for_each_entry_rcu(pos, head, member) \ |
125 |
for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), \ |
for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), \ |
126 |
member); \ |
member); \ |
127 |
prefetch(pos->member.next), &pos->member != (head); \ |
prefetch(pos->member.next), &pos->member != (head); \ |
128 |
pos = list_entry(rcu_dereference(pos->member.next), \ |
pos = list_entry(rcu_dereference(pos->member.next), \ |
129 |
typeof(*pos), member)) |
typeof(*pos), member)) |
130 |
#endif |
#endif |
131 |
|
|
132 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) |
164 |
|
|
165 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 30) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 30) |
166 |
#undef ssleep |
#undef ssleep |
167 |
#define ssleep(secs) { \ |
#define ssleep(secs) { \ |
168 |
set_current_state(TASK_UNINTERRUPTIBLE); \ |
set_current_state(TASK_UNINTERRUPTIBLE); \ |
169 |
schedule_timeout((HZ * secs) + 1); \ |
schedule_timeout((HZ * secs) + 1); \ |
170 |
} |
} |
171 |
#endif |
#endif |
172 |
|
|
173 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) |
207 |
|
|
208 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) |
209 |
#if defined(__LITTLE_ENDIAN) |
#if defined(__LITTLE_ENDIAN) |
210 |
#define HIPQUAD(addr) \ |
#define HIPQUAD(addr) \ |
211 |
((unsigned char *)&addr)[3], \ |
((unsigned char *)&addr)[3], \ |
212 |
((unsigned char *)&addr)[2], \ |
((unsigned char *)&addr)[2], \ |
213 |
((unsigned char *)&addr)[1], \ |
((unsigned char *)&addr)[1], \ |
214 |
((unsigned char *)&addr)[0] |
((unsigned char *)&addr)[0] |
215 |
#elif defined(__BIG_ENDIAN) |
#elif defined(__BIG_ENDIAN) |
216 |
#define HIPQUAD NIPQUAD |
#define HIPQUAD NIPQUAD |
217 |
#else |
#else |
240 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) |
241 |
|
|
242 |
struct path { |
struct path { |
243 |
struct vfsmount *mnt; |
struct vfsmount *mnt; |
244 |
struct dentry *dentry; |
struct dentry *dentry; |
245 |
}; |
}; |
246 |
|
|
247 |
#endif |
#endif |