Xenomai  3.0-rc3
wrappers.h
1 /*
2  * Copyright (C) 2005-2012 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 #ifndef _COBALT_ASM_GENERIC_WRAPPERS_H
20 
21 #include <linux/version.h>
22 
23 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
24 #error "Xenomai/cobalt requires Linux kernel 3.10 or above"
25 #endif
26 
27 #ifdef CONFIG_IPIPE_LEGACY
28 #error "CONFIG_IPIPE_LEGACY must be switched off"
29 #endif
30 
31 /*
32  * To keep the #ifdefery as readable as possible, please:
33  *
34  * - keep the conditional structure flat, no nesting (e.g. do not nest
35  * the pre-3.11 conditions into the pre-3.14 ones).
36  * - group all wrappers which share the same condition.
37  */
38 
39 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
40 #define DEVICE_ATTR_RW(_name) __ATTR_RW(_name)
41 #define DEVICE_ATTR_RO(_name) __ATTR_RO(_name)
42 #define DEVICE_ATTR_WO(_name) __ATTR_WO(_name)
43 #endif /* < 3.11 */
44 
45 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
46 #define get_current_uuid() current_uid()
47 #else /* >= 3.14 */
48 #define get_current_uuid() from_kuid_munged(current_user_ns(), current_uid())
49 #endif
50 
51 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
52 #define smp_mb__before_atomic() smp_mb()
53 #define smp_mb__after_atomic() smp_mb()
54 #endif
55 
56 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */