xref: /openbmc/u-boot/include/linux/types.h (revision 5c8fd32b)
1 #ifndef _LINUX_TYPES_H
2 #define _LINUX_TYPES_H
3 
4 #include <linux/posix_types.h>
5 #include <asm/types.h>
6 #include <stdbool.h>
7 
8 #ifndef __KERNEL_STRICT_NAMES
9 
10 typedef __kernel_fd_set		fd_set;
11 typedef __kernel_dev_t		dev_t;
12 typedef __kernel_ino_t		ino_t;
13 typedef __kernel_mode_t		mode_t;
14 typedef __kernel_nlink_t	nlink_t;
15 typedef __kernel_off_t		off_t;
16 typedef __kernel_pid_t		pid_t;
17 typedef __kernel_daddr_t	daddr_t;
18 typedef __kernel_key_t		key_t;
19 typedef __kernel_suseconds_t	suseconds_t;
20 
21 #ifdef __KERNEL__
22 typedef __kernel_uid32_t	uid_t;
23 typedef __kernel_gid32_t	gid_t;
24 typedef __kernel_uid16_t        uid16_t;
25 typedef __kernel_gid16_t        gid16_t;
26 
27 typedef unsigned long		uintptr_t;
28 
29 #ifdef CONFIG_UID16
30 /* This is defined by include/asm-{arch}/posix_types.h */
31 typedef __kernel_old_uid_t	old_uid_t;
32 typedef __kernel_old_gid_t	old_gid_t;
33 #endif /* CONFIG_UID16 */
34 
35 /* libc5 includes this file to define uid_t, thus uid_t can never change
36  * when it is included by non-kernel code
37  */
38 #else
39 typedef __kernel_uid_t		uid_t;
40 typedef __kernel_gid_t		gid_t;
41 #endif /* __KERNEL__ */
42 
43 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
44 typedef __kernel_loff_t		loff_t;
45 #endif
46 
47 /*
48  * The following typedefs are also protected by individual ifdefs for
49  * historical reasons:
50  */
51 #ifndef _SIZE_T
52 #define _SIZE_T
53 typedef __kernel_size_t		size_t;
54 #endif
55 
56 #ifndef _SSIZE_T
57 #define _SSIZE_T
58 typedef __kernel_ssize_t	ssize_t;
59 #endif
60 
61 #ifndef _PTRDIFF_T
62 #define _PTRDIFF_T
63 typedef __kernel_ptrdiff_t	ptrdiff_t;
64 #endif
65 
66 #ifndef _TIME_T
67 #define _TIME_T
68 typedef __kernel_time_t		time_t;
69 #endif
70 
71 #ifndef _CLOCK_T
72 #define _CLOCK_T
73 typedef __kernel_clock_t	clock_t;
74 #endif
75 
76 #ifndef _CADDR_T
77 #define _CADDR_T
78 typedef __kernel_caddr_t	caddr_t;
79 #endif
80 
81 /* bsd */
82 typedef unsigned char		u_char;
83 typedef unsigned short		u_short;
84 typedef unsigned int		u_int;
85 typedef unsigned long		u_long;
86 
87 /* sysv */
88 typedef unsigned char		unchar;
89 typedef unsigned short		ushort;
90 typedef unsigned int		uint;
91 typedef unsigned long		ulong;
92 
93 #ifndef __BIT_TYPES_DEFINED__
94 #define __BIT_TYPES_DEFINED__
95 
96 typedef		__u8		u_int8_t;
97 typedef		__s8		int8_t;
98 typedef		__u16		u_int16_t;
99 typedef		__s16		int16_t;
100 typedef		__u32		u_int32_t;
101 typedef		__s32		int32_t;
102 
103 #endif /* !(__BIT_TYPES_DEFINED__) */
104 
105 typedef		__u8		uint8_t;
106 typedef		__u16		uint16_t;
107 typedef		__u32		uint32_t;
108 
109 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
110 typedef		__u64		uint64_t;
111 typedef		__u64		u_int64_t;
112 typedef		__s64		int64_t;
113 #endif
114 
115 #endif /* __KERNEL_STRICT_NAMES */
116 
117 /* this is a special 64bit data type that is 8-byte aligned */
118 #define aligned_u64 __u64 __aligned(8)
119 #define aligned_be64 __be64 __aligned(8)
120 #define aligned_le64 __le64 __aligned(8)
121 
122 #ifdef __KERNEL__
123 typedef phys_addr_t resource_size_t;
124 #endif
125 
126 /*
127  * Below are truly Linux-specific types that should never collide with
128  * any application/library that wants linux/types.h.
129  */
130 #ifdef __CHECKER__
131 #define __bitwise__ __attribute__((bitwise))
132 #else
133 #define __bitwise__
134 #endif
135 #ifdef __CHECK_ENDIAN__
136 #define __bitwise __bitwise__
137 #else
138 #define __bitwise
139 #endif
140 
141 typedef __u16 __bitwise __le16;
142 typedef __u16 __bitwise __be16;
143 typedef __u32 __bitwise __le32;
144 typedef __u32 __bitwise __be32;
145 #if defined(__GNUC__)
146 typedef __u64 __bitwise __le64;
147 typedef __u64 __bitwise __be64;
148 #endif
149 typedef __u16 __bitwise __sum16;
150 typedef __u32 __bitwise __wsum;
151 
152 typedef unsigned __bitwise__	gfp_t;
153 
154 struct ustat {
155 	__kernel_daddr_t	f_tfree;
156 	__kernel_ino_t		f_tinode;
157 	char			f_fname[6];
158 	char			f_fpack[6];
159 };
160 
161 #endif /* _LINUX_TYPES_H */
162