1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TOOLS_LINUX_TYPES_H_
3 #define _TOOLS_LINUX_TYPES_H_
4 
5 #include <stdbool.h>
6 #include <stddef.h>
7 #include <stdint.h>
8 
9 #define __SANE_USERSPACE_TYPES__	/* For PPC64, to get LL64 types */
10 #include <asm/types.h>
11 #include <asm/posix_types.h>
12 
13 struct page;
14 struct kmem_cache;
15 
16 typedef enum {
17 	GFP_KERNEL,
18 	GFP_ATOMIC,
19 	__GFP_HIGHMEM,
20 	__GFP_HIGH
21 } gfp_t;
22 
23 /*
24  * We define u64 as uint64_t for every architecture
25  * so that we can print it with "%"PRIx64 without getting warnings.
26  *
27  * typedef __u64 u64;
28  * typedef __s64 s64;
29  */
30 typedef uint64_t u64;
31 typedef int64_t s64;
32 
33 typedef __u32 u32;
34 typedef __s32 s32;
35 
36 typedef __u16 u16;
37 typedef __s16 s16;
38 
39 typedef __u8  u8;
40 typedef __s8  s8;
41 
42 #ifdef __CHECKER__
43 #define __bitwise__ __attribute__((bitwise))
44 #else
45 #define __bitwise__
46 #endif
47 #define __bitwise __bitwise__
48 
49 #define __force
50 #define __user
51 #define __must_check
52 #define __cold
53 
54 typedef __u16 __bitwise __le16;
55 typedef __u16 __bitwise __be16;
56 typedef __u32 __bitwise __le32;
57 typedef __u32 __bitwise __be32;
58 typedef __u64 __bitwise __le64;
59 typedef __u64 __bitwise __be64;
60 
61 typedef struct {
62 	int counter;
63 } atomic_t;
64 
65 #ifndef __aligned_u64
66 # define __aligned_u64 __u64 __attribute__((aligned(8)))
67 #endif
68 
69 struct list_head {
70 	struct list_head *next, *prev;
71 };
72 
73 struct hlist_head {
74 	struct hlist_node *first;
75 };
76 
77 struct hlist_node {
78 	struct hlist_node *next, **pprev;
79 };
80 
81 #endif /* _TOOLS_LINUX_TYPES_H_ */
82