1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.channel.uring;
17
18 import io.netty.channel.IoOps;
19
20
21
22
23
24 public final class IoUringIoOps implements IoOps {
25
26 private final byte opcode;
27 private final int flags;
28 private final short ioPrio;
29 private final int fd;
30 private final int rwFlags;
31 private final long bufferAddress;
32 private final int length;
33 private final long offset;
34 private final short data;
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 public IoUringIoOps(byte opcode, int flags, short ioPrio, int fd, int rwFlags, long bufferAddress,
50 int length, long offset, short data) {
51 this.opcode = opcode;
52 this.flags = flags;
53 this.ioPrio = ioPrio;
54 this.fd = fd;
55 this.rwFlags = rwFlags;
56 this.bufferAddress = bufferAddress;
57 this.length = length;
58 this.offset = offset;
59 this.data = data;
60 }
61
62
63
64
65
66
67 public int fd() {
68 return fd;
69 }
70
71
72
73
74
75
76 public byte opcode() {
77 return opcode;
78 }
79
80
81
82
83
84
85 public int flags() {
86 return flags;
87 }
88
89
90
91
92
93
94 public short ioPrio() {
95 return ioPrio;
96 }
97
98
99
100
101
102
103 public int rwFlags() {
104 return rwFlags;
105 }
106
107
108
109
110
111
112 public long bufferAddress() {
113 return bufferAddress;
114 }
115
116
117
118
119
120
121 public int length() {
122 return length;
123 }
124
125
126
127
128
129
130 public long offset() {
131 return offset;
132 }
133
134
135
136
137
138
139 public short data() {
140 return data;
141 }
142
143 @Override
144 public String toString() {
145 return "IOUringIoOps{" +
146 "opcode=" + opcode +
147 ", flags=" + flags +
148 ", ioPrio=" + ioPrio +
149 ", fd=" + fd +
150 ", rwFlags=" + rwFlags +
151 ", bufferAddress=" + bufferAddress +
152 ", length=" + length +
153 ", offset=" + offset +
154 ", data=" + data +
155 '}';
156 }
157
158
159
160
161
162
163
164
165
166
167
168 public static IoUringIoOps newAsyncCancel(int fd, int flags, long userData, short data) {
169
170 return new IoUringIoOps(Native.IORING_OP_ASYNC_CANCEL, flags, (short) 0, fd, 0,
171 userData, 0, 0, data);
172 }
173
174
175
176
177
178
179
180
181
182 public static IoUringIoOps newClose(int fd, int flags, short data) {
183 return new IoUringIoOps(Native.IORING_OP_CLOSE, flags, (short) 0, fd, 0, 0, 0, 0, data);
184 }
185
186
187
188
189
190
191
192
193
194
195 public static IoUringIoOps newPollAdd(int fd, int flags, int mask, short data) {
196 return new IoUringIoOps(Native.IORING_OP_POLL_ADD, flags, (short) 0, fd, mask, 0, 0, 0, data);
197 }
198
199
200
201
202
203
204
205
206
207
208 public static IoUringIoOps newSendmsg(int fd, int flags, int msgFlags, long address, short data) {
209 return new IoUringIoOps(Native.IORING_OP_SENDMSG, flags, (short) 0, fd, msgFlags, address, 1, 0, data);
210 }
211
212
213
214
215
216
217
218
219
220
221 public static IoUringIoOps newConnect(int fd, int flags, long remoteMemoryAddress, short data) {
222 return new IoUringIoOps(Native.IORING_OP_CONNECT, flags, (short) 0, fd, 0, remoteMemoryAddress,
223 0, Native.SIZEOF_SOCKADDR_STORAGE, data);
224 }
225
226
227
228
229
230
231
232
233
234
235
236 public static IoUringIoOps newPollRemove(int fd, int flags, long userData, short data) {
237 return new IoUringIoOps(Native.IORING_OP_POLL_REMOVE, flags, (short) 0, fd, 0, userData, 0, 0, data);
238 }
239
240
241
242
243
244
245
246
247
248
249
250
251 public static IoUringIoOps newAccept(int fd, int flags, int acceptFlags, long acceptedAddressMemoryAddress,
252 long acceptedAddressLengthMemoryAddress, short data) {
253 return new IoUringIoOps(Native.IORING_OP_ACCEPT, flags, (short) 0, fd, acceptFlags,
254 acceptedAddressMemoryAddress, 0, acceptedAddressLengthMemoryAddress, data);
255 }
256
257
258
259
260
261
262
263
264
265
266
267
268 public static IoUringIoOps newWritev(int fd, int flags, int writevFlags, long memoryAddress,
269 int length, short data) {
270 return new IoUringIoOps(Native.IORING_OP_WRITEV, flags, (short) 0, fd,
271 writevFlags, memoryAddress, length, 0, data);
272 }
273
274
275
276
277
278
279
280
281
282
283
284
285 public static IoUringIoOps newWrite(
286 int fd, int flags, int writeFlags, long memoryAddress, int length, short data) {
287 return new IoUringIoOps(Native.IORING_OP_WRITE, flags, (short) 0, fd,
288 writeFlags, memoryAddress, length, 0, data);
289 }
290
291
292
293
294
295
296
297
298
299
300
301
302 public static IoUringIoOps newRecv(
303 int fd, int flags, int recvFlags, long memoryAddress, int length, short data) {
304 return new IoUringIoOps(
305 Native.IORING_OP_RECV, flags, (short) 0, fd, recvFlags, memoryAddress, length, 0, data);
306 }
307
308
309
310
311
312
313
314
315
316
317
318 public static IoUringIoOps newRecvmsg(int fd, int flags, int msgFlags, long memoryAddress, short data) {
319 return new IoUringIoOps(
320 Native.IORING_OP_RECVMSG, flags, (short) 0, fd, msgFlags, memoryAddress, 1, 0, data);
321 }
322
323
324
325
326
327
328
329
330
331
332
333
334 public static IoUringIoOps newSend(
335 int fd, int flags, int sendFlags, long memoryAddress, int length, short data) {
336 return new IoUringIoOps(
337 Native.IORING_OP_SEND, flags, (short) 0, fd, sendFlags, memoryAddress, length, 0, data);
338 }
339
340
341
342
343
344
345
346
347
348
349 public static IoUringIoOps newShutdown(int fd, int flags, int how, int id, short data) {
350 return new IoUringIoOps(Native.IORING_OP_SHUTDOWN, flags, (short) 0, fd, 0, 0, how, 0, data);
351 }
352 }