[PATCH 005/437] uio: add get/put_iter helpers

Jens Axboe
2024-04-11T15:31:37Z

For users that currently do put_user(val, uaddr) or get_user(val, uaddr),
add iterator versions that do the same thing.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
include/linux/uio.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/linux/uio.h b/include/linux/uio.h
index 7020adedfa08..ed1711201597 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -215,6 +215,9 @@ bool copy_to_iter_full(const void *addr, size_t bytes, struct iov_iter *i)
return false;
}

+#define put_iter(val, to) !copy_to_iter_full(&(val), sizeof((val)), to)
+#define get_iter(val, from) !copy_from_iter_full(&(val), sizeof((val)), from)
+
static __always_inline __must_check
bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i)
{
--
2.43.0