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