Blame view

include/linux/types.h 5.6 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX_TYPES_H
  #define _LINUX_TYPES_H
9d50638ba   Jaswinder Singh Rajput   unconditionally i...
3
  #include <asm/types.h>
527bdfee1   Jaswinder Singh Rajput   make linux/types....
4
  #ifndef __ASSEMBLY__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
5
  #ifdef	__KERNEL__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
  #define DECLARE_BITMAP(name,bits) \
  	unsigned long name[BITS_TO_LONGS(bits)]
69c8f52b3   Justin P. Mattock   fix #warning abou...
9
10
11
12
  #else
  #ifndef __EXPORTED_HEADERS__
  #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
  #endif /* __EXPORTED_HEADERS__ */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
14
15
  #endif
  
  #include <linux/posix_types.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16

3a471cbc0   Arnd Bergmann   remove __KERNEL_S...
17
  #ifdef __KERNEL__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
19
20
21
22
23
24
  
  typedef __u32 __kernel_dev_t;
  
  typedef __kernel_fd_set		fd_set;
  typedef __kernel_dev_t		dev_t;
  typedef __kernel_ino_t		ino_t;
  typedef __kernel_mode_t		mode_t;
0583fcc96   Al Viro   consolidate umode...
25
  typedef unsigned short		umode_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
27
28
29
30
31
32
33
34
  typedef __kernel_nlink_t	nlink_t;
  typedef __kernel_off_t		off_t;
  typedef __kernel_pid_t		pid_t;
  typedef __kernel_daddr_t	daddr_t;
  typedef __kernel_key_t		key_t;
  typedef __kernel_suseconds_t	suseconds_t;
  typedef __kernel_timer_t	timer_t;
  typedef __kernel_clockid_t	clockid_t;
  typedef __kernel_mqd_t		mqd_t;
6e2182874   Richard Knutsson   [PATCH] Generic b...
35
  typedef _Bool			bool;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
36
37
38
39
  typedef __kernel_uid32_t	uid_t;
  typedef __kernel_gid32_t	gid_t;
  typedef __kernel_uid16_t        uid16_t;
  typedef __kernel_gid16_t        gid16_t;
142956af5   Al Viro   fix abuses of ptr...
40
  typedef unsigned long		uintptr_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
43
44
45
  #ifdef CONFIG_UID16
  /* This is defined by include/asm-{arch}/posix_types.h */
  typedef __kernel_old_uid_t	old_uid_t;
  typedef __kernel_old_gid_t	old_gid_t;
  #endif /* CONFIG_UID16 */
7437a51b3   Mike Frysinger   Remove __STRICT_A...
46
  #if defined(__GNUC__)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  typedef __kernel_loff_t		loff_t;
  #endif
  
  /*
   * The following typedefs are also protected by individual ifdefs for
   * historical reasons:
   */
  #ifndef _SIZE_T
  #define _SIZE_T
  typedef __kernel_size_t		size_t;
  #endif
  
  #ifndef _SSIZE_T
  #define _SSIZE_T
  typedef __kernel_ssize_t	ssize_t;
  #endif
  
  #ifndef _PTRDIFF_T
  #define _PTRDIFF_T
  typedef __kernel_ptrdiff_t	ptrdiff_t;
  #endif
  
  #ifndef _TIME_T
  #define _TIME_T
  typedef __kernel_time_t		time_t;
  #endif
  
  #ifndef _CLOCK_T
  #define _CLOCK_T
  typedef __kernel_clock_t	clock_t;
  #endif
  
  #ifndef _CADDR_T
  #define _CADDR_T
  typedef __kernel_caddr_t	caddr_t;
  #endif
  
  /* bsd */
  typedef unsigned char		u_char;
  typedef unsigned short		u_short;
  typedef unsigned int		u_int;
  typedef unsigned long		u_long;
  
  /* sysv */
  typedef unsigned char		unchar;
  typedef unsigned short		ushort;
  typedef unsigned int		uint;
  typedef unsigned long		ulong;
  
  #ifndef __BIT_TYPES_DEFINED__
  #define __BIT_TYPES_DEFINED__
  
  typedef		__u8		u_int8_t;
  typedef		__s8		int8_t;
  typedef		__u16		u_int16_t;
  typedef		__s16		int16_t;
  typedef		__u32		u_int32_t;
  typedef		__s32		int32_t;
  
  #endif /* !(__BIT_TYPES_DEFINED__) */
  
  typedef		__u8		uint8_t;
  typedef		__u16		uint16_t;
  typedef		__u32		uint32_t;
7437a51b3   Mike Frysinger   Remove __STRICT_A...
111
  #if defined(__GNUC__)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
112
113
114
115
  typedef		__u64		uint64_t;
  typedef		__u64		u_int64_t;
  typedef		__s64		int64_t;
  #endif
a75d37768   Andrew Morton   types.h: move mis...
116
  /* this is a special 64bit data type that is 8-byte aligned */
c82a5cb8b   Jan Engelhardt   linux/types.h: Us...
117
  #define aligned_u64 __u64 __attribute__((aligned(8)))
98a4a8612   Al Viro   [NETFILTER]: triv...
118
119
  #define aligned_be64 __be64 __attribute__((aligned(8)))
  #define aligned_le64 __le64 __attribute__((aligned(8)))
0ba2c6e8c   Harald Welte   [NETFILTER]: intr...
120

2c2345c2b   Roger Gammans   [PATCH] Document ...
121
  /**
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
122
   * The type used for indexing onto a disc or disc partition.
2c2345c2b   Roger Gammans   [PATCH] Document ...
123
124
125
   *
   * Linux always considers sectors to be 512 bytes long independently
   * of the devices real block size.
b3a6ffe16   Jens Axboe   Get rid of CONFIG...
126
127
   *
   * blkcnt_t is the type of the inode's block count.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
   */
