at v6.16 1.8 kB view raw
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 45typedef unsigned long long ullong; 46 47#ifdef __CHECKER__ 48#define __bitwise __attribute__((bitwise)) 49#else 50#define __bitwise 51#endif 52 53#define __force 54/* This is defined in linux/compiler_types.h and is left for backward 55 * compatibility. 56 */ 57#ifndef __user 58#define __user 59#endif 60#define __must_check 61#define __cold 62 63typedef __u16 __bitwise __le16; 64typedef __u16 __bitwise __be16; 65typedef __u32 __bitwise __le32; 66typedef __u32 __bitwise __be32; 67typedef __u64 __bitwise __le64; 68typedef __u64 __bitwise __be64; 69 70typedef __u16 __bitwise __sum16; 71typedef __u32 __bitwise __wsum; 72 73#ifdef CONFIG_PHYS_ADDR_T_64BIT 74typedef u64 phys_addr_t; 75#else 76typedef u32 phys_addr_t; 77#endif 78 79typedef struct { 80 int counter; 81} atomic_t; 82 83typedef struct { 84 long counter; 85} atomic_long_t; 86 87#ifndef __aligned_u64 88# define __aligned_u64 __u64 __attribute__((aligned(8))) 89#endif 90 91struct list_head { 92 struct list_head *next, *prev; 93}; 94 95struct hlist_head { 96 struct hlist_node *first; 97}; 98 99struct hlist_node { 100 struct hlist_node *next, **pprev; 101}; 102 103#endif /* _TOOLS_LINUX_TYPES_H_ */