source: GPL/trunk/include/linux/uio.h@ 772

Last change on this file since 772 was 772, checked in by David Azarewicz, 4 months ago

Merge in changes from 6.6-LTS branch.
Fixed additional 25+ problems.

File size: 1.7 KB
Line 
1/* $Id: uio.h,v 1.1.1.1 2003/07/02 13:57:00 eleph Exp $ */
2
3#ifndef _LINUX_UIO_H
4#define _LINUX_UIO_H
5
6#include <linux/types.h>
7
8enum iter_type {
9 /* iter types */
10 ITER_IOVEC,
11 ITER_KVEC,
12 ITER_BVEC,
13 ITER_XARRAY,
14 ITER_DISCARD,
15 ITER_UBUF,
16};
17
18#define ITER_SOURCE 1 // == WRITE
19#define ITER_DEST 0 // == READ
20
21struct kvec {
22 void *iov_base; /* and that should *never* hold a userland pointer */
23 size_t iov_len;
24};
25
26struct iovec {
27 char *iov_base; /* Base address. */
28#ifdef __32BIT__
29 size_t iov_len; /* Length. */
30#else
31 long iov_len; /* Length. */
32#endif
33};
34
35struct iov_iter {
36 u8 iter_type;
37 bool copy_mc;
38 bool nofault;
39 bool data_source;
40 bool user_backed;
41 union {
42 /*
43 * This really should be a const, but we cannot do that without
44 * also modifying any of the zero-filling iter init functions.
45 * Leave it non-const for now, but it should be treated as such.
46 */
47 struct iovec __ubuf_iovec;
48 struct {
49 union {
50 /* use iter_iov() to get the current vec */
51 const struct iovec *__iov;
52 void __user *ubuf;
53 };
54 size_t count;
55 };
56 };
57 union {
58 const struct iovec *iov;
59 const struct kvec *kvec;
60 const struct bio_vec *bvec;
61 };
62 unsigned long nr_segs;
63};
64
65static inline bool iter_is_iovec(const struct iov_iter *i)
66{
67 return !(i->iter_type & (ITER_BVEC | ITER_KVEC));
68}
69
70static inline const struct iovec *iter_iov(const struct iov_iter *iter)
71{
72 if (iter->iter_type == ITER_UBUF)
73 return (const struct iovec *) &iter->__ubuf_iovec;
74 return iter->__iov;
75}
76int import_ubuf(int type, void __user *buf, size_t len, struct iov_iter *i);
77
78#endif /* _LINUX_UIO_H */
Note: See TracBrowser for help on using the repository browser.