-
Notifications
You must be signed in to change notification settings - Fork 10
/
consts.go
171 lines (149 loc) · 3.42 KB
/
consts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// +build linux
package iouring
import "io"
// See uapi/linux/io_uring.h
// Opcode is an opcode for the ring.
type Opcode uint8
const (
// SetupSyscall defines the syscall number for io_uring_setup.
SetupSyscall = 425
// EnterSyscall defines the syscall number for io_uring_enter.
EnterSyscall = 426
// RegisterSyscall defines the syscall number for io_uring_register.
RegisterSyscall = 427
)
const (
// FeatSingleMmap is used to configure a single mmap'd ring.
FeatSingleMmap = (1 << 0)
// FeatNoDrop is used to ensure that no CQEs are dropped.
FeatNoDrop = (1 << 1)
FeatSubmitStable = (1 << 2)
FeatRwCurPos = (1 << 3)
FeatCurPersonality = (1 << 4)
)
const (
/*
* sqe->flags
*/
SqeFixedFileBit = iota
SqeIoDrainBit
SqeIoLinkBit
SqeIoHardlinkBit
SqeAsyncBit
SqeBufferSelectBit
// SqeFixedFile use fixed fileset
SqeFixedFile uint8 = (1 << SqeFixedFileBit)
// SqeIoDrain issue after inflight IO
SqeIoDrain uint8 = (1 << SqeIoDrainBit)
// SqeIoLink is used to link multiple SQEs.
SqeIoLink uint8 = (1 << SqeIoLinkBit)
// SqeIoHardlink is a hard link to multiple SQEs
SqeIoHardlink uint8 = (1 << SqeIoHardlinkBit)
// SqeAsync is use to specify async io.
SqeAsync uint8 = (1 << SqeAsyncBit)
// SqeBufferSelect is used to specify buffer select.
SqeBufferSelect uint8 = (1 << SqeBufferSelectBit)
/*
* io_uring_setup() flags
*/
// SetupIOPoll io_context is polled
SetupIOPoll uint32 = (1 << 0)
// SetupSQPoll SQ poll thread
SetupSQPoll uint32 = (1 << 1)
// SetupSQAFF sq_thread_cpu is valid
SetupSQAFF uint32 = (1 << 2)
// SetupCqSize app defines CQ size
SetupCqSize uint32 = (1 << 3)
// SetupClamp clamp SQ/CQ ring sizes
SetupClamp uint32 = (1 << 4)
// SetupAttachWq attach to existing wq
SetupAttachWq uint32 = (1 << 5)
)
const (
Nop Opcode = iota
Readv
Writev
Fsync
ReadFixed
WriteFixed
PollAdd
PollRemove
SyncFileRange
SendMsg
RecvMsg
Timeout
TimeoutRemove
Accept
AsyncCancel
LinkTimeout
Connect
Fallocate
OpenAt
Close
FilesUpdate
Statx
Read
Write
Fadvise
Madvise
Send
Recv
Openat2
EpollCtl
Splice
ProvideBuffers
RemoveBuffers
OpSupported = (1 << 0)
)
const (
/*
* sqe->fsync_flags
*/
// FsyncDatasync ...
FsyncDatasync uint = (1 << 0)
/*
* Magic offsets for the application to mmap the data it needs
*/
// SqRingOffset is the offset of the submission queue.
SqRingOffset uint64 = 0
// CqRingOffset is the offset of the completion queue.
CqRingOffset uint64 = 0x8000000
// SqeRingOffset is the offset of the submission queue entries.
SqeRingOffset uint64 = 0x10000000
/*
* sq_ring->flags
*/
// SqNeedWakeup needs io_uring_enter wakeup
SqNeedWakeup uint32 = (1 << 0)
SqCqOverflow uint32 = (1 << 1)
/*
* io_uring_enter(2) flags
*/
// EnterGetEvents ...
EnterGetEvents uint = (1 << 0)
// EnterSqWakeup ...
EnterSqWakeup uint = (1 << 1)
/*
* io_uring_register(2) opcodes and arguments
*/
RegRegisterBuffers = 0
RegUnregisterBuffers = 1
RegRegisterFiles = 2
RegUnregisterFiles = 3
RegRegisterEventFd = 4
RegUnregisterEventfd = 5
RegRegisterFilesUpdate = 6
RegRegisterEventFdAsync = 7
RegRegisterProbe = 8
RegRegisterPersonality = 9
RegUnregisterPersonality = 10
)
// ReadWriteSeekerCloser is a ReadWriteCloser and ReadWriteSeeker.
type ReadWriteSeekerCloser interface {
io.Reader
io.Writer
io.Seeker
io.Closer
ReadAt([]byte, int64) (int, error)
WriteAt([]byte, int64) (int, error)
}