uio.h revision 184698
1168404Spjd/*- 2168404Spjd * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3168404Spjd * All rights reserved. 4168404Spjd * 5168404Spjd * Redistribution and use in source and binary forms, with or without 6168404Spjd * modification, are permitted provided that the following conditions 7168404Spjd * are met: 8168404Spjd * 1. Redistributions of source code must retain the above copyright 9168404Spjd * notice, this list of conditions and the following disclaimer. 10168404Spjd * 2. Redistributions in binary form must reproduce the above copyright 11168404Spjd * notice, this list of conditions and the following disclaimer in the 12168404Spjd * documentation and/or other materials provided with the distribution. 13168404Spjd * 14168404Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 15168404Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16168404Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17168404Spjd * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 18168404Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19168404Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20168404Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21168404Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22168404Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23168404Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24168404Spjd * SUCH DAMAGE. 25168404Spjd * 26168404Spjd * $FreeBSD: head/sys/cddl/compat/opensolaris/sys/uio.h 184698 2008-11-05 19:39:11Z rodrigc $ 27168404Spjd */ 28168404Spjd 29168404Spjd#ifndef _OPENSOLARIS_SYS_UIO_H_ 30168404Spjd#define _OPENSOLARIS_SYS_UIO_H_ 31168404Spjd 32168404Spjd#include_next <sys/uio.h> 33168404Spjd#include <sys/debug.h> 34168404Spjd 35168404Spjd#ifndef _KERNEL 36168404Spjd#define FOF_OFFSET 1 /* Use the offset in uio argument */ 37168404Spjd 38168404Spjdstruct uio { 39168404Spjd struct iovec *uio_iov; 40168404Spjd int uio_iovcnt; 41168404Spjd off_t uio_offset; 42168404Spjd int uio_resid; 43168404Spjd enum uio_seg uio_segflg; 44168404Spjd enum uio_rw uio_rw; 45168404Spjd void *uio_td; 46168404Spjd}; 47168404Spjd#endif 48168404Spjd 49168404Spjdtypedef struct uio uio_t; 50168404Spjdtypedef struct iovec iovec_t; 51168404Spjd 52168404Spjd#define uio_loffset uio_offset 53168404Spjd 54184698Srodrigc#ifdef BUILDING_ZFS 55168404Spjdstatic __inline int 56168404Spjdzfs_uiomove(void *cp, size_t n, enum uio_rw dir, uio_t *uio) 57168404Spjd{ 58168404Spjd 59168404Spjd ASSERT(uio->uio_rw == dir); 60168404Spjd return (uiomove(cp, (int)n, uio)); 61168404Spjd} 62168404Spjd#define uiomove(cp, n, dir, uio) zfs_uiomove((cp), (n), (dir), (uio)) 63184698Srodrigc#endif 64168404Spjd 65168404Spjd#endif /* !_OPENSOLARIS_SYS_UIO_H_ */ 66