xref: /openbmc/u-boot/include/linux/types.h (revision 6b44ae6b)
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 /*
128  * Below are truly Linux-specific types that should never collide with
129  * any application/library that wants linux/types.h.
130  */
131 #ifdef __CHECKER__
132 #define __bitwise__ __attribute__((bitwise))
133 #else
134 #define __bitwise__
135 #endif
136 #ifdef __CHECK_ENDIAN__
137 #define __bitwise __bitwise__
138 #else
139 #define __bitwise
140 #endif
141 
142 typedef __u16 __bitwise __le16;
143 typedef __u16 __bitwise __be16;
144 typedef __u32 __bitwise __le32;
145 typedef __u32 __bitwise __be32;
146 #if defined(__GNUC__)
147 typedef __u64 __bitwise __le64;
148 typedef __u64 __bitwise __be64;
149 #endif
150 typedef __u16 __bitwise __sum16;
151 typedef __u32 __bitwise __wsum;
152 
153 typedef unsigned __bitwise__	gfp_t;
154 
155 struct ustat {
156 	__kernel_daddr_t	f_tfree;
157 	__kernel_ino_t		f_tinode;
158 	char			f_fname[6];
159 	char			f_fpack[6];
160 };
161 
162 #endif /* _LINUX_TYPES_H */
163