1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef _ASM_GENERIC_LOCAL_H
13#define _ASM_GENERIC_LOCAL_H
14
15#include <linux/percpu.h>
16#include <linux/hardirq.h>
17#include <asm/atomic.h>
18#include <asm/types.h>
19
20typedef struct
21{
22 atomic_long_t a;
23} local_t;
24
25#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
26
27#define local_read(l) atomic_long_read(&(l)->a)
28#define local_set(l,i) atomic_long_set((&(l)->a),(i))
29#define local_inc(l) atomic_long_inc(&(l)->a)
30#define local_dec(l) atomic_long_dec(&(l)->a)
31#define local_add(i,l) atomic_long_add((i),(&(l)->a))
32#define local_sub(i,l) atomic_long_sub((i),(&(l)->a))
33
34#define __local_inc(l) local_set((l), local_read(l) + 1)
35#define __local_dec(l) local_set((l), local_read(l) - 1)
36#define __local_add(i,l) local_set((l), local_read(l) + (i))
37#define __local_sub(i,l) local_set((l), local_read(l) - (i))
38
39#define cpu_local_read(v) local_read(&__get_cpu_var(v))
40#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i))
41#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
42#define cpu_local_dec(v) local_dec(&__get_cpu_var(v))
43#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v))
44#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v))
45
46#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v))
47#define __cpu_local_dec(v) __local_dec(&__get_cpu_var(v))
48#define __cpu_local_add(i, v) __local_add((i), &__get_cpu_var(v))
49#define __cpu_local_sub(i, v) __local_sub((i), &__get_cpu_var(v))
50
51#endif
52