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