1
0
Fork 0
mirror of https://github.com/ii64/gouring.git synced 2025-04-22 20:25:13 +02:00

Compare commits

...

6 commits
v0.4.0 ... v0.4

Author SHA1 Message Date
4937c09d11
ring: support sqe128, cqe32 index array 2022-10-12 23:19:37 +07:00
b60c5ed2ba
test: sqe and cqe size check 2022-10-12 23:17:41 +07:00
3409c752f2
fix: unresolved typo 2022-10-12 23:16:02 +07:00
fzn0x
4ed8bc99bd
fix: minor code typo ()
* fix: minor code typo
2022-10-02 19:20:08 +07:00
d0c4e7f98f
Merge pull request from ii64/doc/add-license
doc: add license
2022-09-04 17:43:27 +07:00
aad8211d3e
doc: add license
Fixes 
2022-09-04 17:41:10 +07:00
6 changed files with 46 additions and 4 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 gouring Author
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

13
hdr_test.go Normal file
View file

@ -0,0 +1,13 @@
package gouring
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDataSize(t *testing.T) {
assert.Equal(t, 64, int(SizeofIoUringSqe), "sqe data size mismatch")
assert.Equal(t, 16, int(SizeofIoUringCqe), "cqe data size mismatch")
}

View file

@ -234,7 +234,7 @@ func (ring *IoUring) io_uring_wait_cqes_new(cqePtr **IoUringCqe, waitNtr uint32,
func (ring *IoUring) __io_uring_submit_timeout(waitNr uint32, ts *syscall.Timespec) (ret int, err error) {
sqe := ring.io_uring_get_sqe()
if sqe == nil {
ret, err = ring.io_uringn_submit()
ret, err = ring.io_uring_submit()
if err != nil {
return
}
@ -309,7 +309,7 @@ func (ring *IoUring) io_uring_wait_cqe_timeout(cqePtr **IoUringCqe, ts *syscall.
*
* Returns number of sqes submitted
*/
func (ring *IoUring) io_uringn_submit() (int, error) {
func (ring *IoUring) io_uring_submit() (int, error) {
return ring.__io_uring_submit_and_wait(0)
}

View file

@ -151,7 +151,7 @@ func TestRingQueueSubmitSingleConsumer(t *testing.T) {
}
submit := func(t *testing.T, opt *IoUringParams, h *IoUring, expectedSubmitCount int) {
submitted, err := h.io_uringn_submit()
submitted, err := h.io_uring_submit()
assert.NoError(t, err)
if opt.Flags&IORING_SETUP_SQPOLL == 0 {
assert.Equal(t, expectedSubmitCount, submitted)

View file

@ -40,7 +40,7 @@ func (h *IoUring) SeenCqe(cqe *IoUringCqe) {
}
func (h *IoUring) Submit() (int, error) {
return h.io_uringn_submit()
return h.io_uring_submit()
}
func (h *IoUring) SubmitAndWait(waitNr uint32) (int, error) {

View file

@ -16,6 +16,10 @@ func ioUringSqeArray_Index(u ioUringSqeArray, i uintptr) *IoUringSqe {
return (*IoUringSqe)(unsafe.Pointer(uintptr(unsafe.Pointer(u)) + SizeofIoUringSqe*i))
}
func ioUringSqe128Array_Index(u ioUringSqeArray, i uintptr) *IoUringSqe {
return (*IoUringSqe)(unsafe.Pointer(uintptr(unsafe.Pointer(u)) + (SizeofIoUringSqe+64)*i))
}
//
type ioUringCqeArray = unsafe.Pointer // *IoUringCqe
@ -24,6 +28,10 @@ func ioUringCqeArray_Index(u ioUringCqeArray, i uintptr) *IoUringCqe {
return (*IoUringCqe)(unsafe.Pointer(uintptr(unsafe.Pointer(u)) + SizeofIoUringCqe*i))
}
func ioUringCqe32Array_Index(u ioUringCqeArray, i uintptr) *IoUringCqe {
return (*IoUringCqe)(unsafe.Pointer(uintptr(unsafe.Pointer(u)) + (SizeofIoUringCqe+SizeofIoUringCqe)*i))
}
//
type UserData [8]byte // uint64