1 // Generated by jextract
2
3 package jdk.internal.ffi.generated.iouring;
4
5 import java.lang.invoke.*;
6 import java.lang.foreign.*;
7 import java.nio.ByteOrder;
8 import java.util.*;
9 import java.util.function.*;
10 import java.util.stream.*;
11
12 import static java.lang.foreign.ValueLayout.*;
13 import static java.lang.foreign.MemoryLayout.PathElement.*;
14
15 /**
16 * {@snippet lang=c :
17 * struct io_uring_params {
18 * __u32 sq_entries;
19 * __u32 cq_entries;
20 * __u32 flags;
21 * __u32 sq_thread_cpu;
22 * __u32 sq_thread_idle;
23 * __u32 features;
24 * __u32 wq_fd;
25 * __u32 resv[3];
26 * struct io_sqring_offsets sq_off;
27 * struct io_cqring_offsets cq_off;
28 * }
29 * }
30 */
31 @SuppressWarnings("restricted") public class io_uring_params {
32
33 io_uring_params() {
34 // Suppresses public default constructor, ensuring non-instantiability,
35 // but allows generated subclasses in same package.
36 }
37
38 private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
39 iouring_h.C_INT.withName("sq_entries"),
40 iouring_h.C_INT.withName("cq_entries"),
41 iouring_h.C_INT.withName("flags"),
42 iouring_h.C_INT.withName("sq_thread_cpu"),
43 iouring_h.C_INT.withName("sq_thread_idle"),
44 iouring_h.C_INT.withName("features"),
45 iouring_h.C_INT.withName("wq_fd"),
46 MemoryLayout.sequenceLayout(3, iouring_h.C_INT).withName("resv"),
47 io_sqring_offsets.$LAYOUT().withName("sq_off"),
48 io_cqring_offsets.$LAYOUT().withName("cq_off")
49 ).withName("io_uring_params");
50
51 public static final GroupLayout $LAYOUT() {
52 return $LAYOUT;
53 }
54
55 private static final long sq_entries$OFFSET = 0;
56 private static final OfInt sq_entries$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sq_entries"));
57
58 /**
59 * Getter for field:
60 * {@snippet lang=c :
61 * __u32 sq_entries
62 * }
63 */
64 public static int sq_entries(MemorySegment struct) {
65 return struct.get(sq_entries$LAYOUT, sq_entries$OFFSET);
66 }
67
68 /**
69 * Setter for field:
70 * {@snippet lang=c :
71 * __u32 sq_entries
72 * }
73 */
74 public static void sq_entries(MemorySegment struct, int fieldValue) {
75 struct.set(sq_entries$LAYOUT, sq_entries$OFFSET, fieldValue);
76 }
77
78 private static final long cq_entries$OFFSET = 4;
79 private static final OfInt cq_entries$LAYOUT = (OfInt)$LAYOUT.select(groupElement("cq_entries"));
80
81 /**
82 * Getter for field:
83 * {@snippet lang=c :
84 * __u32 cq_entries
85 * }
86 */
87 public static int cq_entries(MemorySegment struct) {
88 return struct.get(cq_entries$LAYOUT, cq_entries$OFFSET);
89 }
90
91 /**
92 * Setter for field:
93 * {@snippet lang=c :
94 * __u32 cq_entries
95 * }
96 */
97 public static void cq_entries(MemorySegment struct, int fieldValue) {
98 struct.set(cq_entries$LAYOUT, cq_entries$OFFSET, fieldValue);
99 }
100
101 private static final long flags$OFFSET = 8;
102 private static final OfInt flags$LAYOUT = (OfInt)$LAYOUT.select(groupElement("flags"));
103
104 /**
105 * Getter for field:
106 * {@snippet lang=c :
107 * __u32 flags
108 * }
109 */
110 public static int flags(MemorySegment struct) {
111 return struct.get(flags$LAYOUT, flags$OFFSET);
112 }
113
114 /**
115 * Setter for field:
116 * {@snippet lang=c :
117 * __u32 flags
118 * }
119 */
120 public static void flags(MemorySegment struct, int fieldValue) {
121 struct.set(flags$LAYOUT, flags$OFFSET, fieldValue);
122 }
123
124 private static final long sq_thread_cpu$OFFSET = 12;
125 private static final OfInt sq_thread_cpu$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sq_thread_cpu"));
126
127 /**
128 * Getter for field:
129 * {@snippet lang=c :
130 * __u32 sq_thread_cpu
131 * }
132 */
133 public static int sq_thread_cpu(MemorySegment struct) {
134 return struct.get(sq_thread_cpu$LAYOUT, sq_thread_cpu$OFFSET);
135 }
136
137 /**
138 * Setter for field:
139 * {@snippet lang=c :
140 * __u32 sq_thread_cpu
141 * }
142 */
143 public static void sq_thread_cpu(MemorySegment struct, int fieldValue) {
144 struct.set(sq_thread_cpu$LAYOUT, sq_thread_cpu$OFFSET, fieldValue);
145 }
146
147 private static final long sq_thread_idle$OFFSET = 16;
148 private static final OfInt sq_thread_idle$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sq_thread_idle"));
149
150 /**
151 * Getter for field:
152 * {@snippet lang=c :
153 * __u32 sq_thread_idle
154 * }
155 */
156 public static int sq_thread_idle(MemorySegment struct) {
157 return struct.get(sq_thread_idle$LAYOUT, sq_thread_idle$OFFSET);
158 }
159
160 /**
161 * Setter for field:
162 * {@snippet lang=c :
163 * __u32 sq_thread_idle
164 * }
165 */
166 public static void sq_thread_idle(MemorySegment struct, int fieldValue) {
167 struct.set(sq_thread_idle$LAYOUT, sq_thread_idle$OFFSET, fieldValue);
168 }
169
170 private static final long features$OFFSET = 20;
171 private static final OfInt features$LAYOUT = (OfInt)$LAYOUT.select(groupElement("features"));
172
173 /**
174 * Getter for field:
175 * {@snippet lang=c :
176 * __u32 features
177 * }
178 */
179 public static int features(MemorySegment struct) {
180 return struct.get(features$LAYOUT, features$OFFSET);
181 }
182
183 /**
184 * Setter for field:
185 * {@snippet lang=c :
186 * __u32 features
187 * }
188 */
189 public static void features(MemorySegment struct, int fieldValue) {
190 struct.set(features$LAYOUT, features$OFFSET, fieldValue);
191 }
192
193 private static final long wq_fd$OFFSET = 24;
194 private static final OfInt wq_fd$LAYOUT = (OfInt)$LAYOUT.select(groupElement("wq_fd"));
195
196 /**
197 * Getter for field:
198 * {@snippet lang=c :
199 * __u32 wq_fd
200 * }
201 */
202 public static int wq_fd(MemorySegment struct) {
203 return struct.get(wq_fd$LAYOUT, wq_fd$OFFSET);
204 }
205
206 /**
207 * Setter for field:
208 * {@snippet lang=c :
209 * __u32 wq_fd
210 * }
211 */
212 public static void wq_fd(MemorySegment struct, int fieldValue) {
213 struct.set(wq_fd$LAYOUT, wq_fd$OFFSET, fieldValue);
214 }
215
216 private static final long resv$OFFSET = 28;
217 private static final long resv$SIZE = 12;
218
219 /**
220 * Getter for field:
221 * {@snippet lang=c :
222 * __u32 resv[3]
223 * }
224 */
225 public static MemorySegment resv(MemorySegment struct) {
226 return struct.asSlice(resv$OFFSET, resv$SIZE);
227 }
228
229 /**
230 * Setter for field:
231 * {@snippet lang=c :
232 * __u32 resv[3]
233 * }
234 */
235 public static void resv(MemorySegment struct, MemorySegment fieldValue) {
236 MemorySegment.copy(fieldValue, 0L, struct, resv$OFFSET, resv$SIZE);
237 }
238
239 private static final long sq_off$OFFSET = 40;
240 private static final long sq_off$SIZE = 40;
241
242 /**
243 * Getter for field:
244 * {@snippet lang=c :
245 * struct io_sqring_offsets sq_off
246 * }
247 */
248 public static MemorySegment sq_off(MemorySegment struct) {
249 return struct.asSlice(sq_off$OFFSET, sq_off$SIZE);
250 }
251
252 /**
253 * Setter for field:
254 * {@snippet lang=c :
255 * struct io_sqring_offsets sq_off
256 * }
257 */
258 public static void sq_off(MemorySegment struct, MemorySegment fieldValue) {
259 MemorySegment.copy(fieldValue, 0L, struct, sq_off$OFFSET, sq_off$SIZE);
260 }
261
262 private static final long cq_off$OFFSET = 80;
263 private static final long cq_off$SIZE = 40;
264
265 /**
266 * Getter for field:
267 * {@snippet lang=c :
268 * struct io_cqring_offsets cq_off
269 * }
270 */
271 public static MemorySegment cq_off(MemorySegment struct) {
272 return struct.asSlice(cq_off$OFFSET, cq_off$SIZE);
273 }
274
275 /**
276 * Setter for field:
277 * {@snippet lang=c :
278 * struct io_cqring_offsets cq_off
279 * }
280 */
281 public static void cq_off(MemorySegment struct, MemorySegment fieldValue) {
282 MemorySegment.copy(fieldValue, 0L, struct, cq_off$OFFSET, cq_off$SIZE);
283 }
284
285 public static MemorySegment asSlice(MemorySegment array, long index) {
286 return array.asSlice($LAYOUT().byteSize() * index);
287 }
288
289 public static long sizeof() { return $LAYOUT().byteSize(); }
290
291 public static MemorySegment allocate(SegmentAllocator allocator) {
292 return allocator.allocate($LAYOUT());
293 }
294
295 public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
296 return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, $LAYOUT()));
297 }
298
299 public static MemorySegment reinterpret(MemorySegment addr, Arena scope, Consumer<MemorySegment> cleanup) {
300 return reinterpret(addr, 1, scope, cleanup);
301 }
302
303 public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena scope, Consumer<MemorySegment> cleanup) {
304 return addr.reinterpret($LAYOUT().byteSize() * elementCount, scope, cleanup);
305 }
306 }
307