1 /* $NetBSD$ */ 2 3 /* 4 * File "uio.h" is part of the UDFclient toolkit. 5 * File $Id: uio.h,v 1.6 2011/02/01 20:43:41 reinoud Exp $ $Name: $ 6 * 7 * Copyright (c) 2004, 2005, 2006, 2011 8 * Reinoud Zandijk <reinoud@netbsd.org> 9 * All rights reserved. 10 * 11 * The UDFclient toolkit is distributed under the Clarified Artistic Licence. 12 * A copy of the licence is included in the distribution as 13 * `LICENCE.clearified.artistic' and a copy of the licence can also be 14 * requested at the GNU foundantion's website. 15 * 16 * Visit the UDFclient toolkit homepage http://www.13thmonkey.org/udftoolkit/ 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 */ 30 31 #ifndef _SYS_UIO_H_ 32 #define _SYS_UIO_H_ 33 34 #include <sys/types.h> 35 #include <inttypes.h> 36 37 38 /* define an uio structure for fragmenting reading in and writing data out */ 39 /* modelled after BSD's kernel structures */ 40 enum uio_rw { 41 UIO_READ, 42 UIO_WRITE 43 }; 44 45 46 struct iovec { 47 void *iov_base; /* base if this chunk */ 48 size_t iov_len; /* length */ 49 }; 50 51 52 /* this is consumed !! i.e. keep a copy */ 53 struct uio { 54 struct iovec *uio_iov; /* pointer to array of iovecs */ 55 int uio_iovcnt; /* number of iovecs in array */ 56 off_t uio_offset; /* current offset */ 57 size_t uio_resid; /* residual i/o count */ 58 enum uio_rw uio_rw; /* read/write direction */ 59 /* ... rest obmitted ... */ 60 }; 61 62 63 #endif /* _SYS_UIO_H_ */ 64 65 /* allways declare the functions */ 66 67 68 /* move data from/to a uio structure to a blob */ 69 extern int uiomove(void *buf, size_t amount, struct uio *uio); 70 71 72 /* end of uio.h */ 73