FreeBSD/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c
/*
 * same as uiomove() but doesn't modify uio structure.
 * return in cbytes how many bytes were copied.
 */
same as uiomove() but doesn't modify uio structure.
return in cbytes how many bytes were copied.
same as uiomove () but doesn ' t modify uio structure . return in cbytes how many bytes were copied .
int
uiocopy(void *p, size_t n, enum uio_rw rw, struct uio *uio, size_t *cbytes)
{
	struct iovec *iov;
	ulong_t cnt;
	int error, iovcnt;
	iovcnt = uio->uio_iovcnt;
	*cbytes = 0;
	for (iov = uio->uio_iov; n > 0 && iovcnt > 0; iov++, iovcnt--) {
		cnt = MIN(iov->iov_len, n);
		if (cnt == 0)
			continue;
		switch (uio->uio_segflg) {
		case UIO_USERSPACE:
			if (rw == UIO_READ)
				error = copyout(p, iov->iov_base, cnt);
			else
				error = copyin(iov->iov_base, p, cnt);
			if (error)
				return (error);
			break;
		case UIO_SYSSPACE:
			if (uio->uio_rw == UIO_READ)
				bcopy(p, iov->iov_base, cnt);
			else
				bcopy(iov->iov_base, p, cnt);
			break;
		}
		p = (caddr_t)p + cnt;
		n -= cnt;
		*cbytes += cnt;
	}
	return (0);
}
int uiocopy ( void * p , size_t n , enum uio_rw rw , struct uio * uio , size_t * cbytes ) { struct iovec * iov ; ulong_t cnt ; int error , iovcnt ; iovcnt = uio -> uio_iovcnt ; * cbytes = 0 ; for ( iov = uio -> uio_iov ; n > 0 && iovcnt > 0 ; iov ++ , iovcnt -- ) { cnt = MIN ( iov -> iov_len , n ) ; if ( cnt == 0 ) continue ; switch ( uio -> uio_segflg ) { case UIO_USERSPACE : if ( rw == UIO_READ ) error = copyout ( p , iov -> iov_base , cnt ) ; else error = copyin ( iov -> iov_base , p , cnt ) ; if ( error ) return ( error ) ; break ; case UIO_SYSSPACE : if ( uio -> uio_rw == UIO_READ ) bcopy ( p , iov -> iov_base , cnt ) ; else bcopy ( iov -> iov_base , p , cnt ) ; break ; } p = ( caddr_t ) p + cnt ; n -= cnt ; * cbytes += cnt ; } return ( 0 ) ; }
same as uiomove() but doesn't modify uio structure.
same as uiomove () but doesn ' t modify uio structure .