]> granicus.if.org Git - zfs/commitdiff
Add xuio_* structures and typedefs.
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 11 Jun 2010 22:02:24 +0000 (15:02 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 11 Jun 2010 22:57:25 +0000 (15:57 -0700)
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.

include/sys/uio.h

index 83e9cc62af1c11cb35593402bbb943ca836e3b6b..87da72701c3cef244fd8d3f550c54ef597af6005 100644 (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_USERISPACE2,
 } 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 */