]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/atomic.h
libxfs: Catch non-empty zones on destroy
[thirdparty/xfsprogs-dev.git] / include / atomic.h
1 /*
2 * Copyright (c) 2011 RedHat, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 #ifndef __ATOMIC_H__
19 #define __ATOMIC_H__
20
21 /*
22 * Warning: These are not really atomic at all. They are wrappers around the
23 * kernel atomic variable interface. If we do need these variables to be atomic
24 * (due to multithreading of the code that uses them) we need to add some
25 * pthreads magic here.
26 */
27 typedef int32_t atomic_t;
28 typedef int64_t atomic64_t;
29
30 #define atomic_inc_return(x) (++(*(x)))
31 #define atomic_dec_return(x) (--(*(x)))
32
33 #define atomic64_read(x) *(x)
34 #define atomic64_set(x, v) (*(x) = v)
35
36 #endif /* __ATOMIC_H__ */