xref: /dflybsd-src/sys/sys/_uio.h (revision c58037577b149162274f6e5a4b2ee11b75feb139)
1*c5803757Szrj /*
2*c5803757Szrj  * Copyright (c) 1982, 1986, 1993, 1994
3*c5803757Szrj  *	The Regents of the University of California.  All rights reserved.
4*c5803757Szrj  *
5*c5803757Szrj  * Redistribution and use in source and binary forms, with or without
6*c5803757Szrj  * modification, are permitted provided that the following conditions
7*c5803757Szrj  * are met:
8*c5803757Szrj  * 1. Redistributions of source code must retain the above copyright
9*c5803757Szrj  *    notice, this list of conditions and the following disclaimer.
10*c5803757Szrj  * 2. Redistributions in binary form must reproduce the above copyright
11*c5803757Szrj  *    notice, this list of conditions and the following disclaimer in the
12*c5803757Szrj  *    documentation and/or other materials provided with the distribution.
13*c5803757Szrj  * 3. Neither the name of the University nor the names of its contributors
14*c5803757Szrj  *    may be used to endorse or promote products derived from this software
15*c5803757Szrj  *    without specific prior written permission.
16*c5803757Szrj  *
17*c5803757Szrj  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18*c5803757Szrj  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*c5803757Szrj  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*c5803757Szrj  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21*c5803757Szrj  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*c5803757Szrj  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*c5803757Szrj  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*c5803757Szrj  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*c5803757Szrj  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*c5803757Szrj  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*c5803757Szrj  * SUCH DAMAGE.
28*c5803757Szrj  *
29*c5803757Szrj  *	@(#)uio.h	8.5 (Berkeley) 2/22/94
30*c5803757Szrj  */
31*c5803757Szrj 
32*c5803757Szrj #ifndef _SYS__UIO_H_
33*c5803757Szrj #define	_SYS__UIO_H_
34*c5803757Szrj 
35*c5803757Szrj /*
36*c5803757Szrj  * Do not include this header outside _KERNEL or _KERNEL_STRUCTURES scopes.
37*c5803757Szrj  * Used in <sys/user.h>.
38*c5803757Szrj  */
39*c5803757Szrj 
40*c5803757Szrj #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
41*c5803757Szrj enum uio_rw {
42*c5803757Szrj 	UIO_READ,
43*c5803757Szrj 	UIO_WRITE
44*c5803757Szrj };
45*c5803757Szrj 
46*c5803757Szrj /* Segment flag values. */
47*c5803757Szrj enum uio_seg {
48*c5803757Szrj 	UIO_USERSPACE,		/* from user data space */
49*c5803757Szrj 	UIO_SYSSPACE,		/* from system space */
50*c5803757Szrj 	UIO_NOCOPY		/* don't copy, already in object */
51*c5803757Szrj };
52*c5803757Szrj 
53*c5803757Szrj struct iovec;
54*c5803757Szrj struct thread;
55*c5803757Szrj 
56*c5803757Szrj /*
57*c5803757Szrj  * uio_td is primarily used for USERSPACE transfers, but some devices
58*c5803757Szrj  * like ttys may also use it to get at the process.
59*c5803757Szrj  *
60*c5803757Szrj  * NOTE: uio_resid: Previously used int and FreeBSD decided to use ssize_t,
61*c5803757Szrj  *	 but after reviewing use cases and in particular the fact that the
62*c5803757Szrj  *	 iov uses an unsigned quantity, DragonFly will use the (unsigned)
63*c5803757Szrj  *	 size_t.
64*c5803757Szrj  */
65*c5803757Szrj struct uio {
66*c5803757Szrj 	struct	iovec *uio_iov;
67*c5803757Szrj 	int	uio_iovcnt;
68*c5803757Szrj 	off_t	uio_offset;
69*c5803757Szrj 	size_t	uio_resid;
70*c5803757Szrj 	enum	uio_seg uio_segflg;
71*c5803757Szrj 	enum	uio_rw uio_rw;
72*c5803757Szrj 	struct	thread *uio_td;
73*c5803757Szrj };
74*c5803757Szrj #endif /* _KERNEL || _KERNEL_STRUCTURES */
75*c5803757Szrj 
76*c5803757Szrj #endif /* !_SYS__UIO_H_ */
77