1
0
Fork 0
mirror of https://github.com/ii64/gouring.git synced 2025-04-26 05:42:48 +02:00

prep: add write, read prepare function

Signed-off-by: Nugraha <richiisei@gmail.com>
This commit is contained in:
Xeffy Chen 2022-07-07 08:23:21 +07:00
parent 5e137b98fb
commit 575cae61c4
Signed by: Xeffy
GPG key ID: E41C08AD390E7C49

View file

@ -31,6 +31,9 @@ func PrepTimeout(sqe *IoUringSqe, ts *syscall.Timespec, count uint32, flags uint
sqe.SetTimeoutFlags(flags)
}
func PrepRead(sqe *IoUringSqe, fd int, buf *byte, nb int, offset uint64) {
PrepRW(IORING_OP_READ, sqe, fd, unsafe.Pointer(buf), nb, offset)
}
func PrepReadv(sqe *IoUringSqe, fd int,
iov *syscall.Iovec, nrVecs int,
offset uint64) {
@ -43,6 +46,9 @@ func PrepReadv2(sqe *IoUringSqe, fd int,
sqe.SetRwFlags(flags)
}
func PrepWrite(sqe *IoUringSqe, fd int, buf *byte, nb int, offset uint64) {
PrepRW(IORING_OP_WRITE, sqe, fd, unsafe.Pointer(buf), nb, offset)
}
func PrepWritev(sqe *IoUringSqe, fd int,
iov *syscall.Iovec, nrVecs int,
offset uint64) {