Skip to content

Commit 6a193ce

Browse files
committed
t/io_uring: add symbolic defines for NOP flags
Add them to io_uring.h and use them in t/io_uring. Signed-off-by: Jens Axboe <[email protected]>
1 parent 63c250d commit 6a193ce

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

os/linux/io_uring.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ enum {
245245
#define IORING_POLL_UPDATE_EVENTS (1U << 1)
246246
#define IORING_POLL_UPDATE_USER_DATA (1U << 2)
247247

248+
#define IORING_NOP_INJECT_RESULT (1U << 0)
249+
#define IORING_NOP_FILE (1U << 1)
250+
#define IORING_NOP_FIXED_FILE (1U << 2)
251+
#define IORING_NOP_FIXED_BUFFER (1U << 3)
252+
248253
/*
249254
* IO completion data structure (Completion Queue Entry)
250255
*/

t/io_uring.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,16 +546,16 @@ static void init_io(struct submitter *s, unsigned index)
546546
f = get_next_file(s);
547547

548548
if (do_nop) {
549+
sqe->rw_flags = IORING_NOP_FILE;
549550
if (register_files) {
550551
sqe->fd = f->fixed_fd;
551-
sqe->rw_flags = (1U << 1) | (1U << 2);
552+
sqe->rw_flags |= IORING_NOP_FIXED_FILE;
552553
} else {
553554
sqe->fd = f->real_fd;
554-
sqe->rw_flags = (1U << 1);
555555
}
556556
if (fixedbufs)
557-
sqe->rw_flags |= (1U << 3);
558-
sqe->rw_flags |= (1U << 0);
557+
sqe->rw_flags |= IORING_NOP_FIXED_BUFFER;
558+
sqe->rw_flags |= IORING_NOP_INJECT_RESULT;
559559
sqe->len = bs;
560560
sqe->opcode = IORING_OP_NOP;
561561
return;

0 commit comments

Comments
 (0)