Document enum iter_type, copy_to_iter() and copy_from_iter() Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- include/linux/uio.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 6350354f97e9..9fbce8c92545 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -17,6 +17,15 @@ struct kvec { size_t iov_len; }; +/** + * enum iter_type - The type of memory referred to by the iterator. + * @ITER_IOVEC: An array of ranges of userspace memory. + * @ITER_KVEC: An array of ranges of kernel memory. + * @ITER_BVEC: An array of &struct bio_vec. + * @ITER_PIPE: A pipe. + * @ITER_XARRAY: A &struct xarray of pages. + * @ITER_DISCARD: No memory here; discard all writes. + */ enum iter_type { /* iter types */ ITER_IOVEC, @@ -146,6 +155,18 @@ size_t _copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i); size_t _copy_from_iter(void *addr, size_t bytes, struct iov_iter *i); size_t _copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i); +/** + * copy_to_iter() - Copy from kernel memory to an iterator. + * @addr: Kernel memory address. + * @bytes: Number of bytes to copy. + * @i: Destination of copy. + * + * Copy @bytes from @addr to @i. The region of memory pointed to by @i must + * not overlap the region pointed to by @addr. @i may point to any kind + * of &enum iter_type memory. + * + * Return: Number of bytes successfully copied to the iterator. + */ static __always_inline __must_check size_t copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i) { @@ -155,6 +176,18 @@ size_t copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i) return _copy_to_iter(addr, bytes, i); } +/** + * copy_from_iter() - Copy from an iterator to kernel memory. + * @addr: Kernel memory address. + * @bytes: Number of bytes to copy. + * @i: Source of memory. + * + * Copy @bytes from @i to @addr. The region of memory pointed to by @i must + * not overlap the region pointed to by @addr. @i may point to any kind + * of &enum iter_type memory. + * + * Return: Number of bytes successfully copied from the iterator. + */ static __always_inline __must_check size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) { -- 2.33.0