mirror of
https://github.com/ii64/gouring.git
synced 2025-04-03 20:45:54 +02:00
feat: get probe ring
This commit is contained in:
parent
805d8d14fa
commit
f4992f93e1
4 changed files with 13 additions and 3 deletions
4
hdr.go
4
hdr.go
|
@ -252,8 +252,6 @@ const IORING_SETUP_DEFER_TASKRUN = (1 << 13)
|
|||
|
||||
type IoUringOp = uint8
|
||||
|
||||
//go:generate stringerx -type=IoUringOp
|
||||
|
||||
const (
|
||||
IORING_OP_NOP IoUringOp = iota
|
||||
IORING_OP_READV
|
||||
|
@ -672,7 +670,7 @@ type IoUringProbeOp struct {
|
|||
|
||||
type IoUringProbe struct {
|
||||
last_op uint8 /* last opcode supported */
|
||||
uint8 /* length of ops[] array below */
|
||||
ops_len uint8 /* length of ops[] array below */
|
||||
resv uint16
|
||||
resv2 [3]uint32
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ func (cqe *IoUringCqe) GetBigCqe() unsafe.Pointer {
|
|||
func (probe *IoUringProbe) GetOps() unsafe.Pointer {
|
||||
return unsafe.Add(unsafe.Pointer(probe), SizeofIoUringProbe)
|
||||
}
|
||||
func (probe *IoUringProbe) GetOpAt(index int) *IoUringProbeOp {
|
||||
return (*IoUringProbeOp)(unsafe.Add(probe.GetOps(), SizeofIoUringProbeOp*uintptr(index)))
|
||||
}
|
||||
|
||||
/*
|
||||
* GetBufs
|
||||
|
@ -31,3 +34,6 @@ func (probe *IoUringProbe) GetOps() unsafe.Pointer {
|
|||
func (bring *IoUringBufRing) GetBufs() unsafe.Pointer {
|
||||
return unsafe.Add(unsafe.Pointer(bring), SizeofIoUringBufRing)
|
||||
}
|
||||
func (bring *IoUringBufRing) GetBufAt(index int) *IoUringBuf {
|
||||
return (*IoUringBuf)(unsafe.Add(bring.GetBufs(), SizeofIoUringBuf*uintptr(index)))
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ const (
|
|||
SizeofIoUringProbe = unsafe.Sizeof(IoUringProbe{})
|
||||
SizeofIoUringProbeOp = unsafe.Sizeof(IoUringProbeOp{})
|
||||
SizeofIoUringBufRing = unsafe.Sizeof(IoUringBufRing{})
|
||||
SizeofIoUringBuf = unsafe.Sizeof(IoUringBuf{})
|
||||
)
|
||||
|
||||
func _SizeChecker() {
|
||||
|
@ -22,6 +23,7 @@ func _SizeChecker() {
|
|||
_ = x[SizeofIoUringProbe-16]
|
||||
_ = x[SizeofIoUringProbeOp-8]
|
||||
_ = x[SizeofIoUringBufRing-16]
|
||||
_ = x[SizeofIoUringBuf-16]
|
||||
}
|
||||
|
||||
type IoUring struct {
|
||||
|
|
4
uring.go
4
uring.go
|
@ -46,3 +46,7 @@ func (h *IoUring) Submit() (int, error) {
|
|||
func (h *IoUring) SubmitAndWait(waitNr uint32) (int, error) {
|
||||
return h.io_uring_submit_and_wait(waitNr)
|
||||
}
|
||||
|
||||
func (h *IoUring) GetProbeRing() *IoUringProbe {
|
||||
return h.io_uring_get_probe_ring()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue