Xenomai  3.0-rc7
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  * - identify the first kernel release for which the wrapper should
38  * be defined, instead of testing the existence of a preprocessor
39  * symbol, so that obsolete wrappers can be spotted.
40  */
41 
42 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
43 #define DEVICE_ATTR_RW(_name) __ATTR_RW(_name)
44 #define DEVICE_ATTR_RO(_name) __ATTR_RO(_name)
45 #define DEVICE_ATTR_WO(_name) __ATTR_WO(_name)
46 #endif /* < 3.11 */
47 
48 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
49 #define get_current_uuid() current_uid()
50 #else /* >= 3.14 */
51 #define get_current_uuid() from_kuid_munged(current_user_ns(), current_uid())
52 #endif
53 
54 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
55 #define raw_cpu_ptr(v) __this_cpu_ptr(v)
56 #endif
57 
58 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
59 #define smp_mb__before_atomic() smp_mb()
60 #define smp_mb__after_atomic() smp_mb()
61 #endif
62 
63 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
64 #include <linux/netdevice.h>
65 
66 #undef alloc_netdev
67 #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
68  alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
69 #endif
70 
71 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */