Annotation of src/sys/sys/xio.h, revision 1.1

1.1     ! dillon      1: /*
        !             2:  * Copyright (c) 2004 Matthew Dillon <dillon@backplane.com>
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms, with or without
        !             6:  * modification, are permitted provided that the following conditions
        !             7:  * are met:
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer.
        !            10:  * 2. Redistributions in binary form must reproduce the above copyright
        !            11:  *    notice, this list of conditions and the following disclaimer in the
        !            12:  *    documentation and/or other materials provided with the distribution.
        !            13:  *
        !            14:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
        !            15:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            16:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            17:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
        !            18:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            19:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            20:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            21:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            22:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            23:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            24:  * SUCH DAMAGE.
        !            25:  *
        !            26:  * $DragonFly$
        !            27:  */
        !            28: 
        !            29: /*
        !            30:  * The XIO structure is intended to replace UIO for messaged I/O operations
        !            31:  * within the kernel.  The originator of the transaction must supply an XIO
        !            32:  * structure containing a list of appropriate held vm_page's representing
        !            33:  * the buffer.  The target of the transaction will generally map the
        !            34:  * pages using the SF_BUF facility, complete the operation, and reply the
        !            35:  * message.
        !            36:  */
        !            37: #ifndef _SYS_XIO_H_
        !            38: #define        _SYS_XIO_H_
        !            39: 
        !            40: #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
        !            41: 
        !            42: #ifndef _SYS_MSGPORT_H_
        !            43: #include <sys/msgport.h>
        !            44: #endif
        !            45: 
        !            46: #define XIO_INTERNAL_PAGES     btoc(MAXPHYS)
        !            47: #define XIO_INTERNAL_SIZE      (XIO_INTERNAL_PAGES * PAGE_SIZE)
        !            48: 
        !            49: struct vm_page;
        !            50: 
        !            51: struct xio {
        !            52:        struct vm_page **xio_pages;
        !            53:        int     xio_npages;     /* number of pages in xio_pages[] array */
        !            54:        int     xio_offset;     /* byte offset (may exceed a page) */
        !            55:        int     xio_bytes;      /* number of bytes to transfer */
        !            56:        int     xio_flags;
        !            57:        int     xio_error;
        !            58:        struct vm_page *xio_internal_pages[XIO_INTERNAL_PAGES];
        !            59: };
        !            60: 
        !            61: typedef struct xio *xio_t;
        !            62: 
        !            63: #define XIOF_READ      0x0001
        !            64: #define XIOF_WRITE     0x0002
        !            65: 
        !            66: #endif
        !            67: 
        !            68: #if defined(_KERNEL)
        !            69: 
        !            70: int xio_init_ubuf(xio_t xio, void *ubase, size_t ubytes, int vmprot);
        !            71: int xio_init_kbuf(xio_t xio, void *kbase, size_t kbytes);
        !            72: void xio_release(xio_t xio);
        !            73: int xio_uio_copy(xio_t xio, struct uio *uio, int *sizep);
        !            74: int xio_copy_xtou(xio_t xio, void *uptr, int bytes);
        !            75: int xio_copy_xtok(xio_t xio, void *kptr, int bytes);
        !            76: 
        !            77: #endif /* _KERNEL */
        !            78: 
        !            79: #endif /* !_SYS_UIO_H_ */