* Return an sqe to fill. Application must later call io_uring_submit() * when it's ready to tell the kernel about it. The caller may call this * function multiple times before calling io_uring_submit(). * * Returns a vacant sqe, or NULL if we're full. */
| 1962 | * Returns a vacant sqe, or NULL if we're full. |
| 1963 | */ |
| 1964 | IOURINGINLINE struct io_uring_sqe *_io_uring_get_sqe(struct io_uring *ring) |
| 1965 | LIBURING_NOEXCEPT |
| 1966 | { |
| 1967 | struct io_uring_sq *sq = &ring->sq; |
| 1968 | unsigned head = io_uring_load_sq_head(ring), tail = sq->sqe_tail; |
| 1969 | struct io_uring_sqe *sqe; |
| 1970 | |
| 1971 | if (tail - head >= sq->ring_entries) |
| 1972 | return NULL; |
| 1973 | |
| 1974 | sqe = &sq->sqes[(tail & sq->ring_mask) << io_uring_sqe_shift(ring)]; |
| 1975 | sq->sqe_tail = tail + 1; |
| 1976 | io_uring_initialize_sqe(sqe); |
| 1977 | return sqe; |
| 1978 | } |
| 1979 | |
| 1980 | /* |
| 1981 | * Return the appropriate mask for a buffer ring of size 'ring_entries' |
no test coverage detected