One big issue with the file registration feature is that it needs user space apps to maintain free slot info about io_uring's fixed file table, which really is a burden for development. io_uring now supports choosing free file slot for user space apps by using IORING_FILE_INDEX_ALLOC flag in accept, open, and socket operations, but they need the app to use direct accept or direct open, which not all apps are prepared to use yet. To support apps that still need real fds, make use of the registration feature easier. Let IORING_OP_FILES_UPDATE support choosing fixed file slots, which will store picked fixed files slots in fd array and let cqe return the number of slots allocated.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -47,6 +47,7 @@ struct io_uring_sqe { · 46 unmodified lines | ||
| 47 | 47 | __u32 unlink_flags; |
| 48 | 48 | __u32 hardlink_flags; |
| 49 | 49 | __u32 xattr_flags; |
| 50 | + __u32 close_flags; | |
| 50 | 51 | }; |
| 51 | 52 | __u64 user_data; /* data to be passed back at completion time */ |
| 52 | 53 | /* pack this to avoid bogus arm OABI complaints */ |
| @@ -258,6 +259,11 @@ enum io_uring_op { · 205 unmodified lines | ||
| 258 | 259 | */ |
| 259 | 260 | #define IORING_ACCEPT_MULTISHOT (1U << 0) |
| 260 | 261 | |
| 262 | +/* | |
| 263 | + * close flags, store in sqe->close_flags | |
| 264 | + */ | |
| 265 | +#define IORING_CLOSE_FD_AND_FILE_SLOT (1U << 0) | |
| 266 | + | |
| 261 | 267 | /* |
| 262 | 268 | * IO completion data structure (Completion Queue Entry) |
| 263 | 269 | */ |