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