From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-doc@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@lst.de>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/3] iov_iter: Add kernel-doc
Date: Mon, 6 Dec 2021 14:52:19 +0000 [thread overview]
Message-ID: <20211206145220.1175209-3-willy@infradead.org> (raw)
In-Reply-To: <20211206145220.1175209-1-willy@infradead.org>
Document enum iter_type, copy_to_iter() and copy_from_iter()
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
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
next prev parent reply other threads:[~2021-12-06 14:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 14:52 [PATCH 0/3] iov_iter documentation Matthew Wilcox (Oracle)
2021-12-06 14:52 ` [PATCH 1/3] iov_iter: Add skeleton documentation Matthew Wilcox (Oracle)
2021-12-06 14:55 ` Christoph Hellwig
2021-12-06 14:52 ` Matthew Wilcox (Oracle) [this message]
2021-12-06 14:54 ` [PATCH 2/3] iov_iter: Add kernel-doc Christoph Hellwig
2021-12-06 14:52 ` [PATCH 3/3] iov_iter: Move internal documentation Matthew Wilcox (Oracle)
2021-12-06 14:55 ` Christoph Hellwig
2021-12-06 15:00 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211206145220.1175209-3-willy@infradead.org \
--to=willy@infradead.org \
--cc=hch@lst.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).