d45fb37887bc7ec596ad569dd05b583df496220e
[pandora-kernel.git] / fs / btrfs / compat.h
1 #ifndef _COMPAT_H_
2 #define _COMPAT_H_
3
4 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,26)
5 #define trylock_page(page) (!TestSetPageLocked(page))
6 #endif
7
8 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)
9 static inline struct dentry *d_obtain_alias(struct inode *inode)
10 {
11         struct dentry *d;
12
13         if (!inode)
14                 return NULL;
15         if (IS_ERR(inode))
16                 return ERR_CAST(inode);
17
18         d = d_alloc_anon(inode);
19         if (!d)
20                 iput(inode);
21         return d;
22 }
23 #endif
24
25 /*
26  * Even if AppArmor isn't enabled, it still has different prototypes.
27  * Add more distro/version pairs here to declare which has AppArmor applied.
28  */
29 #if defined(CONFIG_SUSE_KERNEL)
30 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
31 # define REMOVE_SUID_PATH 1
32 # endif
33 #endif
34
35 /*
36  * catch any other distros that have patched in apparmor.  This isn't
37  * 100% reliable because it won't catch people that hand compile their
38  * own distro kernels without apparmor compiled in.  But, it is better
39  * than nothing.
40  */
41 #ifdef CONFIG_SECURITY_APPARMOR
42 # define REMOVE_SUID_PATH 1
43 #endif
44
45 #endif /* _COMPAT_H_ */