Skip to content

Commit

Permalink
Merge branch 'fix_clear_flags' of https://github.com/gxuu/liburing
Browse files Browse the repository at this point in the history
* 'fix_clear_flags' of https://github.com/gxuu/liburing:
  Add initialization function of io_uring_sqe
  • Loading branch information
axboe committed Apr 14, 2024
2 parents f1dfb94 + f1a3d81 commit c1cee95
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/include/liburing.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,10 @@ IOURINGINLINE void __io_uring_set_target_fixed_file(struct io_uring_sqe *sqe,
sqe->file_index = file_index + 1;
}

IOURINGINLINE void io_uring_prep_rw(int op, struct io_uring_sqe *sqe, int fd,
const void *addr, unsigned len,
__u64 offset)
IOURINGINLINE void io_uring_initialize_sqe(struct io_uring_sqe *sqe)
{
sqe->opcode = (__u8) op;
sqe->flags = 0;
sqe->ioprio = 0;
sqe->fd = fd;
sqe->off = offset;
sqe->addr = (unsigned long) addr;
sqe->len = len;
sqe->rw_flags = 0;
sqe->buf_index = 0;
sqe->personality = 0;
Expand All @@ -394,6 +387,17 @@ IOURINGINLINE void io_uring_prep_rw(int op, struct io_uring_sqe *sqe, int fd,
sqe->__pad2[0] = 0;
}

IOURINGINLINE void io_uring_prep_rw(int op, struct io_uring_sqe *sqe, int fd,
const void *addr, unsigned len,
__u64 offset)
{
sqe->opcode = (__u8) op;
sqe->fd = fd;
sqe->off = offset;
sqe->addr = (unsigned long) addr;
sqe->len = len;
}

/*
* io_uring_prep_splice() - Either @fd_in or @fd_out must be a pipe.
*
Expand Down Expand Up @@ -727,7 +731,6 @@ IOURINGINLINE void io_uring_prep_read_multishot(struct io_uring_sqe *sqe,
io_uring_prep_rw(IORING_OP_READ_MULTISHOT, sqe, fd, NULL, nbytes,
offset);
sqe->buf_group = buf_group;
sqe->flags |= IOSQE_BUFFER_SELECT;
}

IOURINGINLINE void io_uring_prep_write(struct io_uring_sqe *sqe, int fd,
Expand Down Expand Up @@ -1423,6 +1426,7 @@ IOURINGINLINE struct io_uring_sqe *_io_uring_get_sqe(struct io_uring *ring)

sqe = &sq->sqes[(sq->sqe_tail & sq->ring_mask) << shift];
sq->sqe_tail = next;
io_uring_initialize_sqe(sqe);
return sqe;
}

Expand Down

0 comments on commit c1cee95

Please sign in to comment.