diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-01 22:58:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-01 22:58:52 -0400 |
commit | 9931a07d518e86eb58a75e508ed9626f86359303 (patch) | |
tree | 8c3be85875e35ab14a14143f2499be924f149a46 /include/linux/uio.h | |
parent | e468f5c06b5ebef3f6f3c187e51aa6daab667e57 (diff) | |
parent | 0e9b4a82710220c04100892fb7277b78fd33a747 (diff) |
Merge branch 'work.afs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull AFS updates from Al Viro:
"AFS series, with some iov_iter bits included"
* 'work.afs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (26 commits)
missing bits of "iov_iter: Separate type from direction and use accessor functions"
afs: Probe multiple fileservers simultaneously
afs: Fix callback handling
afs: Eliminate the address pointer from the address list cursor
afs: Allow dumping of server cursor on operation failure
afs: Implement YFS support in the fs client
afs: Expand data structure fields to support YFS
afs: Get the target vnode in afs_rmdir() and get a callback on it
afs: Calc callback expiry in op reply delivery
afs: Fix FS.FetchStatus delivery from updating wrong vnode
afs: Implement the YFS cache manager service
afs: Remove callback details from afs_callback_break struct
afs: Commit the status on a new file/dir/symlink
afs: Increase to 64-bit volume ID and 96-bit vnode ID for YFS
afs: Don't invoke the server to read data beyond EOF
afs: Add a couple of tracepoints to log I/O errors
afs: Handle EIO from delivery function
afs: Fix TTL on VL server and address lists
afs: Implement VL server rotation
afs: Improve FS server rotation error handling
...
Diffstat (limited to 'include/linux/uio.h')
-rw-r--r-- | include/linux/uio.h | 65 |
1 files changed, 45 insertions, 20 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h index 422b1c01ee0d..55ce99ddb912 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -21,15 +21,16 @@ struct kvec { | |||
21 | size_t iov_len; | 21 | size_t iov_len; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | enum { | 24 | enum iter_type { |
25 | ITER_IOVEC = 0, | 25 | ITER_IOVEC = 0, |
26 | ITER_KVEC = 2, | 26 | ITER_KVEC = 2, |
27 | ITER_BVEC = 4, | 27 | ITER_BVEC = 4, |
28 | ITER_PIPE = 8, | 28 | ITER_PIPE = 8, |
29 | ITER_DISCARD = 16, | ||
29 | }; | 30 | }; |
30 | 31 | ||
31 | struct iov_iter { | 32 | struct iov_iter { |
32 | int type; | 33 | unsigned int type; |
33 | size_t iov_offset; | 34 | size_t iov_offset; |
34 | size_t count; | 35 | size_t count; |
35 | union { | 36 | union { |
@@ -47,6 +48,41 @@ struct iov_iter { | |||
47 | }; | 48 | }; |
48 | }; | 49 | }; |
49 | 50 | ||
51 | static inline enum iter_type iov_iter_type(const struct iov_iter *i) | ||
52 | { | ||
53 | return i->type & ~(READ | WRITE); | ||
54 | } | ||
55 | |||
56 | static inline bool iter_is_iovec(const struct iov_iter *i) | ||
57 | { | ||
58 | return iov_iter_type(i) == ITER_IOVEC; | ||
59 | } | ||
60 | |||
61 | static inline bool iov_iter_is_kvec(const struct iov_iter *i) | ||
62 | { | ||
63 | return iov_iter_type(i) == ITER_KVEC; | ||
64 | } | ||
65 | |||
66 | static inline bool iov_iter_is_bvec(const struct iov_iter *i) | ||
67 | { | ||
68 | return iov_iter_type(i) == ITER_BVEC; | ||
69 | } | ||
70 | |||
71 | static inline bool iov_iter_is_pipe(const struct iov_iter *i) | ||
72 | { | ||
73 | return iov_iter_type(i) == ITER_PIPE; | ||
74 | } | ||
75 | |||
76 | static inline bool iov_iter_is_discard(const struct iov_iter *i) | ||
77 | { | ||
78 | return iov_iter_type(i) == ITER_DISCARD; | ||
79 | } | ||
80 | |||
81 | static inline unsigned char iov_iter_rw(const struct iov_iter *i) | ||
82 | { | ||
83 | return i->type & (READ | WRITE); | ||
84 | } | ||
85 | |||
50 | /* | 86 | /* |
51 | * Total number of bytes covered by an iovec. | 87 | * Total number of bytes covered by an iovec. |
52 | * | 88 | * |
@@ -74,7 +110,8 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter) | |||
74 | } | 110 | } |
75 | 111 | ||
76 | #define iov_for_each(iov, iter, start) \ | 112 | #define iov_for_each(iov, iter, start) \ |
77 | if (!((start).type & (ITER_BVEC | ITER_PIPE))) \ | 113 | if (iov_iter_type(start) == ITER_IOVEC || \ |
114 | iov_iter_type(start) == ITER_KVEC) \ | ||
78 | for (iter = (start); \ | 115 | for (iter = (start); \ |
79 | (iter).count && \ | 116 | (iter).count && \ |
80 | ((iov = iov_iter_iovec(&(iter))), 1); \ | 117 | ((iov = iov_iter_iovec(&(iter))), 1); \ |
@@ -181,14 +218,15 @@ size_t copy_to_iter_mcsafe(void *addr, size_t bytes, struct iov_iter *i) | |||
181 | size_t iov_iter_zero(size_t bytes, struct iov_iter *); | 218 | size_t iov_iter_zero(size_t bytes, struct iov_iter *); |
182 | unsigned long iov_iter_alignment(const struct iov_iter *i); | 219 | unsigned long iov_iter_alignment(const struct iov_iter *i); |
183 | unsigned long iov_iter_gap_alignment(const struct iov_iter *i); | 220 | unsigned long iov_iter_gap_alignment(const struct iov_iter *i); |
184 | void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, | 221 | void iov_iter_init(struct iov_iter *i, unsigned int direction, const struct iovec *iov, |
185 | unsigned long nr_segs, size_t count); | 222 | unsigned long nr_segs, size_t count); |
186 | void iov_iter_kvec(struct iov_iter *i, int direction, const struct kvec *kvec, | 223 | void iov_iter_kvec(struct iov_iter *i, unsigned int direction, const struct kvec *kvec, |
187 | unsigned long nr_segs, size_t count); | 224 | unsigned long nr_segs, size_t count); |
188 | void iov_iter_bvec(struct iov_iter *i, int direction, const struct bio_vec *bvec, | 225 | void iov_iter_bvec(struct iov_iter *i, unsigned int direction, const struct bio_vec *bvec, |
189 | unsigned long nr_segs, size_t count); | 226 | unsigned long nr_segs, size_t count); |
190 | void iov_iter_pipe(struct iov_iter *i, int direction, struct pipe_inode_info *pipe, | 227 | void iov_iter_pipe(struct iov_iter *i, unsigned int direction, struct pipe_inode_info *pipe, |
191 | size_t count); | 228 | size_t count); |
229 | void iov_iter_discard(struct iov_iter *i, unsigned int direction, size_t count); | ||
192 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, | 230 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, |
193 | size_t maxsize, unsigned maxpages, size_t *start); | 231 | size_t maxsize, unsigned maxpages, size_t *start); |
194 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, | 232 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, |
@@ -202,19 +240,6 @@ static inline size_t iov_iter_count(const struct iov_iter *i) | |||
202 | return i->count; | 240 | return i->count; |
203 | } | 241 | } |
204 | 242 | ||
205 | static inline bool iter_is_iovec(const struct iov_iter *i) | ||
206 | { | ||
207 | return !(i->type & (ITER_BVEC | ITER_KVEC | ITER_PIPE)); | ||
208 | } | ||
209 | |||
210 | /* | ||
211 | * Get one of READ or WRITE out of iter->type without any other flags OR'd in | ||
212 | * with it. | ||
213 | * | ||
214 | * The ?: is just for type safety. | ||
215 | */ | ||
216 | #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & (READ | WRITE)) | ||
217 | |||
218 | /* | 243 | /* |
219 | * Cap the iov_iter by given limit; note that the second argument is | 244 | * Cap the iov_iter by given limit; note that the second argument is |
220 | * *not* the new size - it's upper limit for such. Passing it a value | 245 | * *not* the new size - it's upper limit for such. Passing it a value |