iov_iter: overlay struct iovec and ubuf/len
authorJens Axboe <axboe@kernel.dk>
Tue, 28 Mar 2023 20:21:06 +0000 (14:21 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 28 Mar 2023 21:53:09 +0000 (15:53 -0600)
commitfff3efcb59987987064f20733a38f8299d70d213
tree432a050320299899f5bcc55bae127f99098b9cb9
parent4cb1248c7167ecc1aeb15f7144914c12d5a42b8c
iov_iter: overlay struct iovec and ubuf/len

Add an internal struct iovec that we can return as a pointer, with the
fields of the iovec overlapping with the ITER_UBUF ubuf and length
fields.

This allows doing:

struct iovec *vec = &iter->__ubuf_iovec;

interchangably with iter->iov for the first segment, enabling writing
code that deals with both without needing to check if we're dealing with
ITER_IOVEC or ITER_UBUF.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/uio.h