me.bechberger.ebpf.bpf.raw.bpf_prog_load_opts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rawbpf Show documentation
Show all versions of rawbpf Show documentation
Raw Panama bindings for libbpf generated for jextract on 64-bit Linux
The newest version!
// Generated by jextract
package me.bechberger.ebpf.bpf.raw;
import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;
/**
* {@snippet lang=c :
* struct bpf_prog_load_opts {
* size_t sz;
* int attempts;
* enum bpf_attach_type expected_attach_type;
* __u32 prog_btf_fd;
* __u32 prog_flags;
* __u32 prog_ifindex;
* __u32 kern_version;
* __u32 attach_btf_id;
* __u32 attach_prog_fd;
* __u32 attach_btf_obj_fd;
* const int *fd_array;
* const void *func_info;
* __u32 func_info_cnt;
* __u32 func_info_rec_size;
* const void *line_info;
* __u32 line_info_cnt;
* __u32 line_info_rec_size;
* __u32 log_level;
* __u32 log_size;
* char *log_buf;
* __u32 log_true_size;
* __u32 token_fd;
* size_t : 0;
* }
* }
*/
public class bpf_prog_load_opts {
bpf_prog_load_opts() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Lib.C_LONG.withName("sz"),
Lib.C_INT.withName("attempts"),
Lib.C_INT.withName("expected_attach_type"),
Lib.C_INT.withName("prog_btf_fd"),
Lib.C_INT.withName("prog_flags"),
Lib.C_INT.withName("prog_ifindex"),
Lib.C_INT.withName("kern_version"),
Lib.C_INT.withName("attach_btf_id"),
Lib.C_INT.withName("attach_prog_fd"),
Lib.C_INT.withName("attach_btf_obj_fd"),
MemoryLayout.paddingLayout(4),
Lib.C_POINTER.withName("fd_array"),
Lib.C_POINTER.withName("func_info"),
Lib.C_INT.withName("func_info_cnt"),
Lib.C_INT.withName("func_info_rec_size"),
Lib.C_POINTER.withName("line_info"),
Lib.C_INT.withName("line_info_cnt"),
Lib.C_INT.withName("line_info_rec_size"),
Lib.C_INT.withName("log_level"),
Lib.C_INT.withName("log_size"),
Lib.C_POINTER.withName("log_buf"),
Lib.C_INT.withName("log_true_size"),
Lib.C_INT.withName("token_fd")
).withName("bpf_prog_load_opts");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfLong sz$LAYOUT = (OfLong)$LAYOUT.select(groupElement("sz"));
/**
* Layout for field:
* {@snippet lang=c :
* size_t sz
* }
*/
public static final OfLong sz$layout() {
return sz$LAYOUT;
}
private static final long sz$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* size_t sz
* }
*/
public static final long sz$offset() {
return sz$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* size_t sz
* }
*/
public static long sz(MemorySegment struct) {
return struct.get(sz$LAYOUT, sz$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* size_t sz
* }
*/
public static void sz(MemorySegment struct, long fieldValue) {
struct.set(sz$LAYOUT, sz$OFFSET, fieldValue);
}
private static final OfInt attempts$LAYOUT = (OfInt)$LAYOUT.select(groupElement("attempts"));
/**
* Layout for field:
* {@snippet lang=c :
* int attempts
* }
*/
public static final OfInt attempts$layout() {
return attempts$LAYOUT;
}
private static final long attempts$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* int attempts
* }
*/
public static final long attempts$offset() {
return attempts$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int attempts
* }
*/
public static int attempts(MemorySegment struct) {
return struct.get(attempts$LAYOUT, attempts$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int attempts
* }
*/
public static void attempts(MemorySegment struct, int fieldValue) {
struct.set(attempts$LAYOUT, attempts$OFFSET, fieldValue);
}
private static final OfInt expected_attach_type$LAYOUT = (OfInt)$LAYOUT.select(groupElement("expected_attach_type"));
/**
* Layout for field:
* {@snippet lang=c :
* enum bpf_attach_type expected_attach_type
* }
*/
public static final OfInt expected_attach_type$layout() {
return expected_attach_type$LAYOUT;
}
private static final long expected_attach_type$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* enum bpf_attach_type expected_attach_type
* }
*/
public static final long expected_attach_type$offset() {
return expected_attach_type$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* enum bpf_attach_type expected_attach_type
* }
*/
public static int expected_attach_type(MemorySegment struct) {
return struct.get(expected_attach_type$LAYOUT, expected_attach_type$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* enum bpf_attach_type expected_attach_type
* }
*/
public static void expected_attach_type(MemorySegment struct, int fieldValue) {
struct.set(expected_attach_type$LAYOUT, expected_attach_type$OFFSET, fieldValue);
}
private static final OfInt prog_btf_fd$LAYOUT = (OfInt)$LAYOUT.select(groupElement("prog_btf_fd"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 prog_btf_fd
* }
*/
public static final OfInt prog_btf_fd$layout() {
return prog_btf_fd$LAYOUT;
}
private static final long prog_btf_fd$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 prog_btf_fd
* }
*/
public static final long prog_btf_fd$offset() {
return prog_btf_fd$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 prog_btf_fd
* }
*/
public static int prog_btf_fd(MemorySegment struct) {
return struct.get(prog_btf_fd$LAYOUT, prog_btf_fd$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 prog_btf_fd
* }
*/
public static void prog_btf_fd(MemorySegment struct, int fieldValue) {
struct.set(prog_btf_fd$LAYOUT, prog_btf_fd$OFFSET, fieldValue);
}
private static final OfInt prog_flags$LAYOUT = (OfInt)$LAYOUT.select(groupElement("prog_flags"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 prog_flags
* }
*/
public static final OfInt prog_flags$layout() {
return prog_flags$LAYOUT;
}
private static final long prog_flags$OFFSET = 20;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 prog_flags
* }
*/
public static final long prog_flags$offset() {
return prog_flags$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 prog_flags
* }
*/
public static int prog_flags(MemorySegment struct) {
return struct.get(prog_flags$LAYOUT, prog_flags$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 prog_flags
* }
*/
public static void prog_flags(MemorySegment struct, int fieldValue) {
struct.set(prog_flags$LAYOUT, prog_flags$OFFSET, fieldValue);
}
private static final OfInt prog_ifindex$LAYOUT = (OfInt)$LAYOUT.select(groupElement("prog_ifindex"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 prog_ifindex
* }
*/
public static final OfInt prog_ifindex$layout() {
return prog_ifindex$LAYOUT;
}
private static final long prog_ifindex$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 prog_ifindex
* }
*/
public static final long prog_ifindex$offset() {
return prog_ifindex$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 prog_ifindex
* }
*/
public static int prog_ifindex(MemorySegment struct) {
return struct.get(prog_ifindex$LAYOUT, prog_ifindex$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 prog_ifindex
* }
*/
public static void prog_ifindex(MemorySegment struct, int fieldValue) {
struct.set(prog_ifindex$LAYOUT, prog_ifindex$OFFSET, fieldValue);
}
private static final OfInt kern_version$LAYOUT = (OfInt)$LAYOUT.select(groupElement("kern_version"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 kern_version
* }
*/
public static final OfInt kern_version$layout() {
return kern_version$LAYOUT;
}
private static final long kern_version$OFFSET = 28;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 kern_version
* }
*/
public static final long kern_version$offset() {
return kern_version$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 kern_version
* }
*/
public static int kern_version(MemorySegment struct) {
return struct.get(kern_version$LAYOUT, kern_version$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 kern_version
* }
*/
public static void kern_version(MemorySegment struct, int fieldValue) {
struct.set(kern_version$LAYOUT, kern_version$OFFSET, fieldValue);
}
private static final OfInt attach_btf_id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("attach_btf_id"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 attach_btf_id
* }
*/
public static final OfInt attach_btf_id$layout() {
return attach_btf_id$LAYOUT;
}
private static final long attach_btf_id$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 attach_btf_id
* }
*/
public static final long attach_btf_id$offset() {
return attach_btf_id$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 attach_btf_id
* }
*/
public static int attach_btf_id(MemorySegment struct) {
return struct.get(attach_btf_id$LAYOUT, attach_btf_id$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 attach_btf_id
* }
*/
public static void attach_btf_id(MemorySegment struct, int fieldValue) {
struct.set(attach_btf_id$LAYOUT, attach_btf_id$OFFSET, fieldValue);
}
private static final OfInt attach_prog_fd$LAYOUT = (OfInt)$LAYOUT.select(groupElement("attach_prog_fd"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 attach_prog_fd
* }
*/
public static final OfInt attach_prog_fd$layout() {
return attach_prog_fd$LAYOUT;
}
private static final long attach_prog_fd$OFFSET = 36;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 attach_prog_fd
* }
*/
public static final long attach_prog_fd$offset() {
return attach_prog_fd$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 attach_prog_fd
* }
*/
public static int attach_prog_fd(MemorySegment struct) {
return struct.get(attach_prog_fd$LAYOUT, attach_prog_fd$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 attach_prog_fd
* }
*/
public static void attach_prog_fd(MemorySegment struct, int fieldValue) {
struct.set(attach_prog_fd$LAYOUT, attach_prog_fd$OFFSET, fieldValue);
}
private static final OfInt attach_btf_obj_fd$LAYOUT = (OfInt)$LAYOUT.select(groupElement("attach_btf_obj_fd"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 attach_btf_obj_fd
* }
*/
public static final OfInt attach_btf_obj_fd$layout() {
return attach_btf_obj_fd$LAYOUT;
}
private static final long attach_btf_obj_fd$OFFSET = 40;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 attach_btf_obj_fd
* }
*/
public static final long attach_btf_obj_fd$offset() {
return attach_btf_obj_fd$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 attach_btf_obj_fd
* }
*/
public static int attach_btf_obj_fd(MemorySegment struct) {
return struct.get(attach_btf_obj_fd$LAYOUT, attach_btf_obj_fd$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 attach_btf_obj_fd
* }
*/
public static void attach_btf_obj_fd(MemorySegment struct, int fieldValue) {
struct.set(attach_btf_obj_fd$LAYOUT, attach_btf_obj_fd$OFFSET, fieldValue);
}
private static final AddressLayout fd_array$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fd_array"));
/**
* Layout for field:
* {@snippet lang=c :
* const int *fd_array
* }
*/
public static final AddressLayout fd_array$layout() {
return fd_array$LAYOUT;
}
private static final long fd_array$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* const int *fd_array
* }
*/
public static final long fd_array$offset() {
return fd_array$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const int *fd_array
* }
*/
public static MemorySegment fd_array(MemorySegment struct) {
return struct.get(fd_array$LAYOUT, fd_array$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const int *fd_array
* }
*/
public static void fd_array(MemorySegment struct, MemorySegment fieldValue) {
struct.set(fd_array$LAYOUT, fd_array$OFFSET, fieldValue);
}
private static final AddressLayout func_info$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("func_info"));
/**
* Layout for field:
* {@snippet lang=c :
* const void *func_info
* }
*/
public static final AddressLayout func_info$layout() {
return func_info$LAYOUT;
}
private static final long func_info$OFFSET = 56;
/**
* Offset for field:
* {@snippet lang=c :
* const void *func_info
* }
*/
public static final long func_info$offset() {
return func_info$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const void *func_info
* }
*/
public static MemorySegment func_info(MemorySegment struct) {
return struct.get(func_info$LAYOUT, func_info$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const void *func_info
* }
*/
public static void func_info(MemorySegment struct, MemorySegment fieldValue) {
struct.set(func_info$LAYOUT, func_info$OFFSET, fieldValue);
}
private static final OfInt func_info_cnt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("func_info_cnt"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 func_info_cnt
* }
*/
public static final OfInt func_info_cnt$layout() {
return func_info_cnt$LAYOUT;
}
private static final long func_info_cnt$OFFSET = 64;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 func_info_cnt
* }
*/
public static final long func_info_cnt$offset() {
return func_info_cnt$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 func_info_cnt
* }
*/
public static int func_info_cnt(MemorySegment struct) {
return struct.get(func_info_cnt$LAYOUT, func_info_cnt$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 func_info_cnt
* }
*/
public static void func_info_cnt(MemorySegment struct, int fieldValue) {
struct.set(func_info_cnt$LAYOUT, func_info_cnt$OFFSET, fieldValue);
}
private static final OfInt func_info_rec_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("func_info_rec_size"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 func_info_rec_size
* }
*/
public static final OfInt func_info_rec_size$layout() {
return func_info_rec_size$LAYOUT;
}
private static final long func_info_rec_size$OFFSET = 68;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 func_info_rec_size
* }
*/
public static final long func_info_rec_size$offset() {
return func_info_rec_size$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 func_info_rec_size
* }
*/
public static int func_info_rec_size(MemorySegment struct) {
return struct.get(func_info_rec_size$LAYOUT, func_info_rec_size$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 func_info_rec_size
* }
*/
public static void func_info_rec_size(MemorySegment struct, int fieldValue) {
struct.set(func_info_rec_size$LAYOUT, func_info_rec_size$OFFSET, fieldValue);
}
private static final AddressLayout line_info$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("line_info"));
/**
* Layout for field:
* {@snippet lang=c :
* const void *line_info
* }
*/
public static final AddressLayout line_info$layout() {
return line_info$LAYOUT;
}
private static final long line_info$OFFSET = 72;
/**
* Offset for field:
* {@snippet lang=c :
* const void *line_info
* }
*/
public static final long line_info$offset() {
return line_info$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const void *line_info
* }
*/
public static MemorySegment line_info(MemorySegment struct) {
return struct.get(line_info$LAYOUT, line_info$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const void *line_info
* }
*/
public static void line_info(MemorySegment struct, MemorySegment fieldValue) {
struct.set(line_info$LAYOUT, line_info$OFFSET, fieldValue);
}
private static final OfInt line_info_cnt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("line_info_cnt"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 line_info_cnt
* }
*/
public static final OfInt line_info_cnt$layout() {
return line_info_cnt$LAYOUT;
}
private static final long line_info_cnt$OFFSET = 80;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 line_info_cnt
* }
*/
public static final long line_info_cnt$offset() {
return line_info_cnt$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 line_info_cnt
* }
*/
public static int line_info_cnt(MemorySegment struct) {
return struct.get(line_info_cnt$LAYOUT, line_info_cnt$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 line_info_cnt
* }
*/
public static void line_info_cnt(MemorySegment struct, int fieldValue) {
struct.set(line_info_cnt$LAYOUT, line_info_cnt$OFFSET, fieldValue);
}
private static final OfInt line_info_rec_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("line_info_rec_size"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 line_info_rec_size
* }
*/
public static final OfInt line_info_rec_size$layout() {
return line_info_rec_size$LAYOUT;
}
private static final long line_info_rec_size$OFFSET = 84;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 line_info_rec_size
* }
*/
public static final long line_info_rec_size$offset() {
return line_info_rec_size$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 line_info_rec_size
* }
*/
public static int line_info_rec_size(MemorySegment struct) {
return struct.get(line_info_rec_size$LAYOUT, line_info_rec_size$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 line_info_rec_size
* }
*/
public static void line_info_rec_size(MemorySegment struct, int fieldValue) {
struct.set(line_info_rec_size$LAYOUT, line_info_rec_size$OFFSET, fieldValue);
}
private static final OfInt log_level$LAYOUT = (OfInt)$LAYOUT.select(groupElement("log_level"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 log_level
* }
*/
public static final OfInt log_level$layout() {
return log_level$LAYOUT;
}
private static final long log_level$OFFSET = 88;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 log_level
* }
*/
public static final long log_level$offset() {
return log_level$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 log_level
* }
*/
public static int log_level(MemorySegment struct) {
return struct.get(log_level$LAYOUT, log_level$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 log_level
* }
*/
public static void log_level(MemorySegment struct, int fieldValue) {
struct.set(log_level$LAYOUT, log_level$OFFSET, fieldValue);
}
private static final OfInt log_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("log_size"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 log_size
* }
*/
public static final OfInt log_size$layout() {
return log_size$LAYOUT;
}
private static final long log_size$OFFSET = 92;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 log_size
* }
*/
public static final long log_size$offset() {
return log_size$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 log_size
* }
*/
public static int log_size(MemorySegment struct) {
return struct.get(log_size$LAYOUT, log_size$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 log_size
* }
*/
public static void log_size(MemorySegment struct, int fieldValue) {
struct.set(log_size$LAYOUT, log_size$OFFSET, fieldValue);
}
private static final AddressLayout log_buf$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("log_buf"));
/**
* Layout for field:
* {@snippet lang=c :
* char *log_buf
* }
*/
public static final AddressLayout log_buf$layout() {
return log_buf$LAYOUT;
}
private static final long log_buf$OFFSET = 96;
/**
* Offset for field:
* {@snippet lang=c :
* char *log_buf
* }
*/
public static final long log_buf$offset() {
return log_buf$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* char *log_buf
* }
*/
public static MemorySegment log_buf(MemorySegment struct) {
return struct.get(log_buf$LAYOUT, log_buf$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* char *log_buf
* }
*/
public static void log_buf(MemorySegment struct, MemorySegment fieldValue) {
struct.set(log_buf$LAYOUT, log_buf$OFFSET, fieldValue);
}
private static final OfInt log_true_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("log_true_size"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 log_true_size
* }
*/
public static final OfInt log_true_size$layout() {
return log_true_size$LAYOUT;
}
private static final long log_true_size$OFFSET = 104;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 log_true_size
* }
*/
public static final long log_true_size$offset() {
return log_true_size$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 log_true_size
* }
*/
public static int log_true_size(MemorySegment struct) {
return struct.get(log_true_size$LAYOUT, log_true_size$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 log_true_size
* }
*/
public static void log_true_size(MemorySegment struct, int fieldValue) {
struct.set(log_true_size$LAYOUT, log_true_size$OFFSET, fieldValue);
}
private static final OfInt token_fd$LAYOUT = (OfInt)$LAYOUT.select(groupElement("token_fd"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 token_fd
* }
*/
public static final OfInt token_fd$layout() {
return token_fd$LAYOUT;
}
private static final long token_fd$OFFSET = 108;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 token_fd
* }
*/
public static final long token_fd$offset() {
return token_fd$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 token_fd
* }
*/
public static int token_fd(MemorySegment struct) {
return struct.get(token_fd$LAYOUT, token_fd$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 token_fd
* }
*/
public static void token_fd(MemorySegment struct, int fieldValue) {
struct.set(token_fd$LAYOUT, token_fd$OFFSET, fieldValue);
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
}