]>
Commit | Line | Data |
---|---|---|
a26baf28 BB |
1 | /* |
2 | * CDDL HEADER START | |
3 | * | |
4 | * The contents of this file are subject to the terms of the | |
5 | * Common Development and Distribution License, Version 1.0 only | |
6 | * (the "License"). You may not use this file except in compliance | |
7 | * with the License. | |
8 | * | |
9 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
10 | * or http://www.opensolaris.org/os/licensing. | |
11 | * See the License for the specific language governing permissions | |
12 | * and limitations under the License. | |
13 | * | |
14 | * When distributing Covered Code, include this CDDL HEADER in each | |
15 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. | |
16 | * If applicable, add the following below this CDDL HEADER, with the | |
17 | * fields enclosed by brackets "[]" replaced with your own identifying | |
18 | * information: Portions Copyright [yyyy] [name of copyright owner] | |
19 | * | |
20 | * CDDL HEADER END | |
21 | */ | |
22 | /* | |
23 | * Copyright 2005 Sun Microsystems, Inc. All rights reserved. | |
24 | * Use is subject to license terms. | |
25 | */ | |
26 | ||
27 | /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ | |
28 | /* All Rights Reserved */ | |
29 | ||
30 | /* | |
31 | * University Copyright- Copyright (c) 1982, 1986, 1988 | |
32 | * The Regents of the University of California | |
33 | * All Rights Reserved | |
34 | * | |
35 | * University Acknowledgment- Portions of this document are derived from | |
36 | * software developed by the University of California, Berkeley, and its | |
37 | * contributors. | |
38 | */ | |
39 | ||
40 | #ifndef _LIBSPL_SYS_UIO_H | |
41 | #define _LIBSPL_SYS_UIO_H | |
42 | ||
43 | #include_next <sys/uio.h> | |
44 | ||
45 | typedef struct iovec iovec_t; | |
46 | ||
47 | typedef enum uio_rw { | |
d1d7e268 MK |
48 | UIO_READ = 0, |
49 | UIO_WRITE = 1, | |
a26baf28 BB |
50 | } uio_rw_t; |
51 | ||
52 | typedef enum uio_seg { | |
d1d7e268 MK |
53 | UIO_USERSPACE = 0, |
54 | UIO_SYSSPACE = 1, | |
55 | UIO_USERISPACE = 2, | |
a26baf28 BB |
56 | } uio_seg_t; |
57 | ||
58 | typedef struct uio { | |
59 | struct iovec *uio_iov; /* pointer to array of iovecs */ | |
60 | int uio_iovcnt; /* number of iovecs */ | |
61 | offset_t uio_loffset; /* file offset */ | |
62 | uio_seg_t uio_segflg; /* address space (kernel or user) */ | |
63 | uint16_t uio_fmode; /* file mode flags */ | |
64 | uint16_t uio_extflg; /* extended flags */ | |
65 | offset_t uio_limit; /* u-limit (maximum byte offset) */ | |
66 | ssize_t uio_resid; /* residual count */ | |
67 | } uio_t; | |
68 | ||
69 | typedef enum xuio_type { | |
70 | UIOTYPE_ASYNCIO, | |
71 | UIOTYPE_ZEROCOPY, | |
72 | } xuio_type_t; | |
73 | ||
74 | #define UIOA_IOV_MAX 16 | |
75 | ||
76 | typedef struct uioa_page_s { /* locked uio_iov state */ | |
77 | int uioa_pfncnt; /* count of pfn_t(s) in *uioa_ppp */ | |
78 | void **uioa_ppp; /* page_t or pfn_t arrary */ | |
79 | caddr_t uioa_base; /* address base */ | |
80 | size_t uioa_len; /* span length */ | |
81 | } uioa_page_t; | |
82 | ||
83 | typedef struct xuio { | |
84 | uio_t xu_uio; /* embedded UIO structure */ | |
85 | ||
86 | /* Extended uio fields */ | |
87 | enum xuio_type xu_type; /* uio type */ | |
88 | union { | |
89 | struct { | |
90 | uint32_t xu_a_state; /* state of async i/o */ | |
91 | ssize_t xu_a_mbytes; /* bytes moved */ | |
92 | uioa_page_t *xu_a_lcur; /* uioa_locked[] pointer */ | |
93 | void **xu_a_lppp; /* lcur->uioa_pppp[] pointer */ | |
94 | void *xu_a_hwst[4]; /* opaque hardware state */ | |
95 | uioa_page_t xu_a_locked[UIOA_IOV_MAX]; | |
96 | } xu_aio; | |
97 | ||
98 | struct { | |
99 | int xu_zc_rw; /* read or write buffer */ | |
100 | void *xu_zc_priv; /* fs specific */ | |
101 | } xu_zc; | |
102 | } xu_ext; | |
103 | } xuio_t; | |
104 | ||
d1d7e268 MK |
105 | #define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv |
106 | #define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw | |
a26baf28 BB |
107 | |
108 | #endif /* _SYS_UIO_H */ |