]>
Commit | Line | Data |
---|---|---|
91447636 A |
1 | /* |
2 | * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
37839358 A |
6 | * The contents of this file constitute Original Code as defined in and |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
91447636 | 11 | * |
37839358 A |
12 | * This Original Code and all software distributed under the License are |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
91447636 A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
37839358 A |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
91447636 A |
19 | * |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
23 | /* | |
24 | * Copyright (c) 1982, 1986, 1993, 1994 | |
25 | * The Regents of the University of California. All rights reserved. | |
26 | * | |
27 | * Redistribution and use in source and binary forms, with or without | |
28 | * modification, are permitted provided that the following conditions | |
29 | * are met: | |
30 | * 1. Redistributions of source code must retain the above copyright | |
31 | * notice, this list of conditions and the following disclaimer. | |
32 | * 2. Redistributions in binary form must reproduce the above copyright | |
33 | * notice, this list of conditions and the following disclaimer in the | |
34 | * documentation and/or other materials provided with the distribution. | |
35 | * 3. All advertising materials mentioning features or use of this software | |
36 | * must display the following acknowledgement: | |
37 | * This product includes software developed by the University of | |
38 | * California, Berkeley and its contributors. | |
39 | * 4. Neither the name of the University nor the names of its contributors | |
40 | * may be used to endorse or promote products derived from this software | |
41 | * without specific prior written permission. | |
42 | * | |
43 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
44 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
46 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
49 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
50 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
52 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
53 | * SUCH DAMAGE. | |
54 | * | |
55 | * @(#)uio.h 8.5 (Berkeley) 2/22/94 | |
56 | */ | |
57 | ||
58 | #ifndef _SYS_UIO_INTERNAL_H_ | |
59 | #define _SYS_UIO_INTERNAL_H_ | |
60 | ||
61 | #include <sys/appleapiopts.h> | |
62 | ||
63 | #ifdef KERNEL_PRIVATE | |
64 | #include <sys/uio.h> | |
65 | #include <sys/malloc.h> | |
66 | ||
67 | /* | |
68 | * user / kernel address space type flags. | |
69 | * WARNING - make sure to check when adding flags! Be sure new flags | |
70 | * don't overlap the definitions in uio.h | |
71 | */ | |
72 | // UIO_USERSPACE 0 defined in uio.h | |
73 | #define UIO_USERISPACE 1 | |
74 | // UIO_SYSSPACE 2 defined in uio.h | |
75 | #define UIO_PHYS_USERSPACE 3 | |
76 | #define UIO_PHYS_SYSSPACE 4 | |
77 | // UIO_USERSPACE32 5 defined in uio.h | |
78 | #define UIO_USERISPACE32 6 | |
79 | #define UIO_PHYS_USERSPACE32 7 | |
80 | // UIO_USERSPACE64 8 defined in uio.h | |
81 | #define UIO_USERISPACE64 9 | |
82 | #define UIO_PHYS_USERSPACE64 10 | |
83 | // UIO_SYSSPACE32 11 defined in uio.h | |
84 | #define UIO_PHYS_SYSSPACE32 12 | |
85 | #define UIO_SYSSPACE64 13 | |
86 | #define UIO_PHYS_SYSSPACE64 14 | |
87 | ||
88 | __BEGIN_DECLS | |
89 | struct user_iovec; | |
90 | ||
91 | // uio_iovsaddr was __private_extern__ temporary chnage for 3777436 | |
92 | struct user_iovec * uio_iovsaddr( uio_t a_uio ); | |
93 | __private_extern__ void uio_calculateresid( uio_t a_uio ); | |
94 | __private_extern__ void uio_setcurriovlen( uio_t a_uio, user_size_t a_value ); | |
95 | // uio_spacetype was __private_extern__ temporary chnage for 3777436 | |
96 | int uio_spacetype( uio_t a_uio ); | |
97 | __private_extern__ uio_t | |
98 | uio_createwithbuffer( int a_iovcount, off_t a_offset, int a_spacetype, | |
99 | int a_iodirection, void *a_buf_p, int a_buffer_size ); | |
100 | ||
101 | /* use kern_iovec for system space requests */ | |
102 | struct kern_iovec { | |
103 | u_int32_t iov_base; /* Base address. */ | |
104 | u_int32_t iov_len; /* Length. */ | |
105 | }; | |
106 | ||
107 | /* use user_iovec for user space requests */ | |
108 | struct user_iovec { | |
109 | user_addr_t iov_base; /* Base address. */ | |
110 | user_size_t iov_len; /* Length. */ | |
111 | }; | |
112 | ||
113 | #if 1 // LP64todo - remove this after kext adopt new KPI | |
114 | #define uio_iov uio_iovs.iovp | |
115 | #define iovec_32 kern_iovec | |
116 | #define iovec_64 user_iovec | |
117 | #define iov32p kiovp | |
118 | #define iov64p uiovp | |
119 | #endif | |
120 | ||
121 | union iovecs { | |
122 | struct iovec *iovp; | |
123 | struct kern_iovec *kiovp; | |
124 | struct user_iovec *uiovp; | |
125 | }; | |
126 | ||
127 | /* WARNING - use accessor calls for uio_iov and uio_resid since these */ | |
128 | /* fields vary depending on the originating address space. */ | |
129 | struct uio { | |
130 | union iovecs uio_iovs; /* current iovec */ | |
131 | int uio_iovcnt; /* active iovecs */ | |
132 | off_t uio_offset; | |
133 | int uio_resid; /* compatibility uio_resid (pre-LP64) */ | |
134 | enum uio_seg uio_segflg; | |
135 | enum uio_rw uio_rw; | |
136 | proc_t uio_procp; /* obsolete - not used! */ | |
137 | user_ssize_t uio_resid_64; | |
138 | int uio_size; /* size for use with kfree */ | |
139 | int uio_max_iovs; /* max number of iovecs this uio_t can hold */ | |
140 | u_int32_t uio_flags; | |
141 | }; | |
142 | ||
143 | /* values for uio_flags */ | |
144 | #define UIO_FLAGS_INITED 0x00000001 | |
145 | #define UIO_FLAGS_WE_ALLOCED 0x00000002 | |
146 | ||
147 | __END_DECLS | |
148 | ||
149 | /* | |
150 | * UIO_SIZEOF - return the amount of space a uio_t requires to | |
151 | * contain the given number of iovecs. Use this macro to | |
152 | * create a stack buffer that can be passed to uio_createwithbuffer. | |
153 | */ | |
154 | #define UIO_SIZEOF( a_iovcount ) \ | |
155 | ( sizeof(struct uio) + (sizeof(struct user_iovec) * (a_iovcount)) ) | |
156 | ||
157 | #define UIO_IS_64_BIT_SPACE( a_uio_t ) \ | |
158 | ( (a_uio_t)->uio_segflg == UIO_USERSPACE64 || (a_uio_t)->uio_segflg == UIO_USERISPACE64 || \ | |
159 | (a_uio_t)->uio_segflg == UIO_PHYS_USERSPACE64 || (a_uio_t)->uio_segflg == UIO_SYSSPACE64 || \ | |
160 | (a_uio_t)->uio_segflg == UIO_PHYS_SYSSPACE64 ) | |
161 | ||
162 | #define UIO_IS_32_BIT_SPACE( a_uio_t ) \ | |
163 | ( (a_uio_t)->uio_segflg == UIO_USERSPACE || (a_uio_t)->uio_segflg == UIO_USERISPACE || \ | |
164 | (a_uio_t)->uio_segflg == UIO_SYSSPACE || (a_uio_t)->uio_segflg == UIO_PHYS_USERSPACE || \ | |
165 | (a_uio_t)->uio_segflg == UIO_USERISPACE32 || (a_uio_t)->uio_segflg == UIO_PHYS_USERSPACE32 || \ | |
166 | (a_uio_t)->uio_segflg == UIO_SYSSPACE32 || (a_uio_t)->uio_segflg == UIO_PHYS_SYSSPACE32 || \ | |
167 | (a_uio_t)->uio_segflg == UIO_PHYS_SYSSPACE || (a_uio_t)->uio_segflg == UIO_USERSPACE32 ) | |
168 | ||
169 | #define UIO_IS_USER_SPACE32( a_uio_t ) \ | |
170 | ( (a_uio_t)->uio_segflg == UIO_USERSPACE32 || (a_uio_t)->uio_segflg == UIO_PHYS_USERSPACE32 || \ | |
171 | (a_uio_t)->uio_segflg == UIO_USERISPACE32 ) | |
172 | #define UIO_IS_USER_SPACE64( a_uio_t ) \ | |
173 | ( (a_uio_t)->uio_segflg == UIO_USERSPACE64 || (a_uio_t)->uio_segflg == UIO_PHYS_USERSPACE64 || \ | |
174 | (a_uio_t)->uio_segflg == UIO_USERISPACE64 ) | |
175 | #define UIO_IS_USER_SPACE( a_uio_t ) \ | |
176 | ( UIO_IS_USER_SPACE32((a_uio_t)) || UIO_IS_USER_SPACE64((a_uio_t)) || \ | |
177 | (a_uio_t)->uio_segflg == UIO_USERSPACE || (a_uio_t)->uio_segflg == UIO_USERISPACE || \ | |
178 | (a_uio_t)->uio_segflg == UIO_PHYS_USERSPACE ) | |
179 | ||
180 | ||
181 | /* | |
182 | * W A R N I N G!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
183 | * anything in this section will be removed. please move to the uio KPI | |
184 | */ | |
185 | ||
186 | #if 1 // UIO_KPI - WARNING OBSOLETE!!!! LP64todo - remove these!!!! | |
187 | // DO NOT USE THESE | |
188 | #define IS_UIO_USER_SPACE32( segflg ) \ | |
189 | ( (segflg) == UIO_USERSPACE32 || (segflg) == UIO_PHYS_USERSPACE32 || \ | |
190 | (segflg) == UIO_USERISPACE32 ) | |
191 | #define IS_UIO_USER_SPACE64( segflg ) \ | |
192 | ( (segflg) == UIO_USERSPACE64 || (segflg) == UIO_PHYS_USERSPACE64 || \ | |
193 | (segflg) == UIO_USERISPACE64 ) | |
194 | #define IS_UIO_USER_SPACE( segflg ) \ | |
195 | ( IS_UIO_USER_SPACE32((segflg)) || IS_UIO_USER_SPACE64((segflg)) || \ | |
196 | (segflg) == UIO_USERSPACE || (segflg) == UIO_USERISPACE || \ | |
197 | (segflg) == UIO_PHYS_USERSPACE ) | |
198 | ||
199 | #define IS_UIO_SYS_SPACE32( segflg ) \ | |
200 | ( (segflg) == UIO_SYSSPACE32 || (segflg) == UIO_PHYS_SYSSPACE32 || \ | |
201 | (segflg) == UIO_SYSSPACE || (segflg) == UIO_PHYS_SYSSPACE ) | |
202 | #define IS_UIO_SYS_SPACE64( segflg ) \ | |
203 | ( (segflg) == UIO_SYSSPACE64 || (segflg) == UIO_PHYS_SYSSPACE64 ) | |
204 | #define IS_UIO_SYS_SPACE( segflg ) \ | |
205 | ( IS_UIO_SYS_SPACE32((segflg)) || IS_UIO_SYS_SPACE64((segflg)) ) | |
206 | ||
207 | #define IS_OBSOLETE_UIO_SEGFLG(segflg) \ | |
208 | ( (segflg) == UIO_USERSPACE || (segflg) == UIO_USERISPACE || \ | |
209 | (segflg) == UIO_SYSSPACE || (segflg) == UIO_PHYS_USERSPACE || \ | |
210 | (segflg) == UIO_PHYS_SYSSPACE ) | |
211 | #define IS_VALID_UIO_SEGFLG(segflg) \ | |
212 | ( IS_UIO_USER_SPACE((segflg)) || IS_UIO_SYS_SPACE((segflg)) ) | |
213 | ||
214 | /* accessor routines for uio and embedded iovecs */ | |
215 | // WARNING all these are OBSOLETE!!!! | |
216 | static inline int64_t uio_uio_resid( struct uio *a_uiop ); | |
217 | static inline void uio_uio_resid_add( struct uio *a_uiop, int64_t a_amount ); | |
218 | static inline void uio_uio_resid_set( struct uio *a_uiop, int64_t a_value ); | |
219 | ||
220 | static inline void uio_iov_base_add( struct uio *a_uiop, int64_t a_amount ); | |
221 | static inline void uio_iov_base_add_at( struct uio *a_uiop, int64_t a_amount, int a_index ); | |
222 | static inline void uio_iov_len_add( struct uio *a_uiop, int64_t a_amount ); | |
223 | static inline void uio_iov_len_add_at( struct uio *a_uiop, int64_t a_amount, int a_index ); | |
224 | static inline u_int64_t uio_iov_len( struct uio *a_uiop ); | |
225 | static inline u_int64_t uio_iov_len_at( struct uio *a_uiop, int a_index ); | |
226 | static inline u_int64_t uio_iov_base( struct uio *a_uiop ); | |
227 | static inline u_int64_t uio_iov_base_at( struct uio *a_uiop, int a_index ); | |
228 | static inline void uio_next_iov( struct uio *a_uiop ); | |
229 | static inline void uio_iov_len_set( struct uio *a_uiop, u_int64_t a_value ); | |
230 | static inline void uio_iov_len_set_at( struct uio *a_uiop, u_int64_t a_value, int a_index ); | |
231 | ||
232 | ||
233 | static inline int64_t uio_uio_resid( struct uio *a_uiop ) | |
234 | { | |
235 | //#warning obsolete - use uio_resid call | |
236 | return( (int64_t)a_uiop->uio_resid ); | |
237 | } | |
238 | ||
239 | static inline void uio_uio_resid_add( struct uio *a_uiop, int64_t a_amount ) | |
240 | { | |
241 | //#warning obsolete - use uio_update or uio_addiov or uio_setresid if in kernel and you must | |
242 | a_uiop->uio_resid += ((int32_t) a_amount); | |
243 | } | |
244 | ||
245 | static inline void uio_uio_resid_set( struct uio *a_uiop, int64_t a_value ) | |
246 | { | |
247 | //#warning obsolete - use uio_update or uio_addiov or uio_setresid if in kernel and you must | |
248 | a_uiop->uio_resid = a_value; | |
249 | } | |
250 | ||
251 | static inline u_int64_t uio_iov_base( struct uio *a_uiop ) | |
252 | { | |
253 | //#warning obsolete - use uio_curriovbase call | |
254 | return(uio_iov_base_at(a_uiop, 0)); | |
255 | } | |
256 | ||
257 | static inline u_int64_t uio_iov_base_at( struct uio *a_uiop, int a_index ) | |
258 | { | |
259 | //#warning obsolete - use uio_curriovbase call | |
260 | if (IS_UIO_USER_SPACE32(a_uiop->uio_segflg) || IS_OBSOLETE_UIO_SEGFLG(a_uiop->uio_segflg)) { | |
261 | /* user space iovec was most likely a struct iovec so we must cast to uintptr_t first */ | |
262 | return((u_int64_t)((uintptr_t)a_uiop->uio_iovs.iov32p[a_index].iov_base)); | |
263 | } | |
264 | if (IS_UIO_SYS_SPACE32(a_uiop->uio_segflg)) { | |
265 | return((u_int64_t)a_uiop->uio_iovs.iov32p[a_index].iov_base); | |
266 | } | |
267 | if (IS_UIO_USER_SPACE64(a_uiop->uio_segflg) || IS_UIO_SYS_SPACE64(a_uiop->uio_segflg)) { | |
268 | return(a_uiop->uio_iovs.iov64p[a_index].iov_base); | |
269 | } | |
270 | return(0); | |
271 | } | |
272 | ||
273 | static inline u_int64_t uio_iov_len( struct uio *a_uiop ) | |
274 | { | |
275 | //#warning obsolete - use uio_curriovlen call | |
276 | return(uio_iov_len_at(a_uiop, 0)); | |
277 | } | |
278 | ||
279 | static inline u_int64_t uio_iov_len_at( struct uio *a_uiop, int a_index ) | |
280 | { | |
281 | //#warning obsolete - use uio_curriovlen call | |
282 | if (IS_UIO_USER_SPACE32(a_uiop->uio_segflg) || | |
283 | IS_UIO_SYS_SPACE32(a_uiop->uio_segflg) || | |
284 | IS_OBSOLETE_UIO_SEGFLG(a_uiop->uio_segflg)) { | |
285 | return((u_int64_t)a_uiop->uio_iovs.iov32p[a_index].iov_len); | |
286 | } | |
287 | if (IS_UIO_USER_SPACE64(a_uiop->uio_segflg) || IS_UIO_SYS_SPACE64(a_uiop->uio_segflg)) { | |
288 | return(a_uiop->uio_iovs.iov64p[a_index].iov_len); | |
289 | } | |
290 | return(0); | |
291 | } | |
292 | ||
293 | static inline void uio_iov_len_set_at( struct uio *a_uiop, u_int64_t a_value, int a_index ) | |
294 | { | |
295 | //#warning obsolete - use uio_addiov call | |
296 | if (IS_UIO_USER_SPACE32(a_uiop->uio_segflg) || | |
297 | IS_UIO_SYS_SPACE32(a_uiop->uio_segflg) || | |
298 | IS_OBSOLETE_UIO_SEGFLG(a_uiop->uio_segflg)) { | |
299 | a_uiop->uio_iovs.iov32p[a_index].iov_len = a_value; | |
300 | } | |
301 | else if (IS_UIO_USER_SPACE64(a_uiop->uio_segflg) || IS_UIO_SYS_SPACE64(a_uiop->uio_segflg)) { | |
302 | a_uiop->uio_iovs.iov64p[a_index].iov_len = a_value; | |
303 | } | |
304 | return; | |
305 | } | |
306 | ||
307 | static inline void uio_iov_len_set( struct uio *a_uiop, u_int64_t a_value ) | |
308 | { | |
309 | //#warning obsolete - use uio_addiov call | |
310 | return(uio_iov_len_set_at(a_uiop, a_value, 0)); | |
311 | } | |
312 | ||
313 | static inline void uio_iov_len_add_at( struct uio *a_uiop, int64_t a_amount, int a_index ) | |
314 | { | |
315 | //#warning obsolete - use uio_addiov call | |
316 | if (IS_UIO_USER_SPACE32(a_uiop->uio_segflg) || | |
317 | IS_UIO_SYS_SPACE32(a_uiop->uio_segflg) || | |
318 | IS_OBSOLETE_UIO_SEGFLG(a_uiop->uio_segflg)) { | |
319 | a_uiop->uio_iovs.iov32p[a_index].iov_len += ((int32_t) a_amount); | |
320 | } | |
321 | else if (IS_UIO_USER_SPACE64(a_uiop->uio_segflg) || IS_UIO_SYS_SPACE64(a_uiop->uio_segflg)) { | |
322 | a_uiop->uio_iovs.iov64p[a_index].iov_len += a_amount; | |
323 | } | |
324 | return; | |
325 | } | |
326 | ||
327 | static inline void uio_iov_len_add( struct uio *a_uiop, int64_t a_amount ) | |
328 | { | |
329 | //#warning obsolete - use uio_addiov call | |
330 | return(uio_iov_len_add_at(a_uiop, a_amount, 0)); | |
331 | } | |
332 | ||
333 | static inline void uio_iov_base_add_at( struct uio *a_uiop, int64_t a_amount, int a_index ) | |
334 | { | |
335 | //#warning obsolete - use uio_addiov call | |
336 | if (IS_UIO_USER_SPACE32(a_uiop->uio_segflg) || | |
337 | IS_UIO_SYS_SPACE32(a_uiop->uio_segflg) || | |
338 | IS_OBSOLETE_UIO_SEGFLG(a_uiop->uio_segflg)) { | |
339 | a_uiop->uio_iovs.iov32p[a_index].iov_base += ((int32_t) a_amount); | |
340 | } | |
341 | else if (IS_UIO_USER_SPACE64(a_uiop->uio_segflg) || IS_UIO_SYS_SPACE64(a_uiop->uio_segflg)) { | |
342 | a_uiop->uio_iovs.iov64p[a_index].iov_base += a_amount; | |
343 | } | |
344 | return; | |
345 | } | |
346 | ||
347 | static inline void uio_iov_base_add( struct uio *a_uiop, int64_t a_amount ) | |
348 | { | |
349 | //#warning obsolete - use uio_addiov call | |
350 | return(uio_iov_base_add_at(a_uiop, a_amount, 0)); | |
351 | } | |
352 | ||
353 | static inline void uio_next_iov( struct uio *a_uiop ) | |
354 | { | |
355 | //#warning obsolete - use uio_update call | |
356 | if (IS_UIO_USER_SPACE32(a_uiop->uio_segflg) || | |
357 | IS_UIO_SYS_SPACE32(a_uiop->uio_segflg) || | |
358 | IS_OBSOLETE_UIO_SEGFLG(a_uiop->uio_segflg)) { | |
359 | a_uiop->uio_iovs.iov32p++; | |
360 | } | |
361 | else if (IS_UIO_USER_SPACE64(a_uiop->uio_segflg) || IS_UIO_SYS_SPACE64(a_uiop->uio_segflg)) { | |
362 | a_uiop->uio_iovs.iov64p++; | |
363 | } | |
364 | return; | |
365 | } | |
366 | ||
367 | /* | |
368 | * WARNING - this routine relies on iovec_64 being larger than iovec_32 and will | |
369 | * not work if you are going to initialize an array of iovec_64 as an array of | |
370 | * iovec_32 then pass that array in a uio (since uio_iov is always expected to | |
371 | * be an array of like sized iovecs - see how uio_next_iov gets to the next iovec) | |
372 | */ | |
373 | static inline void init_iovec( u_int64_t a_base, | |
374 | u_int64_t a_len, | |
375 | struct iovec_64 *a_iovp, | |
376 | int is_64bit_process ) | |
377 | { | |
378 | //#warning obsolete - use uio_create call | |
379 | if (is_64bit_process) { | |
380 | a_iovp->iov_base = a_base; | |
381 | a_iovp->iov_len = a_len; | |
382 | } | |
383 | else { | |
384 | struct iovec_32 *a_iov32p = (struct iovec_32 *) a_iovp; | |
385 | a_iov32p->iov_base = a_base; | |
386 | a_iov32p->iov_len = a_len; | |
387 | } | |
388 | return; | |
389 | } | |
390 | ||
391 | #define INIT_UIO_BASE( uiop, iovcnt, offset, resid, rw, procp ) \ | |
392 | { \ | |
393 | (uiop)->uio_iovcnt = (iovcnt); \ | |
394 | (uiop)->uio_offset = (offset); \ | |
395 | (uiop)->uio_resid = (resid); \ | |
396 | (uiop)->uio_rw = (rw); \ | |
397 | (uiop)->uio_procp = (procp); \ | |
398 | } | |
399 | #define INIT_UIO_USER32( uiop, iovp, iovcnt, offset, resid, rw, procp ) \ | |
400 | { \ | |
401 | (uiop)->uio_iovs.iov32p = (iovp); \ | |
402 | (uiop)->uio_segflg = UIO_USERSPACE; \ | |
403 | INIT_UIO_BASE((uiop), (iovcnt), (offset), (resid), (rw), (procp)); \ | |
404 | } | |
405 | #define INIT_UIO_USER64( uiop, iovp, iovcnt, offset, resid, rw, procp ) \ | |
406 | { \ | |
407 | (uiop)->uio_iovs.iov64p = (iovp); \ | |
408 | (uiop)->uio_segflg = UIO_USERSPACE64; \ | |
409 | INIT_UIO_BASE((uiop), (iovcnt), (offset), (resid), (rw), (procp)); \ | |
410 | } | |
411 | #define INIT_UIO_SYS32( uiop, iovp, iovcnt, offset, resid, rw, procp ) \ | |
412 | { \ | |
413 | (uiop)->uio_iovs.iov32p = (iovp); \ | |
414 | (uiop)->uio_segflg = UIO_SYSSPACE; \ | |
415 | INIT_UIO_BASE((uiop), (iovcnt), (offset), (resid), (rw), (procp)); \ | |
416 | } | |
417 | #define INIT_UIO_USERSPACE( uiop, iovp, iovcnt, offset, resid, rw, procp ) \ | |
418 | { \ | |
419 | if (IS_64BIT_PROCESS((procp))) { \ | |
420 | (uiop)->uio_iovs.iov64p = (iovp); \ | |
421 | (uiop)->uio_segflg = UIO_USERSPACE64; \ | |
422 | } \ | |
423 | else { \ | |
424 | (uiop)->uio_iovs.iov32p = (struct iovec_32 *)(iovp); \ | |
425 | (uiop)->uio_segflg = UIO_USERSPACE; \ | |
426 | } \ | |
427 | INIT_UIO_BASE((uiop), (iovcnt), (offset), (resid), (rw), (procp)); \ | |
428 | } | |
429 | #define INIT_UIO_SYSSPACE( uiop, iovp, iovcnt, offset, resid, rw, procp ) \ | |
430 | { \ | |
431 | if (0) { /* we do not support 64-bit system space yet */ \ | |
432 | (uiop)->uio_iovs.iov64p = (iovp); \ | |
433 | (uiop)->uio_segflg = UIO_SYSSPACE64; \ | |
434 | } \ | |
435 | else { \ | |
436 | (uiop)->uio_iovs.iov32p = (struct iovec_32 *)(iovp); \ | |
437 | (uiop)->uio_segflg = UIO_SYSSPACE; \ | |
438 | } \ | |
439 | INIT_UIO_BASE((uiop), (iovcnt), (offset), (resid), (rw), (procp)); \ | |
440 | } | |
441 | #endif // UIO_KPI - WARNING OBSOLETE!!!! | |
442 | ||
443 | ||
444 | #endif /* KERNEL */ | |
445 | #endif /* !_SYS_UIO_INTERNAL_H_ */ |