]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/atomic.h
xfs: automatic dfops buffer relogging
[thirdparty/xfsprogs-dev.git] / include / atomic.h
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) 2011 RedHat, Inc.
4 * All Rights Reserved.
5 */
6 #ifndef __ATOMIC_H__
7 #define __ATOMIC_H__
8
9 /*
10 * Warning: These are not really atomic at all. They are wrappers around the
11 * kernel atomic variable interface. If we do need these variables to be atomic
12 * (due to multithreading of the code that uses them) we need to add some
13 * pthreads magic here.
14 */
15 typedef int32_t atomic_t;
16 typedef int64_t atomic64_t;
17
18 #define atomic_inc_return(x) (++(*(x)))
19 #define atomic_dec_return(x) (--(*(x)))
20
21 #define atomic64_read(x) *(x)
22 #define atomic64_set(x, v) (*(x) = v)
23
24 #endif /* __ATOMIC_H__ */