io_uring: Support calling io_uring_register with a registered ring fd
authorJosh Triplett <josh@joshtriplett.org>
Wed, 15 Feb 2023 00:42:22 +0000 (16:42 -0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 16 Feb 2023 13:09:30 +0000 (06:09 -0700)
commit7d3fd88d61a41016da01889f076fd1c60c7298fc
tree6d585bf491aa17b8c19876a73c4df07c0476f416
parentfbe870a72fd1ddc5e08c23764e23e5766f54aa87
io_uring: Support calling io_uring_register with a registered ring fd

Add a new flag IORING_REGISTER_USE_REGISTERED_RING (set via the high bit
of the opcode) to treat the fd as a registered index rather than a file
descriptor.

This makes it possible for a library to open an io_uring, register the
ring fd, close the ring fd, and subsequently use the ring entirely via
registered index.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Link: https://lore.kernel.org/r/f2396369e638284586b069dbddffb8c992afba95.1676419314.git.josh@joshtriplett.org
[axboe: remove extra high bit clear]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/uapi/linux/io_uring.h
io_uring/io_uring.c