]> git.proxmox.com Git - mirror_spl-debian.git/blob - include/sys/uio.h
New upstream version 0.7.8
[mirror_spl-debian.git] / include / sys / uio.h
1 /*****************************************************************************\
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Copyright (c) 2015 by Chunwei Chen. All rights reserved.
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.
10 * For details, see <http://zfsonlinux.org/>.
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
26 #ifndef _SPL_UIO_H
27 #define _SPL_UIO_H
28
29 #include <linux/uio.h>
30 #include <linux/blkdev.h>
31 #include <asm/uaccess.h>
32 #include <sys/types.h>
33
34 typedef struct iovec iovec_t;
35
36 typedef enum uio_rw {
37 UIO_READ = 0,
38 UIO_WRITE = 1,
39 } uio_rw_t;
40
41 typedef enum uio_seg {
42 UIO_USERSPACE = 0,
43 UIO_SYSSPACE = 1,
44 UIO_USERISPACE = 2,
45 UIO_BVEC = 3,
46 } uio_seg_t;
47
48 typedef struct uio {
49 union {
50 const struct iovec *uio_iov;
51 const struct bio_vec *uio_bvec;
52 };
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;
60 size_t uio_skip;
61 } uio_t;
62
63 typedef struct aio_req {
64 uio_t *aio_uio;
65 void *aio_private;
66 } aio_req_t;
67
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
106 #endif /* SPL_UIO_H */