オープンソース・ソフトウェアの開発とダウンロード

Subversion リポジトリの参照

Contents of /trunk/1.8.x/ccs-patch/security/ccsecurity/compat.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2080 - (show annotations) (download) (as text)
Thu Jan 29 00:28:51 2009 UTC (15 years, 3 months ago) by kumaneko
Original Path: trunk/1.6.x/ccs-patch/include/linux/ccs_compat.h
File MIME type: text/x-chdr
File size: 3949 byte(s)
Move 1.6.6-pre to 1.6.7-pre
1 /*
2 * include/linux/ccs_compat.h
3 *
4 * For compatibility for older kernels.
5 *
6 * Copyright (C) 2005-2009 NTT DATA CORPORATION
7 *
8 * Version: 1.6.7-pre 2009/02/02
9 *
10 * This file is applicable to both 2.4.30 and 2.6.11 and later.
11 * See README.ccs for ChangeLog.
12 *
13 */
14
15 #define false 0
16 #define true 1
17
18 #ifndef __user
19 #define __user
20 #endif
21
22 #ifndef current_uid
23 #define current_uid() (current->uid)
24 #endif
25 #ifndef current_gid
26 #define current_gid() (current->gid)
27 #endif
28 #ifndef current_euid
29 #define current_euid() (current->euid)
30 #endif
31 #ifndef current_egid
32 #define current_egid() (current->egid)
33 #endif
34 #ifndef current_suid
35 #define current_suid() (current->suid)
36 #endif
37 #ifndef current_sgid
38 #define current_sgid() (current->sgid)
39 #endif
40 #ifndef current_fsuid
41 #define current_fsuid() (current->fsuid)
42 #endif
43 #ifndef current_fsgid
44 #define current_fsgid() (current->fsgid)
45 #endif
46
47 #ifndef WARN_ON
48 #define WARN_ON(x) do { } while (0)
49 #endif
50
51 #ifndef DEFINE_SPINLOCK
52 #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
53 #endif
54
55 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
56 #define bool _Bool
57 #endif
58
59 #ifndef KERN_CONT
60 #define KERN_CONT ""
61 #endif
62
63 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
64 #define mutex semaphore
65 #define mutex_init(mutex) init_MUTEX(mutex)
66 #define mutex_lock(mutex) down(mutex)
67 #define mutex_unlock(mutex) up(mutex)
68 #define mutex_lock_interruptible(mutex) down_interruptible(mutex)
69 #define DEFINE_MUTEX(mutexname) DECLARE_MUTEX(mutexname)
70 #endif
71
72 #ifndef container_of
73 #define container_of(ptr, type, member) ({ \
74 const typeof(((type *)0)->member) *__mptr = (ptr); \
75 (type *)((char *)__mptr - offsetof(type, member)); })
76 #endif
77
78 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
79 #define kzalloc(size, flags) ({ \
80 void *ret = kmalloc((size), (flags)); \
81 if (ret) \
82 memset(ret, 0, (size)); \
83 ret; })
84 #endif
85
86 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
87 #define smp_read_barrier_depends smp_rmb
88 #endif
89
90 #ifndef ACCESS_ONCE
91 #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
92 #endif
93
94 #ifndef rcu_dereference
95 #define rcu_dereference(p) ({ \
96 typeof(p) _________p1 = ACCESS_ONCE(p); \
97 smp_read_barrier_depends(); /* see RCU */ \
98 (_________p1); \
99 })
100 #endif
101
102 #ifndef rcu_assign_pointer
103 #define rcu_assign_pointer(p, v) \
104 ({ \
105 if (!__builtin_constant_p(v) || \
106 ((v) != NULL)) \
107 smp_wmb(); /* see RCU */ \
108 (p) = (v); \
109 })
110 #endif
111
112 #ifndef list_for_each_rcu
113 #define list_for_each_rcu(pos, head) \
114 for (pos = rcu_dereference((head)->next); \
115 prefetch(pos->next), pos != (head); \
116 pos = rcu_dereference(pos->next))
117 #endif
118
119 #ifndef list_for_each_entry_rcu
120 #define list_for_each_entry_rcu(pos, head, member) \
121 for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), \
122 member); \
123 prefetch(pos->member.next), &pos->member != (head); \
124 pos = list_entry(rcu_dereference(pos->member.next), \
125 typeof(*pos), member))
126 #endif
127
128 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
129 #define s_fs_info u.generic_sbp
130 #else
131 #include <linux/audit.h>
132 #ifdef AUDIT_APPARMOR_AUDIT
133 /* AppArmor patch adds "struct vfsmount" to VFS helper functions. */
134 #define HAVE_VFSMOUNT_IN_VFS_HELPER
135 #endif
136 #endif
137
138 #if defined(RHEL_MAJOR) && RHEL_MAJOR == 5
139 #define HAVE_NO_I_BLKSIZE_IN_INODE
140 #elif defined(AX_MAJOR) && AX_MAJOR == 3
141 #define HAVE_NO_I_BLKSIZE_IN_INODE
142 #endif
143
144 #ifndef list_for_each_entry_safe
145 #define list_for_each_entry_safe(pos, n, head, member) \
146 for (pos = list_entry((head)->next, typeof(*pos), member), \
147 n = list_entry(pos->member.next, typeof(*pos), member); \
148 &pos->member != (head); \
149 pos = n, n = list_entry(n->member.next, typeof(*n), member))
150 #endif
151
152 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
153 #define sk_family family
154 #define sk_protocol protocol
155 #define sk_type type
156 #define sk_receive_queue receive_queue
157 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26