xref: /openbmc/u-boot/include/linux/types.h (revision 48263504)
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 	(!defined(CONFIG_USE_STDINT) || !defined(__INT64_TYPE__))
111 typedef		__u64		uint64_t;
112 typedef		__u64		u_int64_t;
113 typedef		__s64		int64_t;
114 #endif
115 
116 #endif /* __KERNEL_STRICT_NAMES */
117 
118 /* this is a special 64bit data type that is 8-byte aligned */
119 #define aligned_u64 __u64 __aligned(8)
120 #define aligned_be64 __be64 __aligned(8)
121 #define aligned_le64 __le64 __aligned(8)
122 
123 #if defined(CONFIG_USE_STDINT) && defined(__INT64_TYPE__)
124 typedef		__UINT64_TYPE__	uint64_t;
125 typedef		__UINT64_TYPE__	u_int64_t;
126 typedef		__INT64_TYPE__		int64_t;
127 #endif
128 
129 #ifdef __KERNEL__
130 typedef phys_addr_t resource_size_t;
131 #endif
132 
133 /*
134  * Below are truly Linux-specific types that should never collide with
135  * any application/library that wants linux/types.h.
136  */
137 #ifdef __CHECKER__
138 #define __bitwise__ __attribute__((bitwise))
139 #else
140 #define __bitwise__
141 #endif
142 #ifdef __CHECK_ENDIAN__
143 #define __bitwise __bitwise__
144 #else
145 #define __bitwise
146 #endif
147 
148 typedef __u16 __bitwise __le16;
149 typedef __u16 __bitwise __be16;
150 typedef __u32 __bitwise __le32;
151 typedef __u32 __bitwise __be32;
152 #if defined(__GNUC__)
153 typedef __u64 __bitwise __le64;
154 typedef __u64 __bitwise __be64;
155 #endif
156 typedef __u16 __bitwise __sum16;
157 typedef __u32 __bitwise __wsum;
158 
159 typedef unsigned __bitwise__	gfp_t;
160 
161 struct ustat {
162 	__kernel_daddr_t	f_tfree;
163 	__kernel_ino_t		f_tinode;
164 	char			f_fname[6];
165 	char			f_fpack[6];
166 };
167 
168 #endif /* _LINUX_TYPES_H */
169