diff options
Diffstat (limited to 'lib/iov_iter.c')
-rw-r--r-- | lib/iov_iter.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 9e8c7386b3a0..7e3138cfc8c9 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c | |||
@@ -291,33 +291,13 @@ done: | |||
291 | } | 291 | } |
292 | 292 | ||
293 | /* | 293 | /* |
294 | * Fault in the first iovec of the given iov_iter, to a maximum length | ||
295 | * of bytes. Returns 0 on success, or non-zero if the memory could not be | ||
296 | * accessed (ie. because it is an invalid address). | ||
297 | * | ||
298 | * writev-intensive code may want this to prefault several iovecs -- that | ||
299 | * would be possible (callers must not rely on the fact that _only_ the | ||
300 | * first iovec will be faulted with the current implementation). | ||
301 | */ | ||
302 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) | ||
303 | { | ||
304 | if (!(i->type & (ITER_BVEC|ITER_KVEC))) { | ||
305 | char __user *buf = i->iov->iov_base + i->iov_offset; | ||
306 | bytes = min(bytes, i->iov->iov_len - i->iov_offset); | ||
307 | return fault_in_pages_readable(buf, bytes); | ||
308 | } | ||
309 | return 0; | ||
310 | } | ||
311 | EXPORT_SYMBOL(iov_iter_fault_in_readable); | ||
312 | |||
313 | /* | ||
314 | * Fault in one or more iovecs of the given iov_iter, to a maximum length of | 294 | * Fault in one or more iovecs of the given iov_iter, to a maximum length of |
315 | * bytes. For each iovec, fault in each page that constitutes the iovec. | 295 | * bytes. For each iovec, fault in each page that constitutes the iovec. |
316 | * | 296 | * |
317 | * Return 0 on success, or non-zero if the memory could not be accessed (i.e. | 297 | * Return 0 on success, or non-zero if the memory could not be accessed (i.e. |
318 | * because it is an invalid address). | 298 | * because it is an invalid address). |
319 | */ | 299 | */ |
320 | int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) | 300 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) |
321 | { | 301 | { |
322 | size_t skip = i->iov_offset; | 302 | size_t skip = i->iov_offset; |
323 | const struct iovec *iov; | 303 | const struct iovec *iov; |
@@ -334,7 +314,7 @@ int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) | |||
334 | } | 314 | } |
335 | return 0; | 315 | return 0; |
336 | } | 316 | } |
337 | EXPORT_SYMBOL(iov_iter_fault_in_multipages_readable); | 317 | EXPORT_SYMBOL(iov_iter_fault_in_readable); |
338 | 318 | ||
339 | void iov_iter_init(struct iov_iter *i, int direction, | 319 | void iov_iter_init(struct iov_iter *i, int direction, |
340 | const struct iovec *iov, unsigned long nr_segs, | 320 | const struct iovec *iov, unsigned long nr_segs, |