[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-6-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:12:25 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 005/437] uio: add get/put_iter helpers
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@...nel.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
Powered by blists - more mailing lists