xref: /openbmc/u-boot/include/linux/types.h (revision a4884831)
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 typedef		__u64		uint64_t;
109 typedef		__u64		u_int64_t;
110 typedef		__s64		int64_t;
111 #endif
112 
113 #endif /* __KERNEL_STRICT_NAMES */
114 
115 /*
116  * Below are truly Linux-specific types that should never collide with
117  * any application/library that wants linux/types.h.
118  */
119 #ifdef __CHECKER__
120 #define __bitwise__ __attribute__((bitwise))
121 #else
122 #define __bitwise__
123 #endif
124 #ifdef __CHECK_ENDIAN__
125 #define __bitwise __bitwise__
126 #else
127 #define __bitwise
128 #endif
129 
130 typedef __u16 __bitwise __le16;
131 typedef __u16 __bitwise __be16;
132 typedef __u32 __bitwise __le32;
133 typedef __u32 __bitwise __be32;
134 #if defined(__GNUC__)
135 typedef __u64 __bitwise __le64;
136 typedef __u64 __bitwise __be64;
137 #endif
138 typedef __u16 __bitwise __sum16;
139 typedef __u32 __bitwise __wsum;
140 
141 
142 typedef unsigned __bitwise__	gfp_t;
143 
144 struct ustat {
145 	__kernel_daddr_t	f_tfree;
146 	__kernel_ino_t		f_tinode;
147 	char			f_fname[6];
148 	char			f_fpack[6];
149 };
150 
151 #endif /* _LINUX_TYPES_H */
152