-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatomic.h
42 lines (36 loc) · 958 Bytes
/
atomic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
*
* wrapper/atomic.h
*
* wrapper around linux/atomic.h.
*
* Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
#ifndef _LTTNG_WRAPPER_ATOMIC_H
#define _LTTNG_WRAPPER_ATOMIC_H
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
#include <linux/atomic.h>
#else
#include <asm/atomic.h>
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
static inline void lttng_smp_mb__before_atomic(void)
{
smp_mb__before_atomic();
}
static inline void lttng_smp_mb__after_atomic(void)
{
smp_mb__after_atomic();
}
#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
static inline void lttng_smp_mb__before_atomic(void)
{
smp_mb__before_atomic_inc();
}
static inline void lttng_smp_mb__after_atomic(void)
{
smp_mb__after_atomic_inc();
}
#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
#endif /* _LTTNG_WRAPPER_ATOMIC_H */