90c699a9e   Bartlomiej Zolnierkiewicz   block: rename CON...
129
  #ifdef CONFIG_LBDAF
e62438630   Matthew Wilcox   [PATCH] Centralis...
130
  typedef u64 sector_t;
e62438630   Matthew Wilcox   [PATCH] Centralis...
131
132
  typedef u64 blkcnt_t;
  #else
b3a6ffe16   Jens Axboe   Get rid of CONFIG...
133
  typedef unsigned long sector_t;
a0f62ac63   Takashi Sato   [PATCH] 2TB files...
134
135
  typedef unsigned long blkcnt_t;
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
136
137
138
139
140
141
142
  /*
   * The type of an index into the pagecache.  Use a #define so asm/types.h
   * can override it.
   */
  #ifndef pgoff_t
  #define pgoff_t unsigned long
  #endif
3e50594e8   FUJITA Tomonori   add the common dm...
143
144
145
146
147
  #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
  typedef u64 dma_addr_t;
  #else
  typedef u32 dma_addr_t;
  #endif /* dma_addr_t */
3a471cbc0   Arnd Bergmann   remove __KERNEL_S...
148
  #endif /* __KERNEL__ */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
149
150
151
152
153
154
155
  
  /*
   * Below are truly Linux-specific types that should never collide with
   * any application/library that wants linux/types.h.
   */
  
  #ifdef __CHECKER__
af4ca457e   Al Viro   [PATCH] gfp_t: in...
156
157
158
159
160
161
  #define __bitwise__ __attribute__((bitwise))
  #else
  #define __bitwise__
  #endif
  #ifdef __CHECK_ENDIAN__
  #define __bitwise __bitwise__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
162
163
164
165
166
167
168
169
  #else
  #define __bitwise
  #endif
  
  typedef __u16 __bitwise __le16;
  typedef __u16 __bitwise __be16;
  typedef __u32 __bitwise __le32;
  typedef __u32 __bitwise __be32;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
170
171
  typedef __u64 __bitwise __le64;
  typedef __u64 __bitwise __be64;
940fbf411   Detlef Riekenberg   linux/types.h: Do...
172

2bc357987   Al Viro   [NET]: Introduce ...
173
174
  typedef __u16 __bitwise __sum16;
  typedef __u32 __bitwise __wsum;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
175

a75d37768   Andrew Morton   types.h: move mis...
176
177
178
179
  /*
   * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
   * common 32/64-bit compat problems.
   * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
a469ebd56   Mark Einon   types.h: fix comm...
180
   * architectures) and to 8-byte boundaries on 64-bit architectures.  The new
a75d37768   Andrew Morton   types.h: move mis...
181
182
183
184
   * aligned_64 type enforces 8-byte alignment so that structs containing
   * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
   * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
   */
79b5dc0c6   Eric Paris   types.h: define _...
185
186
187
  #define __aligned_u64 __u64 __attribute__((aligned(8)))
  #define __aligned_be64 __be64 __attribute__((aligned(8)))
  #define __aligned_le64 __le64 __attribute__((aligned(8)))
dd0fc66fb   Al Viro   [PATCH] gfp flags...
188
  #ifdef __KERNEL__
af4ca457e   Al Viro   [PATCH] gfp_t: in...
189
  typedef unsigned __bitwise__ gfp_t;
aeb5d7270   Al Viro   [PATCH] introduce...
190
  typedef unsigned __bitwise__ fmode_t;
cf7c712c1   Greg Kroah-Hartman   [PATCH] 64bit res...
191

600715dcd   Jeremy Fitzhardinge   generic: add phys...
192
193
194
195
196
  #ifdef CONFIG_PHYS_ADDR_T_64BIT
  typedef u64 phys_addr_t;
  #else
  typedef u32 phys_addr_t;
  #endif
8308c54d7   Jeremy Fitzhardinge   generic: redefine...
197
  typedef phys_addr_t resource_size_t;
ea4354675   Matthew Wilcox   atomic_t: unify a...
198
  typedef struct {
81880d603   Anton Blanchard   atomic_t: Remove ...
199
  	int counter;
ea4354675   Matthew Wilcox   atomic_t: unify a...
200
201
202
203
  } atomic_t;
  
  #ifdef CONFIG_64BIT
  typedef struct {
81880d603   Anton Blanchard   atomic_t: Remove ...
204
  	long counter;
ea4354675   Matthew Wilcox   atomic_t: unify a...
205
206
  } atomic64_t;
  #endif
de5d9bf65   Chris Metcalf   Move list types f...
207
208
209
210
211
212
213
214
215
216
217
  struct list_head {
  	struct list_head *next, *prev;
  };
  
  struct hlist_head {
  	struct hlist_node *first;
  };
  
  struct hlist_node {
  	struct hlist_node *next, **pprev;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
218
219
220
221
222
223
  struct ustat {
  	__kernel_daddr_t	f_tfree;
  	__kernel_ino_t		f_tinode;
  	char			f_fname[6];
  	char			f_fpack[6];
  };
990987511   Paul E. McKenney   rcu: Move rcu_hea...
224
225
226
227
228
229
230
231
232
  /**
   * struct rcu_head - callback structure for use with RCU
   * @next: next update requests in a list
   * @func: actual update function to call after the grace period.
   */
  struct rcu_head {
  	struct rcu_head *next;
  	void (*func)(struct rcu_head *head);
  };
6c7c6afbb   maximilian attems   types.h: don't ex...
233
  #endif	/* __KERNEL__ */
527bdfee1   Jaswinder Singh Rajput   make linux/types....
234
  #endif /*  __ASSEMBLY__ */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
235
  #endif /* _LINUX_TYPES_H */