io_uring: add IORING_OP_PROVIDE_BUFFERS
authorJens Axboe <axboe@kernel.dk>
Sun, 23 Feb 2020 23:41:33 +0000 (16:41 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 4 Mar 2020 03:04:14 +0000 (20:04 -0700)
commit84afcd566facd2c180a0eca736a90cb48e3dea29
tree8d4beeb42db7c7d9b6aa798ded9db3a1f9b77c9e
parente51c60e4fa926445d3d7bc9d41b969993afed89b
io_uring: add IORING_OP_PROVIDE_BUFFERS

IORING_OP_PROVIDE_BUFFERS uses the buffer registration infrastructure to
support passing in an addr/len that is associated with a buffer ID and
buffer group ID. The group ID is used to index and lookup the buffers,
while the buffer ID can be used to notify the application which buffer
in the group was used. The addr passed in is the starting buffer address,
and length is each buffer length. A number of buffers to add with can be
specified, in which case addr is incremented by length for each addition,
and each buffer increments the buffer ID specified.

No validation is done of the buffer ID. If the application provides
buffers within the same group with identical buffer IDs, then it'll have
a hard time telling which buffer ID was used. The only restriction is
that the buffer ID can be a max of 16-bits in size, so USHRT_MAX is the
maximum ID that can be used.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
include/uapi/linux/io_uring.h