Add xuio_* structures and typedefs.

Add the basic xuio structure and typedefs for Solaris style zero copy.
There's a decent chance this will not be the way I handle this on Linux
but providing the basic types simplifies things for now.
This commit is contained in:
Brian Behlendorf 2010-06-11 15:02:24 -07:00
parent 750a7101f8
commit bb1bb2c4c4
1 changed files with 50 additions and 10 deletions

View File

@ -29,6 +29,8 @@
#include <asm/uaccess.h>
#include <sys/types.h>
typedef struct iovec iovec_t;
typedef enum uio_rw {
UIO_READ = 0,
UIO_WRITE = 1,
@ -37,23 +39,61 @@ typedef enum uio_rw {
typedef enum uio_seg {
UIO_USERSPACE = 0,
UIO_SYSSPACE = 1,
UIO_USERISPACE =2,
UIO_USERISPACE= 2,
} uio_seg_t;
typedef struct uio {
struct iovec *uio_iov; /* pointer to array of iovecs */
int uio_iovcnt; /* number of iovecs */
offset_t uio_loffset; /* file offset */
uio_seg_t uio_segflg; /* address space (kernel or user) */
uint16_t uio_fmode; /* file mode flags */
uint16_t uio_extflg; /* extended flags */
offset_t uio_limit; /* u-limit (maximum byte offset) */
ssize_t uio_resid; /* residual count */
struct iovec *uio_iov;
int uio_iovcnt;
offset_t uio_loffset;
uio_seg_t uio_segflg;
uint16_t uio_fmode;
uint16_t uio_extflg;
offset_t uio_limit;
ssize_t uio_resid;
} uio_t;
typedef struct aio_req {
uio_t *aio_uio; /* UIO for this request */
uio_t *aio_uio;
void *aio_private;
} aio_req_t;
typedef enum xuio_type {
UIOTYPE_ASYNCIO,
UIOTYPE_ZEROCOPY,
} xuio_type_t;
#define UIOA_IOV_MAX 16
typedef struct uioa_page_s {
int uioa_pfncnt;
void **uioa_ppp;
caddr_t uioa_base;
size_t uioa_len;
} uioa_page_t;
typedef struct xuio {
uio_t xu_uio;
enum xuio_type xu_type;
union {
struct {
uint32_t xu_a_state;
ssize_t xu_a_mbytes;
uioa_page_t *xu_a_lcur;
void **xu_a_lppp;
void *xu_a_hwst[4];
uioa_page_t xu_a_locked[UIOA_IOV_MAX];
} xu_aio;
struct {
int xu_zc_rw;
void *xu_zc_priv;
} xu_zc;
} xu_ext;
} xuio_t;
#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv
#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw
#endif /* SPL_UIO_H */