Skip to content

Commit

Permalink
t/io_uring: add symbolic defines for NOP flags
Browse files Browse the repository at this point in the history
Add them to io_uring.h and use them in t/io_uring.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Nov 4, 2024
1 parent 63c250d commit 6a193ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions os/linux/io_uring.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ enum {
#define IORING_POLL_UPDATE_EVENTS (1U << 1)
#define IORING_POLL_UPDATE_USER_DATA (1U << 2)

#define IORING_NOP_INJECT_RESULT (1U << 0)
#define IORING_NOP_FILE (1U << 1)
#define IORING_NOP_FIXED_FILE (1U << 2)
#define IORING_NOP_FIXED_BUFFER (1U << 3)

/*
* IO completion data structure (Completion Queue Entry)
*/
Expand Down
8 changes: 4 additions & 4 deletions t/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,16 +546,16 @@ static void init_io(struct submitter *s, unsigned index)
f = get_next_file(s);

if (do_nop) {
sqe->rw_flags = IORING_NOP_FILE;
if (register_files) {
sqe->fd = f->fixed_fd;
sqe->rw_flags = (1U << 1) | (1U << 2);
sqe->rw_flags |= IORING_NOP_FIXED_FILE;
} else {
sqe->fd = f->real_fd;
sqe->rw_flags = (1U << 1);
}
if (fixedbufs)
sqe->rw_flags |= (1U << 3);
sqe->rw_flags |= (1U << 0);
sqe->rw_flags |= IORING_NOP_FIXED_BUFFER;
sqe->rw_flags |= IORING_NOP_INJECT_RESULT;
sqe->len = bs;
sqe->opcode = IORING_OP_NOP;
return;
Expand Down

0 comments on commit 6a193ce

Please sign in to comment.