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