1 |
/* |
/* |
2 |
* security/ccsecurity/compat.h |
* security/ccsecurity/compat.h |
3 |
* |
* |
4 |
* Copyright (C) 2005-2009 NTT DATA CORPORATION |
* Copyright (C) 2005-2010 NTT DATA CORPORATION |
5 |
* |
* |
6 |
* Version: 1.7.0-pre 2009/08/24 |
* Version: 1.7.2 2010/04/01 |
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. |
58 |
#define KERN_CONT "" |
#define KERN_CONT "" |
59 |
#endif |
#endif |
60 |
|
|
|
/* To support PID namespace. */ |
|
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) |
|
|
#define find_task_by_pid find_task_by_vpid |
|
|
#endif |
|
|
|
|
61 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) |
62 |
#define mutex semaphore |
#define mutex semaphore |
63 |
#define mutex_init(mutex) init_MUTEX(mutex) |
#define mutex_init(mutex) init_MUTEX(mutex) |
|
#define mutex_lock(mutex) down(mutex) |
|
64 |
#define mutex_unlock(mutex) up(mutex) |
#define mutex_unlock(mutex) up(mutex) |
65 |
|
#define mutex_lock(mutex) down(mutex) |
66 |
#define mutex_lock_interruptible(mutex) down_interruptible(mutex) |
#define mutex_lock_interruptible(mutex) down_interruptible(mutex) |
67 |
#define mutex_trylock(mutex) !down_trylock(mutex) |
#define mutex_trylock(mutex) (!down_trylock(mutex)) |
68 |
#define DEFINE_MUTEX(mutexname) DECLARE_MUTEX(mutexname) |
#define DEFINE_MUTEX(mutexname) DECLARE_MUTEX(mutexname) |
69 |
#endif |
#endif |
70 |
|
|
108 |
}) |
}) |
109 |
#endif |
#endif |
110 |
|
|
111 |
#ifndef list_for_each_rcu |
#ifndef list_for_each_entry_rcu |
112 |
#define list_for_each_rcu(pos, head) \ |
#define list_for_each_entry_rcu(pos, head, member) \ |
113 |
for (pos = rcu_dereference((head)->next); \ |
for (pos = list_entry(rcu_dereference((head)->next), \ |
114 |
prefetch(pos->next), pos != (head); \ |
typeof(*pos), member); \ |
115 |
pos = rcu_dereference(pos->next)) |
prefetch(pos->member.next), &pos->member != (head); \ |
116 |
|
pos = list_entry(rcu_dereference(pos->member.next), \ |
117 |
|
typeof(*pos), member)) |
118 |
#endif |
#endif |
119 |
|
|
120 |
#ifndef list_for_each_entry_rcu |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) |
121 |
#define list_for_each_entry_rcu(pos, head, member) \ |
#undef list_for_each_entry_rcu |
122 |
for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), \ |
#define list_for_each_entry_rcu(pos, head, member) \ |
123 |
member); \ |
for (pos = list_entry(srcu_dereference((head)->next, &ccs_ss), \ |
124 |
prefetch(pos->member.next), &pos->member != (head); \ |
typeof(*pos), member); \ |
125 |
pos = list_entry(rcu_dereference(pos->member.next), \ |
prefetch(pos->member.next), &pos->member != (head); \ |
126 |
|
pos = list_entry(srcu_dereference(pos->member.next, &ccs_ss), \ |
127 |
typeof(*pos), member)) |
typeof(*pos), member)) |
128 |
#endif |
#endif |
129 |
|
|
170 |
|
|
171 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) |
172 |
#define s_fs_info u.generic_sbp |
#define s_fs_info u.generic_sbp |
|
#else |
|
|
#include <linux/audit.h> |
|
|
#ifdef AUDIT_APPARMOR_AUDIT |
|
|
/* AppArmor patch adds "struct vfsmount" to VFS helper functions. */ |
|
|
#define HAVE_VFSMOUNT_IN_VFS_HELPER |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#if defined(RHEL_MAJOR) && RHEL_MAJOR == 5 |
|
|
#define HAVE_NO_I_BLKSIZE_IN_INODE |
|
|
#elif defined(AX_MAJOR) && AX_MAJOR == 3 |
|
|
#define HAVE_NO_I_BLKSIZE_IN_INODE |
|
173 |
#endif |
#endif |
174 |
|
|
175 |
#ifndef list_for_each_entry_safe |
#ifndef list_for_each_entry_safe |
205 |
#endif /* __LITTLE_ENDIAN */ |
#endif /* __LITTLE_ENDIAN */ |
206 |
#endif |
#endif |
207 |
|
|
|
#ifndef _LINUX_SRCU_H |
|
|
|
|
|
struct srcu_struct { |
|
|
int counter_idx; |
|
|
int counter[2]; |
|
|
}; |
|
|
|
|
|
static inline int init_srcu_struct(struct srcu_struct *sp) |
|
|
{ |
|
|
return 0; |
|
|
} |
|
|
|
|
|
int srcu_read_lock(struct srcu_struct *sp); |
|
|
void srcu_read_unlock(struct srcu_struct *sp, const int idx); |
|
|
void synchronize_srcu(struct srcu_struct *sp); |
|
|
|
|
|
#endif |
|
|
|
|
208 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) |
|
|
|
209 |
struct path { |
struct path { |
210 |
struct vfsmount *mnt; |
struct vfsmount *mnt; |
211 |
struct dentry *dentry; |
struct dentry *dentry; |
212 |
}; |
}; |
|
|
|
213 |
#endif |
#endif |
214 |
|
|
215 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) |