Whamcloud - gitweb
171e38040b7658001b0a1ffd4922beec8bb9f0a9
[fs/lustre-release.git] / libcfs / include / libcfs / types.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2012, 2014, Intel Corporation.
27  */
28 #ifndef _LIBCFS_TYPES_H
29 #define _LIBCFS_TYPES_H
30
31 #include <linux/types.h>
32
33 #ifndef __KERNEL__
34 # error This include is only for kernel use.
35 #endif
36
37 #if defined(_ASM_GENERIC_INT_L64_H)
38 # define LPF64 "l"
39 #elif defined(_ASM_GENERIC_INT_LL64_H)
40 # define LPF64 "ll"
41 #elif !defined(LPF64)
42 # error "cannot define LPF64"
43 #endif /* !LPF64 */
44
45 #define LPU64 "%"LPF64"u"
46 #define LPD64 "%"LPF64"d"
47 #define LPX64 "%#"LPF64"x"
48 #define LPX64i "%"LPF64"x"
49 #define LPO64 "%#"LPF64"o"
50
51 #define LPLU "%lu"
52 #define LPLD "%ld"
53 #define LPLX "%#lx"
54 #define LPPID "%d"
55
56 #if BITS_PER_LONG == 64
57 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
58 # define LL_POISON ((long)0x5a5a5a5a5a5a5a5a)
59 # define LP_POISON ((void *)(long)0x5a5a5a5a5a5a5a5a)
60 #elif BITS_PER_LONG == 32
61 # define LI_POISON ((int)0x5a5a5a5a)
62 # define LL_POISON ((long)0x5a5a5a5a)
63 # define LP_POISON ((void *)(long)0x5a5a5a5a)
64 #else /* BITS_PER_LONG == 32 */
65 # error "cannot define L{I,L,P}_POISON"
66 #endif /* BITS_PER_LONG != 32 */
67
68 typedef unsigned long ulong_ptr_t;
69 typedef long long_ptr_t;
70
71 #endif /* _LIBCFS_TYPES_H */