Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/uio.h
+++ new/usr/src/uts/common/sys/uio.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 + *
22 24 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 25 * Use is subject to license terms.
24 26 */
25 27
26 28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 29 /* All Rights Reserved */
28 30
29 31 /*
30 32 * University Copyright- Copyright (c) 1982, 1986, 1988
31 33 * The Regents of the University of California
32 34 * All Rights Reserved
33 35 *
34 36 * University Acknowledgment- Portions of this document are derived from
35 37 * software developed by the University of California, Berkeley, and its
36 38 * contributors.
37 39 */
38 40
39 41 #ifndef _SYS_UIO_H
40 42 #define _SYS_UIO_H
41 43
42 44 #include <sys/feature_tests.h>
43 45
44 46 #ifdef __cplusplus
45 47 extern "C" {
46 48 #endif
47 49
48 50 #include <sys/types.h>
49 51
50 52 /*
51 53 * I/O parameter information. A uio structure describes the I/O which
52 54 * is to be performed by an operation. Typically the data movement will
53 55 * be performed by a routine such as uiomove(), which updates the uio
54 56 * structure to reflect what was done.
55 57 */
56 58
57 59 #if defined(_XPG4_2)
58 60 typedef struct iovec {
59 61 void *iov_base;
60 62 size_t iov_len;
61 63 } iovec_t;
62 64 #else
63 65 typedef struct iovec {
64 66 caddr_t iov_base;
65 67 #if defined(_LP64)
66 68 size_t iov_len;
67 69 #else
68 70 long iov_len;
69 71 #endif
70 72 } iovec_t;
71 73 #endif /* defined(_XPG4_2) */
72 74
73 75 #if defined(_SYSCALL32)
74 76
75 77 /* Kernel's view of user ILP32 iovec struct */
76 78
77 79 typedef struct iovec32 {
78 80 caddr32_t iov_base;
79 81 int32_t iov_len;
80 82 } iovec32_t;
81 83
82 84 #endif /* _SYSCALL32 */
83 85
84 86 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
85 87 /*
86 88 * Segment flag values.
87 89 */
88 90 typedef enum uio_seg { UIO_USERSPACE, UIO_SYSSPACE, UIO_USERISPACE } uio_seg_t;
89 91
90 92 typedef struct uio {
91 93 iovec_t *uio_iov; /* pointer to array of iovecs */
92 94 int uio_iovcnt; /* number of iovecs */
93 95 lloff_t _uio_offset; /* file offset */
94 96 uio_seg_t uio_segflg; /* address space (kernel or user) */
95 97 uint16_t uio_fmode; /* file mode flags */
96 98 uint16_t uio_extflg; /* extended flags */
97 99 lloff_t _uio_limit; /* u-limit (maximum byte offset) */
98 100 ssize_t uio_resid; /* residual count */
99 101 } uio_t;
100 102
101 103 /*
102 104 * Extended uio_t uioa_t used for asynchronous uio.
103 105 *
104 106 * Note: UIOA_IOV_MAX is defined and used as it is in "fs/vncalls.c"
105 107 * as there isn't a formal definition of IOV_MAX for the kernel.
106 108 */
107 109 #define UIOA_IOV_MAX 16
108 110
109 111 typedef struct uioa_page_s { /* locked uio_iov state */
110 112 int uioa_pfncnt; /* count of pfn_t(s) in *uioa_ppp */
111 113 void **uioa_ppp; /* page_t or pfn_t arrary */
112 114 caddr_t uioa_base; /* address base */
113 115 size_t uioa_len; /* span length */
114 116 } uioa_page_t;
115 117
116 118 typedef struct uioa_s {
117 119 iovec_t *uio_iov; /* pointer to array of iovecs */
118 120 int uio_iovcnt; /* number of iovecs */
119 121 lloff_t _uio_offset; /* file offset */
120 122 uio_seg_t uio_segflg; /* address space (kernel or user) */
121 123 uint16_t uio_fmode; /* file mode flags */
122 124 uint16_t uio_extflg; /* extended flags */
123 125 lloff_t _uio_limit; /* u-limit (maximum byte offset) */
124 126 ssize_t uio_resid; /* residual count */
125 127 /*
126 128 * uioa extended members.
127 129 */
128 130 uint32_t uioa_state; /* state of asynch i/o */
129 131 ssize_t uioa_mbytes; /* bytes that have been uioamove()ed */
130 132 uioa_page_t *uioa_lcur; /* pointer into uioa_locked[] */
131 133 void **uioa_lppp; /* pointer into lcur->uioa_ppp[] */
132 134 void *uioa_hwst[4]; /* opaque hardware state */
133 135 uioa_page_t uioa_locked[UIOA_IOV_MAX]; /* Per iov locked pages */
134 136 } uioa_t;
135 137
136 138 /*
137 139 * uio extensions
138 140 *
139 141 * PSARC 2009/478: Copy Reduction Interfaces
140 142 */
141 143 typedef enum xuio_type {
142 144 UIOTYPE_ASYNCIO,
143 145 UIOTYPE_ZEROCOPY
144 146 } xuio_type_t;
145 147
146 148 typedef struct xuio {
147 149 uio_t xu_uio; /* Embedded UIO structure */
148 150
149 151 /* Extended uio fields */
150 152 enum xuio_type xu_type; /* What kind of uio structure? */
151 153 union {
152 154 /* Async I/O Support, intend to replace uioa_t. */
153 155 struct {
154 156 uint32_t xu_a_state; /* state of async i/o */
155 157 /* bytes that have been uioamove()ed */
156 158 ssize_t xu_a_mbytes;
157 159 uioa_page_t *xu_a_lcur; /* pointer into uioa_locked[] */
158 160 /* pointer into lcur->uioa_ppp[] */
159 161 void **xu_a_lppp;
160 162 void *xu_a_hwst[4]; /* opaque hardware state */
161 163 /* Per iov locked pages */
162 164 uioa_page_t xu_a_locked[UIOA_IOV_MAX];
163 165 } xu_aio;
164 166
165 167 /*
166 168 * Copy Reduction Support -- facilate loaning / returning of
167 169 * filesystem cache buffers.
168 170 */
169 171 struct {
170 172 int xu_zc_rw; /* read or write buffer */
171 173 void *xu_zc_priv; /* fs specific */
172 174 } xu_zc;
173 175 } xu_ext;
174 176 } xuio_t;
175 177
176 178 #define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv
177 179 #define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw
178 180
179 181 #define UIOA_ALLOC 0x0001 /* allocated but not yet initialized */
180 182 #define UIOA_INIT 0x0002 /* initialized but not yet enabled */
181 183 #define UIOA_ENABLED 0x0004 /* enabled, asynch i/o active */
182 184 #define UIOA_FINI 0x0008 /* finished waiting for uioafini() */
183 185
184 186 #define UIOA_CLR (~0x000F) /* clear mutually exclusive bits */
185 187
186 188 #define UIOA_POLL 0x0010 /* need dcopy_poll() */
187 189
188 190 #define uio_loffset _uio_offset._f
189 191 #if !defined(_LP64)
190 192 #define uio_offset _uio_offset._p._l
191 193 #else
192 194 #define uio_offset uio_loffset
193 195 #endif
194 196
195 197 #define uio_llimit _uio_limit._f
196 198 #if !defined(_LP64)
197 199 #define uio_limit _uio_limit._p._l
198 200 #else
199 201 #define uio_limit uio_llimit
200 202 #endif
201 203
202 204 /*
203 205 * I/O direction.
204 206 */
205 207 typedef enum uio_rw { UIO_READ, UIO_WRITE } uio_rw_t;
206 208
207 209 /*
208 210 * uio_extflg: extended flags
209 211 *
210 212 * NOTE: This flag will be used in uiomove to determine if non-temporal
211 213 * access, ie, access bypassing caches, should be used. Filesystems that
212 214 * don't initialize this field could experience suboptimal performance due to
213 215 * the random data the field contains.
214 216 *
215 217 * NOTE: This flag is also used by uioasync callers to pass an extended
216 218 * uio_t (uioa_t), to uioasync enabled consumers. Unlike above all
217 219 * consumers of a uioa_t require the uio_extflg to be initialized.
218 220 */
219 221 #define UIO_COPY_DEFAULT 0x0000 /* no special options to copy */
220 222 #define UIO_COPY_CACHED 0x0001 /* copy should not bypass caches */
221 223
222 224 #define UIO_ASYNC 0x0002 /* uio_t is really a uioa_t */
223 225 #define UIO_XUIO 0x0004 /* Structure is xuio_t */
224 226
225 227 /*
226 228 * Global uioasync capability shadow state.
227 229 */
228 230 typedef struct uioasync_s {
229 231 boolean_t enabled; /* Is uioasync enabled? */
230 232 size_t mincnt; /* Minimum byte count for use of */
231 233 } uioasync_t;
232 234
233 235 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
234 236
235 237 #if defined(_KERNEL)
236 238
237 239 int uiomove(void *, size_t, enum uio_rw, uio_t *);
238 240 void uio_prefaultpages(ssize_t, uio_t *);
239 241 int uiocopy(void *, size_t, enum uio_rw, uio_t *, size_t *);
240 242 int ureadc(int, uio_t *); /* should be errno_t in future */
241 243 int uwritec(struct uio *);
↓ open down ↓ |
210 lines elided |
↑ open up ↑ |
242 244 void uioskip(uio_t *, size_t);
243 245 int uiodup(uio_t *, uio_t *, iovec_t *, int);
244 246
245 247 int uioamove(void *, size_t, enum uio_rw, uioa_t *);
246 248 int uioainit(uio_t *, uioa_t *);
247 249 int uioafini(uio_t *, uioa_t *);
248 250 extern uioasync_t uioasync;
249 251
250 252 #else /* defined(_KERNEL) */
251 253
252 -#if defined(__STDC__)
253 -
254 254 extern ssize_t readv(int, const struct iovec *, int);
255 255 extern ssize_t writev(int, const struct iovec *, int);
256 256
257 -#else /* defined(__STDC__) */
258 -
259 -extern ssize_t readv();
260 -extern ssize_t writev();
261 -
262 -#endif /* defined(__STDC__) */
263 -
264 257 #endif /* defined(_KERNEL) */
265 258
266 259 #ifdef __cplusplus
267 260 }
268 261 #endif
269 262
270 263 #endif /* _SYS_UIO_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX