]>
Commit | Line | Data |
---|---|---|
716154c5 BB |
1 | /*****************************************************************************\ |
2 | * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. | |
3 | * Copyright (C) 2007 The Regents of the University of California. | |
f6188ddd | 4 | * Copyright (c) 2015 by Chunwei Chen. All rights reserved. |
716154c5 BB |
5 | * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). |
6 | * Written by Brian Behlendorf <behlendorf1@llnl.gov>. | |
7 | * UCRL-CODE-235197 | |
8 | * | |
9 | * This file is part of the SPL, Solaris Porting Layer. | |
3d6af2dd | 10 | * For details, see <http://zfsonlinux.org/>. |
716154c5 BB |
11 | * |
12 | * The SPL is free software; you can redistribute it and/or modify it | |
13 | * under the terms of the GNU General Public License as published by the | |
14 | * Free Software Foundation; either version 2 of the License, or (at your | |
15 | * option) any later version. | |
16 | * | |
17 | * The SPL is distributed in the hope that it will be useful, but WITHOUT | |
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
19 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
20 | * for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU General Public License along | |
23 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
24 | \*****************************************************************************/ | |
25 | ||
6adf99e7 | 26 | #ifndef _SPL_UIO_H |
27 | #define _SPL_UIO_H | |
28 | ||
73e540a0 | 29 | #include <linux/uio.h> |
f6188ddd | 30 | #include <linux/blkdev.h> |
73e540a0 | 31 | #include <asm/uaccess.h> |
32 | #include <sys/types.h> | |
33 | ||
bb1bb2c4 BB |
34 | typedef struct iovec iovec_t; |
35 | ||
4b171585 | 36 | typedef enum uio_rw { |
37 | UIO_READ = 0, | |
38 | UIO_WRITE = 1, | |
39 | } uio_rw_t; | |
6adf99e7 | 40 | |
73e540a0 | 41 | typedef enum uio_seg { |
42 | UIO_USERSPACE = 0, | |
43 | UIO_SYSSPACE = 1, | |
bb1bb2c4 | 44 | UIO_USERISPACE= 2, |
f6188ddd | 45 | UIO_BVEC = 3, |
73e540a0 | 46 | } uio_seg_t; |
47 | ||
48 | typedef struct uio { | |
f6188ddd AX |
49 | union { |
50 | const struct iovec *uio_iov; | |
51 | const struct bio_vec *uio_bvec; | |
52 | }; | |
bb1bb2c4 BB |
53 | int uio_iovcnt; |
54 | offset_t uio_loffset; | |
55 | uio_seg_t uio_segflg; | |
56 | uint16_t uio_fmode; | |
57 | uint16_t uio_extflg; | |
58 | offset_t uio_limit; | |
59 | ssize_t uio_resid; | |
f6188ddd | 60 | size_t uio_skip; |
73e540a0 | 61 | } uio_t; |
62 | ||
63 | typedef struct aio_req { | |
bb1bb2c4 | 64 | uio_t *aio_uio; |
73e540a0 | 65 | void *aio_private; |
66 | } aio_req_t; | |
67 | ||
bb1bb2c4 BB |
68 | typedef enum xuio_type { |
69 | UIOTYPE_ASYNCIO, | |
70 | UIOTYPE_ZEROCOPY, | |
71 | } xuio_type_t; | |
72 | ||
73 | ||
74 | #define UIOA_IOV_MAX 16 | |
75 | ||
76 | typedef struct uioa_page_s { | |
77 | int uioa_pfncnt; | |
78 | void **uioa_ppp; | |
79 | caddr_t uioa_base; | |
80 | size_t uioa_len; | |
81 | } uioa_page_t; | |
82 | ||
83 | typedef struct xuio { | |
84 | uio_t xu_uio; | |
85 | enum xuio_type xu_type; | |
86 | union { | |
87 | struct { | |
88 | uint32_t xu_a_state; | |
89 | ssize_t xu_a_mbytes; | |
90 | uioa_page_t *xu_a_lcur; | |
91 | void **xu_a_lppp; | |
92 | void *xu_a_hwst[4]; | |
93 | uioa_page_t xu_a_locked[UIOA_IOV_MAX]; | |
94 | } xu_aio; | |
95 | ||
96 | struct { | |
97 | int xu_zc_rw; | |
98 | void *xu_zc_priv; | |
99 | } xu_zc; | |
100 | } xu_ext; | |
101 | } xuio_t; | |
102 | ||
103 | #define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv | |
104 | #define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw | |
105 | ||
6adf99e7 | 106 | #endif /* SPL_UIO_H */ |