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

Subversion リポジトリの参照

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2540 - (show annotations) (download) (as text)
Thu May 14 00:08:32 2009 UTC (15 years ago) by kumaneko
Original Path: branches/ccs-patch/include/linux/ccs_compat.h
File MIME type: text/x-chdr
File size: 3784 byte(s)


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.8-pre 2009/05/08
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 /*
87 #ifndef list_for_each
88 #define list_for_each(pos, head) \
89 for (pos = (head)->next; prefetch(pos->next), pos != (head); \
90 pos = pos->next)
91 #endif
92
93 #ifndef list_for_each_entry
94 #define list_for_each_entry(pos, head, member) \
95 for (pos = list_entry((head)->next, typeof(*pos), member); \
96 prefetch(pos->member.next), &pos->member != (head); \
97 pos = list_entry(pos->member.next, typeof(*pos), member))
98 #endif
99 */
100
101 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
102 #define s_fs_info u.generic_sbp
103 #else
104 #include <linux/audit.h>
105 #ifdef AUDIT_APPARMOR_AUDIT
106 /* AppArmor patch adds "struct vfsmount" to VFS helper functions. */
107 #define HAVE_VFSMOUNT_IN_VFS_HELPER
108 #endif
109 #endif
110
111 #if defined(RHEL_MAJOR) && RHEL_MAJOR == 5
112 #define HAVE_NO_I_BLKSIZE_IN_INODE
113 #elif defined(AX_MAJOR) && AX_MAJOR == 3
114 #define HAVE_NO_I_BLKSIZE_IN_INODE
115 #endif
116
117 #ifndef list_for_each_entry_safe
118 #define list_for_each_entry_safe(pos, n, head, member) \
119 for (pos = list_entry((head)->next, typeof(*pos), member), \
120 n = list_entry(pos->member.next, typeof(*pos), member); \
121 &pos->member != (head); \
122 pos = n, n = list_entry(n->member.next, typeof(*n), member))
123 #endif
124
125 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
126 #define sk_family family
127 #define sk_protocol protocol
128 #define sk_type type
129 #define sk_receive_queue receive_queue
130 static inline struct socket *SOCKET_I(struct inode *inode)
131 {
132 return inode->i_sock ? &inode->u.socket_i : NULL;
133 }
134 #endif
135
136 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
137 #if defined(__LITTLE_ENDIAN)
138 #define HIPQUAD(addr) \
139 ((unsigned char *)&addr)[3], \
140 ((unsigned char *)&addr)[2], \
141 ((unsigned char *)&addr)[1], \
142 ((unsigned char *)&addr)[0]
143 #elif defined(__BIG_ENDIAN)
144 #define HIPQUAD NIPQUAD
145 #else
146 #error "Please fix asm/byteorder.h"
147 #endif /* __LITTLE_ENDIAN */
148 #endif

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