From 2215e202f431fc25449541fcbbdb65ff096f3132 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Mon, 8 Feb 2021 04:01:28 +0000 Subject: [PATCH] Generate arch specific bindings Currently x86_64 and aarch64 are supported --- aya/include/linux_wrapper.h | 5 + aya/scripts/gen-bindings | 57 +- aya/src/generated/bpf_bindings.rs | 553 ------ aya/src/generated/btf_bindings.rs | 90 - aya/src/generated/linux_bindings_aarch64.rs | 1499 +++++++++++++++++ ...f_bindings.rs => linux_bindings_x86_64.rs} | 581 +++++++ aya/src/generated/mod.rs | 20 +- aya/src/generated/netlink_bindings.rs | 33 - aya/src/sys/netlink.rs | 3 +- 9 files changed, 2122 insertions(+), 719 deletions(-) create mode 100644 aya/include/linux_wrapper.h delete mode 100644 aya/src/generated/bpf_bindings.rs delete mode 100644 aya/src/generated/btf_bindings.rs create mode 100644 aya/src/generated/linux_bindings_aarch64.rs rename aya/src/generated/{perf_bindings.rs => linux_bindings_x86_64.rs} (63%) delete mode 100644 aya/src/generated/netlink_bindings.rs diff --git a/aya/include/linux_wrapper.h b/aya/include/linux_wrapper.h new file mode 100644 index 00000000..e14bcbec --- /dev/null +++ b/aya/include/linux_wrapper.h @@ -0,0 +1,5 @@ +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/aya/scripts/gen-bindings b/aya/scripts/gen-bindings index c12fac4b..df174682 100755 --- a/aya/scripts/gen-bindings +++ b/aya/scripts/gen-bindings @@ -1,5 +1,7 @@ #!/usr/bin/env sh +set -e + LIBBPF_DIR=$1 OUTPUT_DIR=$2 @@ -51,7 +53,6 @@ BTF_TYPES="\ btf_param \ btf_var \ btf_var_secinfo - " BTF_VARS="\ @@ -84,27 +85,8 @@ NETLINK_VARS="\ XDP_FLAGS_.* " -bindgen $LIBBPF_DIR/include/uapi/linux/bpf.h \ - --no-layout-tests \ - --default-enum-style moduleconsts \ - $(for ty in $BPF_TYPES; do - echo --whitelist-type "$ty" - done) \ - $(for var in $BPF_VARS; do - echo --whitelist-var "$var" - done) \ - > $OUTPUT_DIR/bpf_bindings.rs - -bindgen $LIBBPF_DIR/include/uapi/linux/btf.h \ - --no-layout-tests \ - --default-enum-style moduleconsts \ - $(for ty in $BTF_TYPES; do - echo --whitelist-type "$ty" - done) \ - $(for var in $BTF_VARS; do - echo --whitelist-var "$var" - done) \ - > $OUTPUT_DIR/btf_bindings.rs +LINUX_TYPES="$BPF_TYPES $BTF_TYPES $PERF_TYPES $NETLINK_TYPES" +LINUX_VARS="$BPF_VARS $BTF_VARS $PERF_VARS $NETLINK_VARS" bindgen $LIBBPF_DIR/src/libbpf_internal.h \ --no-layout-tests \ @@ -117,24 +99,37 @@ bindgen $LIBBPF_DIR/src/libbpf_internal.h \ done) \ > $OUTPUT_DIR/btf_internal_bindings.rs -bindgen include/perf_wrapper.h \ +KVER=5.10.0-051000 + +bindgen aya/include/linux_wrapper.h \ --no-layout-tests \ --default-enum-style moduleconsts \ - $(for ty in $PERF_TYPES; do + $(for ty in $LINUX_TYPES; do echo --whitelist-type "$ty" done) \ - $(for var in $PERF_VARS; do + $(for var in $LINUX_VARS; do echo --whitelist-var "$var" done) \ - > $OUTPUT_DIR/perf_bindings.rs - -bindgen include/netlink_wrapper.h \ + -- \ + -target x86_64 \ + -I $LIBBPF_DIR/include/uapi \ + -I $LIBBPF_DIR/include/ \ + -I /usr/include/x86_64-linux-gnu \ + > $OUTPUT_DIR/linux_bindings_x86_64.rs + +# requires libc6-dev-arm64-cross +bindgen aya/include/linux_wrapper.h \ --no-layout-tests \ --default-enum-style moduleconsts \ - $(for ty in $NETLINK_TYPES; do + $(for ty in $LINUX_TYPES; do echo --whitelist-type "$ty" done) \ - $(for var in $NETLINK_VARS; do + $(for var in $LINUX_VARS; do echo --whitelist-var "$var" done) \ - > $OUTPUT_DIR/netlink_bindings.rs \ No newline at end of file + -- \ + -target arm64 \ + -I $LIBBPF_DIR/include/uapi \ + -I $LIBBPF_DIR/include/ \ + -I /usr/aarch64-linux-gnu/include \ + > $OUTPUT_DIR/linux_bindings_aarch64.rs \ No newline at end of file diff --git a/aya/src/generated/bpf_bindings.rs b/aya/src/generated/bpf_bindings.rs deleted file mode 100644 index f790700e..00000000 --- a/aya/src/generated/bpf_bindings.rs +++ /dev/null @@ -1,553 +0,0 @@ -/* automatically generated by rust-bindgen 0.55.1 */ - -#[repr(C)] -#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit { - storage: Storage, - align: [Align; 0], -} -impl __BindgenBitfieldUnit { - #[inline] - pub const fn new(storage: Storage) -> Self { - Self { storage, align: [] } - } -} -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ - #[inline] - pub fn get_bit(&self, index: usize) -> bool { - debug_assert!(index / 8 < self.storage.as_ref().len()); - let byte_index = index / 8; - let byte = self.storage.as_ref()[byte_index]; - let bit_index = if cfg!(target_endian = "big") { - 7 - (index % 8) - } else { - index % 8 - }; - let mask = 1 << bit_index; - byte & mask == mask - } - #[inline] - pub fn set_bit(&mut self, index: usize, val: bool) { - debug_assert!(index / 8 < self.storage.as_ref().len()); - let byte_index = index / 8; - let byte = &mut self.storage.as_mut()[byte_index]; - let bit_index = if cfg!(target_endian = "big") { - 7 - (index % 8) - } else { - index % 8 - }; - let mask = 1 << bit_index; - if val { - *byte |= mask; - } else { - *byte &= !mask; - } - } - #[inline] - pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { - debug_assert!(bit_width <= 64); - debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); - let mut val = 0; - for i in 0..(bit_width as usize) { - if self.get_bit(i + bit_offset) { - let index = if cfg!(target_endian = "big") { - bit_width as usize - 1 - i - } else { - i - }; - val |= 1 << index; - } - } - val - } - #[inline] - pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { - debug_assert!(bit_width <= 64); - debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); - for i in 0..(bit_width as usize) { - let mask = 1 << i; - let val_bit_is_set = val & mask == mask; - let index = if cfg!(target_endian = "big") { - bit_width as usize - 1 - i - } else { - i - }; - self.set_bit(index + bit_offset, val_bit_is_set); - } - } -} -pub const BPF_LD: u32 = 0; -pub const BPF_LDX: u32 = 1; -pub const BPF_ST: u32 = 2; -pub const BPF_STX: u32 = 3; -pub const BPF_ALU: u32 = 4; -pub const BPF_W: u32 = 0; -pub const BPF_H: u32 = 8; -pub const BPF_B: u32 = 16; -pub const BPF_K: u32 = 0; -pub const BPF_ALU64: u32 = 7; -pub const BPF_DW: u32 = 24; -pub const BPF_PSEUDO_MAP_FD: u32 = 1; -pub const BPF_PSEUDO_MAP_VALUE: u32 = 2; -pub const BPF_PSEUDO_BTF_ID: u32 = 3; -pub const BPF_PSEUDO_CALL: u32 = 1; -pub type __u8 = ::std::os::raw::c_uchar; -pub type __s16 = ::std::os::raw::c_short; -pub type __s32 = ::std::os::raw::c_int; -pub type __u32 = ::std::os::raw::c_uint; -pub type __u64 = ::std::os::raw::c_ulonglong; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_insn { - pub code: __u8, - pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, - pub off: __s16, - pub imm: __s32, -} -impl bpf_insn { - #[inline] - pub fn dst_reg(&self) -> __u8 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) } - } - #[inline] - pub fn set_dst_reg(&mut self, val: __u8) { - unsafe { - let val: u8 = ::std::mem::transmute(val); - self._bitfield_1.set(0usize, 4u8, val as u64) - } - } - #[inline] - pub fn src_reg(&self) -> __u8 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) } - } - #[inline] - pub fn set_src_reg(&mut self, val: __u8) { - unsafe { - let val: u8 = ::std::mem::transmute(val); - self._bitfield_1.set(4usize, 4u8, val as u64) - } - } - #[inline] - pub fn new_bitfield_1(dst_reg: __u8, src_reg: __u8) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); - __bindgen_bitfield_unit.set(0usize, 4u8, { - let dst_reg: u8 = unsafe { ::std::mem::transmute(dst_reg) }; - dst_reg as u64 - }); - __bindgen_bitfield_unit.set(4usize, 4u8, { - let src_reg: u8 = unsafe { ::std::mem::transmute(src_reg) }; - src_reg as u64 - }); - __bindgen_bitfield_unit - } -} -pub mod bpf_cmd { - pub type Type = ::std::os::raw::c_uint; - pub const BPF_MAP_CREATE: Type = 0; - pub const BPF_MAP_LOOKUP_ELEM: Type = 1; - pub const BPF_MAP_UPDATE_ELEM: Type = 2; - pub const BPF_MAP_DELETE_ELEM: Type = 3; - pub const BPF_MAP_GET_NEXT_KEY: Type = 4; - pub const BPF_PROG_LOAD: Type = 5; - pub const BPF_OBJ_PIN: Type = 6; - pub const BPF_OBJ_GET: Type = 7; - pub const BPF_PROG_ATTACH: Type = 8; - pub const BPF_PROG_DETACH: Type = 9; - pub const BPF_PROG_TEST_RUN: Type = 10; - pub const BPF_PROG_GET_NEXT_ID: Type = 11; - pub const BPF_MAP_GET_NEXT_ID: Type = 12; - pub const BPF_PROG_GET_FD_BY_ID: Type = 13; - pub const BPF_MAP_GET_FD_BY_ID: Type = 14; - pub const BPF_OBJ_GET_INFO_BY_FD: Type = 15; - pub const BPF_PROG_QUERY: Type = 16; - pub const BPF_RAW_TRACEPOINT_OPEN: Type = 17; - pub const BPF_BTF_LOAD: Type = 18; - pub const BPF_BTF_GET_FD_BY_ID: Type = 19; - pub const BPF_TASK_FD_QUERY: Type = 20; - pub const BPF_MAP_LOOKUP_AND_DELETE_ELEM: Type = 21; - pub const BPF_MAP_FREEZE: Type = 22; - pub const BPF_BTF_GET_NEXT_ID: Type = 23; - pub const BPF_MAP_LOOKUP_BATCH: Type = 24; - pub const BPF_MAP_LOOKUP_AND_DELETE_BATCH: Type = 25; - pub const BPF_MAP_UPDATE_BATCH: Type = 26; - pub const BPF_MAP_DELETE_BATCH: Type = 27; - pub const BPF_LINK_CREATE: Type = 28; - pub const BPF_LINK_UPDATE: Type = 29; - pub const BPF_LINK_GET_FD_BY_ID: Type = 30; - pub const BPF_LINK_GET_NEXT_ID: Type = 31; - pub const BPF_ENABLE_STATS: Type = 32; - pub const BPF_ITER_CREATE: Type = 33; - pub const BPF_LINK_DETACH: Type = 34; - pub const BPF_PROG_BIND_MAP: Type = 35; -} -pub mod bpf_map_type { - pub type Type = ::std::os::raw::c_uint; - pub const BPF_MAP_TYPE_UNSPEC: Type = 0; - pub const BPF_MAP_TYPE_HASH: Type = 1; - pub const BPF_MAP_TYPE_ARRAY: Type = 2; - pub const BPF_MAP_TYPE_PROG_ARRAY: Type = 3; - pub const BPF_MAP_TYPE_PERF_EVENT_ARRAY: Type = 4; - pub const BPF_MAP_TYPE_PERCPU_HASH: Type = 5; - pub const BPF_MAP_TYPE_PERCPU_ARRAY: Type = 6; - pub const BPF_MAP_TYPE_STACK_TRACE: Type = 7; - pub const BPF_MAP_TYPE_CGROUP_ARRAY: Type = 8; - pub const BPF_MAP_TYPE_LRU_HASH: Type = 9; - pub const BPF_MAP_TYPE_LRU_PERCPU_HASH: Type = 10; - pub const BPF_MAP_TYPE_LPM_TRIE: Type = 11; - pub const BPF_MAP_TYPE_ARRAY_OF_MAPS: Type = 12; - pub const BPF_MAP_TYPE_HASH_OF_MAPS: Type = 13; - pub const BPF_MAP_TYPE_DEVMAP: Type = 14; - pub const BPF_MAP_TYPE_SOCKMAP: Type = 15; - pub const BPF_MAP_TYPE_CPUMAP: Type = 16; - pub const BPF_MAP_TYPE_XSKMAP: Type = 17; - pub const BPF_MAP_TYPE_SOCKHASH: Type = 18; - pub const BPF_MAP_TYPE_CGROUP_STORAGE: Type = 19; - pub const BPF_MAP_TYPE_REUSEPORT_SOCKARRAY: Type = 20; - pub const BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE: Type = 21; - pub const BPF_MAP_TYPE_QUEUE: Type = 22; - pub const BPF_MAP_TYPE_STACK: Type = 23; - pub const BPF_MAP_TYPE_SK_STORAGE: Type = 24; - pub const BPF_MAP_TYPE_DEVMAP_HASH: Type = 25; - pub const BPF_MAP_TYPE_STRUCT_OPS: Type = 26; - pub const BPF_MAP_TYPE_RINGBUF: Type = 27; - pub const BPF_MAP_TYPE_INODE_STORAGE: Type = 28; - pub const BPF_MAP_TYPE_TASK_STORAGE: Type = 29; -} -pub mod bpf_prog_type { - pub type Type = ::std::os::raw::c_uint; - pub const BPF_PROG_TYPE_UNSPEC: Type = 0; - pub const BPF_PROG_TYPE_SOCKET_FILTER: Type = 1; - pub const BPF_PROG_TYPE_KPROBE: Type = 2; - pub const BPF_PROG_TYPE_SCHED_CLS: Type = 3; - pub const BPF_PROG_TYPE_SCHED_ACT: Type = 4; - pub const BPF_PROG_TYPE_TRACEPOINT: Type = 5; - pub const BPF_PROG_TYPE_XDP: Type = 6; - pub const BPF_PROG_TYPE_PERF_EVENT: Type = 7; - pub const BPF_PROG_TYPE_CGROUP_SKB: Type = 8; - pub const BPF_PROG_TYPE_CGROUP_SOCK: Type = 9; - pub const BPF_PROG_TYPE_LWT_IN: Type = 10; - pub const BPF_PROG_TYPE_LWT_OUT: Type = 11; - pub const BPF_PROG_TYPE_LWT_XMIT: Type = 12; - pub const BPF_PROG_TYPE_SOCK_OPS: Type = 13; - pub const BPF_PROG_TYPE_SK_SKB: Type = 14; - pub const BPF_PROG_TYPE_CGROUP_DEVICE: Type = 15; - pub const BPF_PROG_TYPE_SK_MSG: Type = 16; - pub const BPF_PROG_TYPE_RAW_TRACEPOINT: Type = 17; - pub const BPF_PROG_TYPE_CGROUP_SOCK_ADDR: Type = 18; - pub const BPF_PROG_TYPE_LWT_SEG6LOCAL: Type = 19; - pub const BPF_PROG_TYPE_LIRC_MODE2: Type = 20; - pub const BPF_PROG_TYPE_SK_REUSEPORT: Type = 21; - pub const BPF_PROG_TYPE_FLOW_DISSECTOR: Type = 22; - pub const BPF_PROG_TYPE_CGROUP_SYSCTL: Type = 23; - pub const BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE: Type = 24; - pub const BPF_PROG_TYPE_CGROUP_SOCKOPT: Type = 25; - pub const BPF_PROG_TYPE_TRACING: Type = 26; - pub const BPF_PROG_TYPE_STRUCT_OPS: Type = 27; - pub const BPF_PROG_TYPE_EXT: Type = 28; - pub const BPF_PROG_TYPE_LSM: Type = 29; - pub const BPF_PROG_TYPE_SK_LOOKUP: Type = 30; -} -pub mod bpf_attach_type { - pub type Type = ::std::os::raw::c_uint; - pub const BPF_CGROUP_INET_INGRESS: Type = 0; - pub const BPF_CGROUP_INET_EGRESS: Type = 1; - pub const BPF_CGROUP_INET_SOCK_CREATE: Type = 2; - pub const BPF_CGROUP_SOCK_OPS: Type = 3; - pub const BPF_SK_SKB_STREAM_PARSER: Type = 4; - pub const BPF_SK_SKB_STREAM_VERDICT: Type = 5; - pub const BPF_CGROUP_DEVICE: Type = 6; - pub const BPF_SK_MSG_VERDICT: Type = 7; - pub const BPF_CGROUP_INET4_BIND: Type = 8; - pub const BPF_CGROUP_INET6_BIND: Type = 9; - pub const BPF_CGROUP_INET4_CONNECT: Type = 10; - pub const BPF_CGROUP_INET6_CONNECT: Type = 11; - pub const BPF_CGROUP_INET4_POST_BIND: Type = 12; - pub const BPF_CGROUP_INET6_POST_BIND: Type = 13; - pub const BPF_CGROUP_UDP4_SENDMSG: Type = 14; - pub const BPF_CGROUP_UDP6_SENDMSG: Type = 15; - pub const BPF_LIRC_MODE2: Type = 16; - pub const BPF_FLOW_DISSECTOR: Type = 17; - pub const BPF_CGROUP_SYSCTL: Type = 18; - pub const BPF_CGROUP_UDP4_RECVMSG: Type = 19; - pub const BPF_CGROUP_UDP6_RECVMSG: Type = 20; - pub const BPF_CGROUP_GETSOCKOPT: Type = 21; - pub const BPF_CGROUP_SETSOCKOPT: Type = 22; - pub const BPF_TRACE_RAW_TP: Type = 23; - pub const BPF_TRACE_FENTRY: Type = 24; - pub const BPF_TRACE_FEXIT: Type = 25; - pub const BPF_MODIFY_RETURN: Type = 26; - pub const BPF_LSM_MAC: Type = 27; - pub const BPF_TRACE_ITER: Type = 28; - pub const BPF_CGROUP_INET4_GETPEERNAME: Type = 29; - pub const BPF_CGROUP_INET6_GETPEERNAME: Type = 30; - pub const BPF_CGROUP_INET4_GETSOCKNAME: Type = 31; - pub const BPF_CGROUP_INET6_GETSOCKNAME: Type = 32; - pub const BPF_XDP_DEVMAP: Type = 33; - pub const BPF_CGROUP_INET_SOCK_RELEASE: Type = 34; - pub const BPF_XDP_CPUMAP: Type = 35; - pub const BPF_SK_LOOKUP: Type = 36; - pub const BPF_XDP: Type = 37; - pub const __MAX_BPF_ATTACH_TYPE: Type = 38; -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union bpf_attr { - pub __bindgen_anon_1: bpf_attr__bindgen_ty_1, - pub __bindgen_anon_2: bpf_attr__bindgen_ty_2, - pub batch: bpf_attr__bindgen_ty_3, - pub __bindgen_anon_3: bpf_attr__bindgen_ty_4, - pub __bindgen_anon_4: bpf_attr__bindgen_ty_5, - pub __bindgen_anon_5: bpf_attr__bindgen_ty_6, - pub test: bpf_attr__bindgen_ty_7, - pub __bindgen_anon_6: bpf_attr__bindgen_ty_8, - pub info: bpf_attr__bindgen_ty_9, - pub query: bpf_attr__bindgen_ty_10, - pub raw_tracepoint: bpf_attr__bindgen_ty_11, - pub __bindgen_anon_7: bpf_attr__bindgen_ty_12, - pub task_fd_query: bpf_attr__bindgen_ty_13, - pub link_create: bpf_attr__bindgen_ty_14, - pub link_update: bpf_attr__bindgen_ty_15, - pub link_detach: bpf_attr__bindgen_ty_16, - pub enable_stats: bpf_attr__bindgen_ty_17, - pub iter_create: bpf_attr__bindgen_ty_18, - pub prog_bind_map: bpf_attr__bindgen_ty_19, - _bindgen_union_align: [u64; 15usize], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_1 { - pub map_type: __u32, - pub key_size: __u32, - pub value_size: __u32, - pub max_entries: __u32, - pub map_flags: __u32, - pub inner_map_fd: __u32, - pub numa_node: __u32, - pub map_name: [::std::os::raw::c_char; 16usize], - pub map_ifindex: __u32, - pub btf_fd: __u32, - pub btf_key_type_id: __u32, - pub btf_value_type_id: __u32, - pub btf_vmlinux_value_type_id: __u32, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct bpf_attr__bindgen_ty_2 { - pub map_fd: __u32, - pub key: __u64, - pub __bindgen_anon_1: bpf_attr__bindgen_ty_2__bindgen_ty_1, - pub flags: __u64, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union bpf_attr__bindgen_ty_2__bindgen_ty_1 { - pub value: __u64, - pub next_key: __u64, - _bindgen_union_align: u64, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_3 { - pub in_batch: __u64, - pub out_batch: __u64, - pub keys: __u64, - pub values: __u64, - pub count: __u32, - pub map_fd: __u32, - pub elem_flags: __u64, - pub flags: __u64, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct bpf_attr__bindgen_ty_4 { - pub prog_type: __u32, - pub insn_cnt: __u32, - pub insns: __u64, - pub license: __u64, - pub log_level: __u32, - pub log_size: __u32, - pub log_buf: __u64, - pub kern_version: __u32, - pub prog_flags: __u32, - pub prog_name: [::std::os::raw::c_char; 16usize], - pub prog_ifindex: __u32, - pub expected_attach_type: __u32, - pub prog_btf_fd: __u32, - pub func_info_rec_size: __u32, - pub func_info: __u64, - pub func_info_cnt: __u32, - pub line_info_rec_size: __u32, - pub line_info: __u64, - pub line_info_cnt: __u32, - pub attach_btf_id: __u32, - pub __bindgen_anon_1: bpf_attr__bindgen_ty_4__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union bpf_attr__bindgen_ty_4__bindgen_ty_1 { - pub attach_prog_fd: __u32, - pub attach_btf_obj_fd: __u32, - _bindgen_union_align: u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_5 { - pub pathname: __u64, - pub bpf_fd: __u32, - pub file_flags: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_6 { - pub target_fd: __u32, - pub attach_bpf_fd: __u32, - pub attach_type: __u32, - pub attach_flags: __u32, - pub replace_bpf_fd: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_7 { - pub prog_fd: __u32, - pub retval: __u32, - pub data_size_in: __u32, - pub data_size_out: __u32, - pub data_in: __u64, - pub data_out: __u64, - pub repeat: __u32, - pub duration: __u32, - pub ctx_size_in: __u32, - pub ctx_size_out: __u32, - pub ctx_in: __u64, - pub ctx_out: __u64, - pub flags: __u32, - pub cpu: __u32, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct bpf_attr__bindgen_ty_8 { - pub __bindgen_anon_1: bpf_attr__bindgen_ty_8__bindgen_ty_1, - pub next_id: __u32, - pub open_flags: __u32, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union bpf_attr__bindgen_ty_8__bindgen_ty_1 { - pub start_id: __u32, - pub prog_id: __u32, - pub map_id: __u32, - pub btf_id: __u32, - pub link_id: __u32, - _bindgen_union_align: u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_9 { - pub bpf_fd: __u32, - pub info_len: __u32, - pub info: __u64, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_10 { - pub target_fd: __u32, - pub attach_type: __u32, - pub query_flags: __u32, - pub attach_flags: __u32, - pub prog_ids: __u64, - pub prog_cnt: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_11 { - pub name: __u64, - pub prog_fd: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_12 { - pub btf: __u64, - pub btf_log_buf: __u64, - pub btf_size: __u32, - pub btf_log_size: __u32, - pub btf_log_level: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_13 { - pub pid: __u32, - pub fd: __u32, - pub flags: __u32, - pub buf_len: __u32, - pub buf: __u64, - pub prog_id: __u32, - pub fd_type: __u32, - pub probe_offset: __u64, - pub probe_addr: __u64, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct bpf_attr__bindgen_ty_14 { - pub prog_fd: __u32, - pub __bindgen_anon_1: bpf_attr__bindgen_ty_14__bindgen_ty_1, - pub attach_type: __u32, - pub flags: __u32, - pub __bindgen_anon_2: bpf_attr__bindgen_ty_14__bindgen_ty_2, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union bpf_attr__bindgen_ty_14__bindgen_ty_1 { - pub target_fd: __u32, - pub target_ifindex: __u32, - _bindgen_union_align: u32, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union bpf_attr__bindgen_ty_14__bindgen_ty_2 { - pub target_btf_id: __u32, - pub __bindgen_anon_1: bpf_attr__bindgen_ty_14__bindgen_ty_2__bindgen_ty_1, - _bindgen_union_align: [u64; 2usize], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_14__bindgen_ty_2__bindgen_ty_1 { - pub iter_info: __u64, - pub iter_info_len: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_15 { - pub link_fd: __u32, - pub new_prog_fd: __u32, - pub flags: __u32, - pub old_prog_fd: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_16 { - pub link_fd: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_17 { - pub type_: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_18 { - pub link_fd: __u32, - pub flags: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct bpf_attr__bindgen_ty_19 { - pub prog_fd: __u32, - pub map_fd: __u32, - pub flags: __u32, -} diff --git a/aya/src/generated/btf_bindings.rs b/aya/src/generated/btf_bindings.rs deleted file mode 100644 index cf251db7..00000000 --- a/aya/src/generated/btf_bindings.rs +++ /dev/null @@ -1,90 +0,0 @@ -/* automatically generated by rust-bindgen 0.55.1 */ - -pub const BTF_KIND_UNKN: u32 = 0; -pub const BTF_KIND_INT: u32 = 1; -pub const BTF_KIND_PTR: u32 = 2; -pub const BTF_KIND_ARRAY: u32 = 3; -pub const BTF_KIND_STRUCT: u32 = 4; -pub const BTF_KIND_UNION: u32 = 5; -pub const BTF_KIND_ENUM: u32 = 6; -pub const BTF_KIND_FWD: u32 = 7; -pub const BTF_KIND_TYPEDEF: u32 = 8; -pub const BTF_KIND_VOLATILE: u32 = 9; -pub const BTF_KIND_CONST: u32 = 10; -pub const BTF_KIND_RESTRICT: u32 = 11; -pub const BTF_KIND_FUNC: u32 = 12; -pub const BTF_KIND_FUNC_PROTO: u32 = 13; -pub const BTF_KIND_VAR: u32 = 14; -pub const BTF_KIND_DATASEC: u32 = 15; -pub const BTF_KIND_MAX: u32 = 15; -pub const BTF_INT_SIGNED: u32 = 1; -pub const BTF_INT_CHAR: u32 = 2; -pub const BTF_INT_BOOL: u32 = 4; -pub type __u8 = ::std::os::raw::c_uchar; -pub type __u16 = ::std::os::raw::c_ushort; -pub type __s32 = ::std::os::raw::c_int; -pub type __u32 = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct btf_header { - pub magic: __u16, - pub version: __u8, - pub flags: __u8, - pub hdr_len: __u32, - pub type_off: __u32, - pub type_len: __u32, - pub str_off: __u32, - pub str_len: __u32, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct btf_type { - pub name_off: __u32, - pub info: __u32, - pub __bindgen_anon_1: btf_type__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union btf_type__bindgen_ty_1 { - pub size: __u32, - pub type_: __u32, - _bindgen_union_align: u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct btf_enum { - pub name_off: __u32, - pub val: __s32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct btf_array { - pub type_: __u32, - pub index_type: __u32, - pub nelems: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct btf_member { - pub name_off: __u32, - pub type_: __u32, - pub offset: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct btf_param { - pub name_off: __u32, - pub type_: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct btf_var { - pub linkage: __u32, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct btf_var_secinfo { - pub type_: __u32, - pub offset: __u32, - pub size: __u32, -} diff --git a/aya/src/generated/linux_bindings_aarch64.rs b/aya/src/generated/linux_bindings_aarch64.rs new file mode 100644 index 00000000..92421e69 --- /dev/null +++ b/aya/src/generated/linux_bindings_aarch64.rs @@ -0,0 +1,1499 @@ +/* automatically generated by rust-bindgen 0.55.1 */ + +#[repr(C)] +#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct __BindgenBitfieldUnit { + storage: Storage, + align: [Align; 0], +} +impl __BindgenBitfieldUnit { + #[inline] + pub const fn new(storage: Storage) -> Self { + Self { storage, align: [] } + } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + #[inline] + pub fn get_bit(&self, index: usize) -> bool { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = self.storage.as_ref()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + byte & mask == mask + } + #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + if val { + *byte |= mask; + } else { + *byte &= !mask; + } + } + #[inline] + pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if self.get_bit(i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + self.set_bit(index + bit_offset, val_bit_is_set); + } + } +} +pub const BPF_LD: u32 = 0; +pub const BPF_LDX: u32 = 1; +pub const BPF_ST: u32 = 2; +pub const BPF_STX: u32 = 3; +pub const BPF_ALU: u32 = 4; +pub const BPF_W: u32 = 0; +pub const BPF_H: u32 = 8; +pub const BPF_B: u32 = 16; +pub const BPF_K: u32 = 0; +pub const BPF_ALU64: u32 = 7; +pub const BPF_DW: u32 = 24; +pub const BPF_PSEUDO_MAP_FD: u32 = 1; +pub const BPF_PSEUDO_MAP_VALUE: u32 = 2; +pub const BPF_PSEUDO_BTF_ID: u32 = 3; +pub const BPF_PSEUDO_CALL: u32 = 1; +pub const BTF_KIND_UNKN: u32 = 0; +pub const BTF_KIND_INT: u32 = 1; +pub const BTF_KIND_PTR: u32 = 2; +pub const BTF_KIND_ARRAY: u32 = 3; +pub const BTF_KIND_STRUCT: u32 = 4; +pub const BTF_KIND_UNION: u32 = 5; +pub const BTF_KIND_ENUM: u32 = 6; +pub const BTF_KIND_FWD: u32 = 7; +pub const BTF_KIND_TYPEDEF: u32 = 8; +pub const BTF_KIND_VOLATILE: u32 = 9; +pub const BTF_KIND_CONST: u32 = 10; +pub const BTF_KIND_RESTRICT: u32 = 11; +pub const BTF_KIND_FUNC: u32 = 12; +pub const BTF_KIND_FUNC_PROTO: u32 = 13; +pub const BTF_KIND_VAR: u32 = 14; +pub const BTF_KIND_DATASEC: u32 = 15; +pub const BTF_KIND_MAX: u32 = 15; +pub const BTF_INT_SIGNED: u32 = 1; +pub const BTF_INT_CHAR: u32 = 2; +pub const BTF_INT_BOOL: u32 = 4; +pub const PERF_FLAG_FD_NO_GROUP: u32 = 1; +pub const PERF_FLAG_FD_OUTPUT: u32 = 2; +pub const PERF_FLAG_PID_CGROUP: u32 = 4; +pub const PERF_FLAG_FD_CLOEXEC: u32 = 8; +pub const NLMSG_ALIGNTO: u32 = 4; +pub const XDP_FLAGS_UPDATE_IF_NOEXIST: u32 = 1; +pub const XDP_FLAGS_SKB_MODE: u32 = 2; +pub const XDP_FLAGS_DRV_MODE: u32 = 4; +pub const XDP_FLAGS_HW_MODE: u32 = 8; +pub const XDP_FLAGS_REPLACE: u32 = 16; +pub const XDP_FLAGS_MODES: u32 = 14; +pub const XDP_FLAGS_MASK: u32 = 31; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_insn { + pub code: __u8, + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, + pub off: __s16, + pub imm: __s32, +} +impl bpf_insn { + #[inline] + pub fn dst_reg(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) } + } + #[inline] + pub fn set_dst_reg(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 4u8, val as u64) + } + } + #[inline] + pub fn src_reg(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) } + } + #[inline] + pub fn set_src_reg(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 4u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1(dst_reg: __u8, src_reg: __u8) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 4u8, { + let dst_reg: u8 = unsafe { ::std::mem::transmute(dst_reg) }; + dst_reg as u64 + }); + __bindgen_bitfield_unit.set(4usize, 4u8, { + let src_reg: u8 = unsafe { ::std::mem::transmute(src_reg) }; + src_reg as u64 + }); + __bindgen_bitfield_unit + } +} +pub mod bpf_cmd { + pub type Type = ::std::os::raw::c_uint; + pub const BPF_MAP_CREATE: Type = 0; + pub const BPF_MAP_LOOKUP_ELEM: Type = 1; + pub const BPF_MAP_UPDATE_ELEM: Type = 2; + pub const BPF_MAP_DELETE_ELEM: Type = 3; + pub const BPF_MAP_GET_NEXT_KEY: Type = 4; + pub const BPF_PROG_LOAD: Type = 5; + pub const BPF_OBJ_PIN: Type = 6; + pub const BPF_OBJ_GET: Type = 7; + pub const BPF_PROG_ATTACH: Type = 8; + pub const BPF_PROG_DETACH: Type = 9; + pub const BPF_PROG_TEST_RUN: Type = 10; + pub const BPF_PROG_GET_NEXT_ID: Type = 11; + pub const BPF_MAP_GET_NEXT_ID: Type = 12; + pub const BPF_PROG_GET_FD_BY_ID: Type = 13; + pub const BPF_MAP_GET_FD_BY_ID: Type = 14; + pub const BPF_OBJ_GET_INFO_BY_FD: Type = 15; + pub const BPF_PROG_QUERY: Type = 16; + pub const BPF_RAW_TRACEPOINT_OPEN: Type = 17; + pub const BPF_BTF_LOAD: Type = 18; + pub const BPF_BTF_GET_FD_BY_ID: Type = 19; + pub const BPF_TASK_FD_QUERY: Type = 20; + pub const BPF_MAP_LOOKUP_AND_DELETE_ELEM: Type = 21; + pub const BPF_MAP_FREEZE: Type = 22; + pub const BPF_BTF_GET_NEXT_ID: Type = 23; + pub const BPF_MAP_LOOKUP_BATCH: Type = 24; + pub const BPF_MAP_LOOKUP_AND_DELETE_BATCH: Type = 25; + pub const BPF_MAP_UPDATE_BATCH: Type = 26; + pub const BPF_MAP_DELETE_BATCH: Type = 27; + pub const BPF_LINK_CREATE: Type = 28; + pub const BPF_LINK_UPDATE: Type = 29; + pub const BPF_LINK_GET_FD_BY_ID: Type = 30; + pub const BPF_LINK_GET_NEXT_ID: Type = 31; + pub const BPF_ENABLE_STATS: Type = 32; + pub const BPF_ITER_CREATE: Type = 33; + pub const BPF_LINK_DETACH: Type = 34; + pub const BPF_PROG_BIND_MAP: Type = 35; +} +pub mod bpf_map_type { + pub type Type = ::std::os::raw::c_uint; + pub const BPF_MAP_TYPE_UNSPEC: Type = 0; + pub const BPF_MAP_TYPE_HASH: Type = 1; + pub const BPF_MAP_TYPE_ARRAY: Type = 2; + pub const BPF_MAP_TYPE_PROG_ARRAY: Type = 3; + pub const BPF_MAP_TYPE_PERF_EVENT_ARRAY: Type = 4; + pub const BPF_MAP_TYPE_PERCPU_HASH: Type = 5; + pub const BPF_MAP_TYPE_PERCPU_ARRAY: Type = 6; + pub const BPF_MAP_TYPE_STACK_TRACE: Type = 7; + pub const BPF_MAP_TYPE_CGROUP_ARRAY: Type = 8; + pub const BPF_MAP_TYPE_LRU_HASH: Type = 9; + pub const BPF_MAP_TYPE_LRU_PERCPU_HASH: Type = 10; + pub const BPF_MAP_TYPE_LPM_TRIE: Type = 11; + pub const BPF_MAP_TYPE_ARRAY_OF_MAPS: Type = 12; + pub const BPF_MAP_TYPE_HASH_OF_MAPS: Type = 13; + pub const BPF_MAP_TYPE_DEVMAP: Type = 14; + pub const BPF_MAP_TYPE_SOCKMAP: Type = 15; + pub const BPF_MAP_TYPE_CPUMAP: Type = 16; + pub const BPF_MAP_TYPE_XSKMAP: Type = 17; + pub const BPF_MAP_TYPE_SOCKHASH: Type = 18; + pub const BPF_MAP_TYPE_CGROUP_STORAGE: Type = 19; + pub const BPF_MAP_TYPE_REUSEPORT_SOCKARRAY: Type = 20; + pub const BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE: Type = 21; + pub const BPF_MAP_TYPE_QUEUE: Type = 22; + pub const BPF_MAP_TYPE_STACK: Type = 23; + pub const BPF_MAP_TYPE_SK_STORAGE: Type = 24; + pub const BPF_MAP_TYPE_DEVMAP_HASH: Type = 25; + pub const BPF_MAP_TYPE_STRUCT_OPS: Type = 26; + pub const BPF_MAP_TYPE_RINGBUF: Type = 27; + pub const BPF_MAP_TYPE_INODE_STORAGE: Type = 28; + pub const BPF_MAP_TYPE_TASK_STORAGE: Type = 29; +} +pub mod bpf_prog_type { + pub type Type = ::std::os::raw::c_uint; + pub const BPF_PROG_TYPE_UNSPEC: Type = 0; + pub const BPF_PROG_TYPE_SOCKET_FILTER: Type = 1; + pub const BPF_PROG_TYPE_KPROBE: Type = 2; + pub const BPF_PROG_TYPE_SCHED_CLS: Type = 3; + pub const BPF_PROG_TYPE_SCHED_ACT: Type = 4; + pub const BPF_PROG_TYPE_TRACEPOINT: Type = 5; + pub const BPF_PROG_TYPE_XDP: Type = 6; + pub const BPF_PROG_TYPE_PERF_EVENT: Type = 7; + pub const BPF_PROG_TYPE_CGROUP_SKB: Type = 8; + pub const BPF_PROG_TYPE_CGROUP_SOCK: Type = 9; + pub const BPF_PROG_TYPE_LWT_IN: Type = 10; + pub const BPF_PROG_TYPE_LWT_OUT: Type = 11; + pub const BPF_PROG_TYPE_LWT_XMIT: Type = 12; + pub const BPF_PROG_TYPE_SOCK_OPS: Type = 13; + pub const BPF_PROG_TYPE_SK_SKB: Type = 14; + pub const BPF_PROG_TYPE_CGROUP_DEVICE: Type = 15; + pub const BPF_PROG_TYPE_SK_MSG: Type = 16; + pub const BPF_PROG_TYPE_RAW_TRACEPOINT: Type = 17; + pub const BPF_PROG_TYPE_CGROUP_SOCK_ADDR: Type = 18; + pub const BPF_PROG_TYPE_LWT_SEG6LOCAL: Type = 19; + pub const BPF_PROG_TYPE_LIRC_MODE2: Type = 20; + pub const BPF_PROG_TYPE_SK_REUSEPORT: Type = 21; + pub const BPF_PROG_TYPE_FLOW_DISSECTOR: Type = 22; + pub const BPF_PROG_TYPE_CGROUP_SYSCTL: Type = 23; + pub const BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE: Type = 24; + pub const BPF_PROG_TYPE_CGROUP_SOCKOPT: Type = 25; + pub const BPF_PROG_TYPE_TRACING: Type = 26; + pub const BPF_PROG_TYPE_STRUCT_OPS: Type = 27; + pub const BPF_PROG_TYPE_EXT: Type = 28; + pub const BPF_PROG_TYPE_LSM: Type = 29; + pub const BPF_PROG_TYPE_SK_LOOKUP: Type = 30; +} +pub mod bpf_attach_type { + pub type Type = ::std::os::raw::c_uint; + pub const BPF_CGROUP_INET_INGRESS: Type = 0; + pub const BPF_CGROUP_INET_EGRESS: Type = 1; + pub const BPF_CGROUP_INET_SOCK_CREATE: Type = 2; + pub const BPF_CGROUP_SOCK_OPS: Type = 3; + pub const BPF_SK_SKB_STREAM_PARSER: Type = 4; + pub const BPF_SK_SKB_STREAM_VERDICT: Type = 5; + pub const BPF_CGROUP_DEVICE: Type = 6; + pub const BPF_SK_MSG_VERDICT: Type = 7; + pub const BPF_CGROUP_INET4_BIND: Type = 8; + pub const BPF_CGROUP_INET6_BIND: Type = 9; + pub const BPF_CGROUP_INET4_CONNECT: Type = 10; + pub const BPF_CGROUP_INET6_CONNECT: Type = 11; + pub const BPF_CGROUP_INET4_POST_BIND: Type = 12; + pub const BPF_CGROUP_INET6_POST_BIND: Type = 13; + pub const BPF_CGROUP_UDP4_SENDMSG: Type = 14; + pub const BPF_CGROUP_UDP6_SENDMSG: Type = 15; + pub const BPF_LIRC_MODE2: Type = 16; + pub const BPF_FLOW_DISSECTOR: Type = 17; + pub const BPF_CGROUP_SYSCTL: Type = 18; + pub const BPF_CGROUP_UDP4_RECVMSG: Type = 19; + pub const BPF_CGROUP_UDP6_RECVMSG: Type = 20; + pub const BPF_CGROUP_GETSOCKOPT: Type = 21; + pub const BPF_CGROUP_SETSOCKOPT: Type = 22; + pub const BPF_TRACE_RAW_TP: Type = 23; + pub const BPF_TRACE_FENTRY: Type = 24; + pub const BPF_TRACE_FEXIT: Type = 25; + pub const BPF_MODIFY_RETURN: Type = 26; + pub const BPF_LSM_MAC: Type = 27; + pub const BPF_TRACE_ITER: Type = 28; + pub const BPF_CGROUP_INET4_GETPEERNAME: Type = 29; + pub const BPF_CGROUP_INET6_GETPEERNAME: Type = 30; + pub const BPF_CGROUP_INET4_GETSOCKNAME: Type = 31; + pub const BPF_CGROUP_INET6_GETSOCKNAME: Type = 32; + pub const BPF_XDP_DEVMAP: Type = 33; + pub const BPF_CGROUP_INET_SOCK_RELEASE: Type = 34; + pub const BPF_XDP_CPUMAP: Type = 35; + pub const BPF_SK_LOOKUP: Type = 36; + pub const BPF_XDP: Type = 37; + pub const __MAX_BPF_ATTACH_TYPE: Type = 38; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr { + pub __bindgen_anon_1: bpf_attr__bindgen_ty_1, + pub __bindgen_anon_2: bpf_attr__bindgen_ty_2, + pub batch: bpf_attr__bindgen_ty_3, + pub __bindgen_anon_3: bpf_attr__bindgen_ty_4, + pub __bindgen_anon_4: bpf_attr__bindgen_ty_5, + pub __bindgen_anon_5: bpf_attr__bindgen_ty_6, + pub test: bpf_attr__bindgen_ty_7, + pub __bindgen_anon_6: bpf_attr__bindgen_ty_8, + pub info: bpf_attr__bindgen_ty_9, + pub query: bpf_attr__bindgen_ty_10, + pub raw_tracepoint: bpf_attr__bindgen_ty_11, + pub __bindgen_anon_7: bpf_attr__bindgen_ty_12, + pub task_fd_query: bpf_attr__bindgen_ty_13, + pub link_create: bpf_attr__bindgen_ty_14, + pub link_update: bpf_attr__bindgen_ty_15, + pub link_detach: bpf_attr__bindgen_ty_16, + pub enable_stats: bpf_attr__bindgen_ty_17, + pub iter_create: bpf_attr__bindgen_ty_18, + pub prog_bind_map: bpf_attr__bindgen_ty_19, + _bindgen_union_align: [u64; 15usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_1 { + pub map_type: __u32, + pub key_size: __u32, + pub value_size: __u32, + pub max_entries: __u32, + pub map_flags: __u32, + pub inner_map_fd: __u32, + pub numa_node: __u32, + pub map_name: [::std::os::raw::c_char; 16usize], + pub map_ifindex: __u32, + pub btf_fd: __u32, + pub btf_key_type_id: __u32, + pub btf_value_type_id: __u32, + pub btf_vmlinux_value_type_id: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct bpf_attr__bindgen_ty_2 { + pub map_fd: __u32, + pub key: __u64, + pub __bindgen_anon_1: bpf_attr__bindgen_ty_2__bindgen_ty_1, + pub flags: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_2__bindgen_ty_1 { + pub value: __u64, + pub next_key: __u64, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_3 { + pub in_batch: __u64, + pub out_batch: __u64, + pub keys: __u64, + pub values: __u64, + pub count: __u32, + pub map_fd: __u32, + pub elem_flags: __u64, + pub flags: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct bpf_attr__bindgen_ty_4 { + pub prog_type: __u32, + pub insn_cnt: __u32, + pub insns: __u64, + pub license: __u64, + pub log_level: __u32, + pub log_size: __u32, + pub log_buf: __u64, + pub kern_version: __u32, + pub prog_flags: __u32, + pub prog_name: [::std::os::raw::c_char; 16usize], + pub prog_ifindex: __u32, + pub expected_attach_type: __u32, + pub prog_btf_fd: __u32, + pub func_info_rec_size: __u32, + pub func_info: __u64, + pub func_info_cnt: __u32, + pub line_info_rec_size: __u32, + pub line_info: __u64, + pub line_info_cnt: __u32, + pub attach_btf_id: __u32, + pub __bindgen_anon_1: bpf_attr__bindgen_ty_4__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_4__bindgen_ty_1 { + pub attach_prog_fd: __u32, + pub attach_btf_obj_fd: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_5 { + pub pathname: __u64, + pub bpf_fd: __u32, + pub file_flags: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_6 { + pub target_fd: __u32, + pub attach_bpf_fd: __u32, + pub attach_type: __u32, + pub attach_flags: __u32, + pub replace_bpf_fd: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_7 { + pub prog_fd: __u32, + pub retval: __u32, + pub data_size_in: __u32, + pub data_size_out: __u32, + pub data_in: __u64, + pub data_out: __u64, + pub repeat: __u32, + pub duration: __u32, + pub ctx_size_in: __u32, + pub ctx_size_out: __u32, + pub ctx_in: __u64, + pub ctx_out: __u64, + pub flags: __u32, + pub cpu: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct bpf_attr__bindgen_ty_8 { + pub __bindgen_anon_1: bpf_attr__bindgen_ty_8__bindgen_ty_1, + pub next_id: __u32, + pub open_flags: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_8__bindgen_ty_1 { + pub start_id: __u32, + pub prog_id: __u32, + pub map_id: __u32, + pub btf_id: __u32, + pub link_id: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_9 { + pub bpf_fd: __u32, + pub info_len: __u32, + pub info: __u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_10 { + pub target_fd: __u32, + pub attach_type: __u32, + pub query_flags: __u32, + pub attach_flags: __u32, + pub prog_ids: __u64, + pub prog_cnt: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_11 { + pub name: __u64, + pub prog_fd: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_12 { + pub btf: __u64, + pub btf_log_buf: __u64, + pub btf_size: __u32, + pub btf_log_size: __u32, + pub btf_log_level: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_13 { + pub pid: __u32, + pub fd: __u32, + pub flags: __u32, + pub buf_len: __u32, + pub buf: __u64, + pub prog_id: __u32, + pub fd_type: __u32, + pub probe_offset: __u64, + pub probe_addr: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct bpf_attr__bindgen_ty_14 { + pub prog_fd: __u32, + pub __bindgen_anon_1: bpf_attr__bindgen_ty_14__bindgen_ty_1, + pub attach_type: __u32, + pub flags: __u32, + pub __bindgen_anon_2: bpf_attr__bindgen_ty_14__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_14__bindgen_ty_1 { + pub target_fd: __u32, + pub target_ifindex: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_14__bindgen_ty_2 { + pub target_btf_id: __u32, + pub __bindgen_anon_1: bpf_attr__bindgen_ty_14__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: [u64; 2usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_14__bindgen_ty_2__bindgen_ty_1 { + pub iter_info: __u64, + pub iter_info_len: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_15 { + pub link_fd: __u32, + pub new_prog_fd: __u32, + pub flags: __u32, + pub old_prog_fd: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_16 { + pub link_fd: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_17 { + pub type_: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_18 { + pub link_fd: __u32, + pub flags: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_19 { + pub prog_fd: __u32, + pub map_fd: __u32, + pub flags: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_header { + pub magic: __u16, + pub version: __u8, + pub flags: __u8, + pub hdr_len: __u32, + pub type_off: __u32, + pub type_len: __u32, + pub str_off: __u32, + pub str_len: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct btf_type { + pub name_off: __u32, + pub info: __u32, + pub __bindgen_anon_1: btf_type__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union btf_type__bindgen_ty_1 { + pub size: __u32, + pub type_: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_enum { + pub name_off: __u32, + pub val: __s32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_array { + pub type_: __u32, + pub index_type: __u32, + pub nelems: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_member { + pub name_off: __u32, + pub type_: __u32, + pub offset: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_param { + pub name_off: __u32, + pub type_: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_var { + pub linkage: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_var_secinfo { + pub type_: __u32, + pub offset: __u32, + pub size: __u32, +} +pub mod perf_type_id { + pub type Type = ::std::os::raw::c_uint; + pub const PERF_TYPE_HARDWARE: Type = 0; + pub const PERF_TYPE_SOFTWARE: Type = 1; + pub const PERF_TYPE_TRACEPOINT: Type = 2; + pub const PERF_TYPE_HW_CACHE: Type = 3; + pub const PERF_TYPE_RAW: Type = 4; + pub const PERF_TYPE_BREAKPOINT: Type = 5; + pub const PERF_TYPE_MAX: Type = 6; +} +pub mod perf_sw_ids { + pub type Type = ::std::os::raw::c_uint; + pub const PERF_COUNT_SW_CPU_CLOCK: Type = 0; + pub const PERF_COUNT_SW_TASK_CLOCK: Type = 1; + pub const PERF_COUNT_SW_PAGE_FAULTS: Type = 2; + pub const PERF_COUNT_SW_CONTEXT_SWITCHES: Type = 3; + pub const PERF_COUNT_SW_CPU_MIGRATIONS: Type = 4; + pub const PERF_COUNT_SW_PAGE_FAULTS_MIN: Type = 5; + pub const PERF_COUNT_SW_PAGE_FAULTS_MAJ: Type = 6; + pub const PERF_COUNT_SW_ALIGNMENT_FAULTS: Type = 7; + pub const PERF_COUNT_SW_EMULATION_FAULTS: Type = 8; + pub const PERF_COUNT_SW_DUMMY: Type = 9; + pub const PERF_COUNT_SW_BPF_OUTPUT: Type = 10; + pub const PERF_COUNT_SW_MAX: Type = 11; +} +pub mod perf_event_sample_format { + pub type Type = ::std::os::raw::c_ulong; + pub const PERF_SAMPLE_IP: Type = 1; + pub const PERF_SAMPLE_TID: Type = 2; + pub const PERF_SAMPLE_TIME: Type = 4; + pub const PERF_SAMPLE_ADDR: Type = 8; + pub const PERF_SAMPLE_READ: Type = 16; + pub const PERF_SAMPLE_CALLCHAIN: Type = 32; + pub const PERF_SAMPLE_ID: Type = 64; + pub const PERF_SAMPLE_CPU: Type = 128; + pub const PERF_SAMPLE_PERIOD: Type = 256; + pub const PERF_SAMPLE_STREAM_ID: Type = 512; + pub const PERF_SAMPLE_RAW: Type = 1024; + pub const PERF_SAMPLE_BRANCH_STACK: Type = 2048; + pub const PERF_SAMPLE_REGS_USER: Type = 4096; + pub const PERF_SAMPLE_STACK_USER: Type = 8192; + pub const PERF_SAMPLE_WEIGHT: Type = 16384; + pub const PERF_SAMPLE_DATA_SRC: Type = 32768; + pub const PERF_SAMPLE_IDENTIFIER: Type = 65536; + pub const PERF_SAMPLE_TRANSACTION: Type = 131072; + pub const PERF_SAMPLE_REGS_INTR: Type = 262144; + pub const PERF_SAMPLE_PHYS_ADDR: Type = 524288; + pub const PERF_SAMPLE_AUX: Type = 1048576; + pub const PERF_SAMPLE_CGROUP: Type = 2097152; + pub const PERF_SAMPLE_MAX: Type = 4194304; + pub const __PERF_SAMPLE_CALLCHAIN_EARLY: Type = 9223372036854775808; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct perf_event_attr { + pub type_: __u32, + pub size: __u32, + pub config: __u64, + pub __bindgen_anon_1: perf_event_attr__bindgen_ty_1, + pub sample_type: __u64, + pub read_format: __u64, + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize], u32>, + pub __bindgen_anon_2: perf_event_attr__bindgen_ty_2, + pub bp_type: __u32, + pub __bindgen_anon_3: perf_event_attr__bindgen_ty_3, + pub __bindgen_anon_4: perf_event_attr__bindgen_ty_4, + pub branch_sample_type: __u64, + pub sample_regs_user: __u64, + pub sample_stack_user: __u32, + pub clockid: __s32, + pub sample_regs_intr: __u64, + pub aux_watermark: __u32, + pub sample_max_stack: __u16, + pub __reserved_2: __u16, + pub aux_sample_size: __u32, + pub __reserved_3: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union perf_event_attr__bindgen_ty_1 { + pub sample_period: __u64, + pub sample_freq: __u64, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union perf_event_attr__bindgen_ty_2 { + pub wakeup_events: __u32, + pub wakeup_watermark: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union perf_event_attr__bindgen_ty_3 { + pub bp_addr: __u64, + pub kprobe_func: __u64, + pub uprobe_path: __u64, + pub config1: __u64, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union perf_event_attr__bindgen_ty_4 { + pub bp_len: __u64, + pub kprobe_addr: __u64, + pub probe_offset: __u64, + pub config2: __u64, + _bindgen_union_align: u64, +} +impl perf_event_attr { + #[inline] + pub fn disabled(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u64) } + } + #[inline] + pub fn set_disabled(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn inherit(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u64) } + } + #[inline] + pub fn set_inherit(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn pinned(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u64) } + } + #[inline] + pub fn set_pinned(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclusive(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclusive(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclude_user(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclude_user(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclude_kernel(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclude_kernel(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclude_hv(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclude_hv(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclude_idle(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclude_idle(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn mmap(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u64) } + } + #[inline] + pub fn set_mmap(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn comm(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u64) } + } + #[inline] + pub fn set_comm(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 1u8, val as u64) + } + } + #[inline] + pub fn freq(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u64) } + } + #[inline] + pub fn set_freq(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn inherit_stat(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u64) } + } + #[inline] + pub fn set_inherit_stat(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 1u8, val as u64) + } + } + #[inline] + pub fn enable_on_exec(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u64) } + } + #[inline] + pub fn set_enable_on_exec(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 1u8, val as u64) + } + } + #[inline] + pub fn task(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u64) } + } + #[inline] + pub fn set_task(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(13usize, 1u8, val as u64) + } + } + #[inline] + pub fn watermark(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u64) } + } + #[inline] + pub fn set_watermark(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 1u8, val as u64) + } + } + #[inline] + pub fn precise_ip(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 2u8) as u64) } + } + #[inline] + pub fn set_precise_ip(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(15usize, 2u8, val as u64) + } + } + #[inline] + pub fn mmap_data(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u64) } + } + #[inline] + pub fn set_mmap_data(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(17usize, 1u8, val as u64) + } + } + #[inline] + pub fn sample_id_all(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u64) } + } + #[inline] + pub fn set_sample_id_all(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(18usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclude_host(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclude_host(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(19usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclude_guest(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclude_guest(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(20usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclude_callchain_kernel(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclude_callchain_kernel(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(21usize, 1u8, val as u64) + } + } + #[inline] + pub fn exclude_callchain_user(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u64) } + } + #[inline] + pub fn set_exclude_callchain_user(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(22usize, 1u8, val as u64) + } + } + #[inline] + pub fn mmap2(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u64) } + } + #[inline] + pub fn set_mmap2(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(23usize, 1u8, val as u64) + } + } + #[inline] + pub fn comm_exec(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 1u8) as u64) } + } + #[inline] + pub fn set_comm_exec(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(24usize, 1u8, val as u64) + } + } + #[inline] + pub fn use_clockid(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(25usize, 1u8) as u64) } + } + #[inline] + pub fn set_use_clockid(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(25usize, 1u8, val as u64) + } + } + #[inline] + pub fn context_switch(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u64) } + } + #[inline] + pub fn set_context_switch(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(26usize, 1u8, val as u64) + } + } + #[inline] + pub fn write_backward(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(27usize, 1u8) as u64) } + } + #[inline] + pub fn set_write_backward(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(27usize, 1u8, val as u64) + } + } + #[inline] + pub fn namespaces(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(28usize, 1u8) as u64) } + } + #[inline] + pub fn set_namespaces(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(28usize, 1u8, val as u64) + } + } + #[inline] + pub fn ksymbol(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(29usize, 1u8) as u64) } + } + #[inline] + pub fn set_ksymbol(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(29usize, 1u8, val as u64) + } + } + #[inline] + pub fn bpf_event(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(30usize, 1u8) as u64) } + } + #[inline] + pub fn set_bpf_event(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(30usize, 1u8, val as u64) + } + } + #[inline] + pub fn aux_output(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u64) } + } + #[inline] + pub fn set_aux_output(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(31usize, 1u8, val as u64) + } + } + #[inline] + pub fn cgroup(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 1u8) as u64) } + } + #[inline] + pub fn set_cgroup(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(32usize, 1u8, val as u64) + } + } + #[inline] + pub fn __reserved_1(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(33usize, 31u8) as u64) } + } + #[inline] + pub fn set___reserved_1(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(33usize, 31u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + disabled: __u64, + inherit: __u64, + pinned: __u64, + exclusive: __u64, + exclude_user: __u64, + exclude_kernel: __u64, + exclude_hv: __u64, + exclude_idle: __u64, + mmap: __u64, + comm: __u64, + freq: __u64, + inherit_stat: __u64, + enable_on_exec: __u64, + task: __u64, + watermark: __u64, + precise_ip: __u64, + mmap_data: __u64, + sample_id_all: __u64, + exclude_host: __u64, + exclude_guest: __u64, + exclude_callchain_kernel: __u64, + exclude_callchain_user: __u64, + mmap2: __u64, + comm_exec: __u64, + use_clockid: __u64, + context_switch: __u64, + write_backward: __u64, + namespaces: __u64, + ksymbol: __u64, + bpf_event: __u64, + aux_output: __u64, + cgroup: __u64, + __reserved_1: __u64, + ) -> __BindgenBitfieldUnit<[u8; 8usize], u32> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u32> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let disabled: u64 = unsafe { ::std::mem::transmute(disabled) }; + disabled as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let inherit: u64 = unsafe { ::std::mem::transmute(inherit) }; + inherit as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let pinned: u64 = unsafe { ::std::mem::transmute(pinned) }; + pinned as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let exclusive: u64 = unsafe { ::std::mem::transmute(exclusive) }; + exclusive as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let exclude_user: u64 = unsafe { ::std::mem::transmute(exclude_user) }; + exclude_user as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let exclude_kernel: u64 = unsafe { ::std::mem::transmute(exclude_kernel) }; + exclude_kernel as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let exclude_hv: u64 = unsafe { ::std::mem::transmute(exclude_hv) }; + exclude_hv as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let exclude_idle: u64 = unsafe { ::std::mem::transmute(exclude_idle) }; + exclude_idle as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let mmap: u64 = unsafe { ::std::mem::transmute(mmap) }; + mmap as u64 + }); + __bindgen_bitfield_unit.set(9usize, 1u8, { + let comm: u64 = unsafe { ::std::mem::transmute(comm) }; + comm as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let freq: u64 = unsafe { ::std::mem::transmute(freq) }; + freq as u64 + }); + __bindgen_bitfield_unit.set(11usize, 1u8, { + let inherit_stat: u64 = unsafe { ::std::mem::transmute(inherit_stat) }; + inherit_stat as u64 + }); + __bindgen_bitfield_unit.set(12usize, 1u8, { + let enable_on_exec: u64 = unsafe { ::std::mem::transmute(enable_on_exec) }; + enable_on_exec as u64 + }); + __bindgen_bitfield_unit.set(13usize, 1u8, { + let task: u64 = unsafe { ::std::mem::transmute(task) }; + task as u64 + }); + __bindgen_bitfield_unit.set(14usize, 1u8, { + let watermark: u64 = unsafe { ::std::mem::transmute(watermark) }; + watermark as u64 + }); + __bindgen_bitfield_unit.set(15usize, 2u8, { + let precise_ip: u64 = unsafe { ::std::mem::transmute(precise_ip) }; + precise_ip as u64 + }); + __bindgen_bitfield_unit.set(17usize, 1u8, { + let mmap_data: u64 = unsafe { ::std::mem::transmute(mmap_data) }; + mmap_data as u64 + }); + __bindgen_bitfield_unit.set(18usize, 1u8, { + let sample_id_all: u64 = unsafe { ::std::mem::transmute(sample_id_all) }; + sample_id_all as u64 + }); + __bindgen_bitfield_unit.set(19usize, 1u8, { + let exclude_host: u64 = unsafe { ::std::mem::transmute(exclude_host) }; + exclude_host as u64 + }); + __bindgen_bitfield_unit.set(20usize, 1u8, { + let exclude_guest: u64 = unsafe { ::std::mem::transmute(exclude_guest) }; + exclude_guest as u64 + }); + __bindgen_bitfield_unit.set(21usize, 1u8, { + let exclude_callchain_kernel: u64 = + unsafe { ::std::mem::transmute(exclude_callchain_kernel) }; + exclude_callchain_kernel as u64 + }); + __bindgen_bitfield_unit.set(22usize, 1u8, { + let exclude_callchain_user: u64 = + unsafe { ::std::mem::transmute(exclude_callchain_user) }; + exclude_callchain_user as u64 + }); + __bindgen_bitfield_unit.set(23usize, 1u8, { + let mmap2: u64 = unsafe { ::std::mem::transmute(mmap2) }; + mmap2 as u64 + }); + __bindgen_bitfield_unit.set(24usize, 1u8, { + let comm_exec: u64 = unsafe { ::std::mem::transmute(comm_exec) }; + comm_exec as u64 + }); + __bindgen_bitfield_unit.set(25usize, 1u8, { + let use_clockid: u64 = unsafe { ::std::mem::transmute(use_clockid) }; + use_clockid as u64 + }); + __bindgen_bitfield_unit.set(26usize, 1u8, { + let context_switch: u64 = unsafe { ::std::mem::transmute(context_switch) }; + context_switch as u64 + }); + __bindgen_bitfield_unit.set(27usize, 1u8, { + let write_backward: u64 = unsafe { ::std::mem::transmute(write_backward) }; + write_backward as u64 + }); + __bindgen_bitfield_unit.set(28usize, 1u8, { + let namespaces: u64 = unsafe { ::std::mem::transmute(namespaces) }; + namespaces as u64 + }); + __bindgen_bitfield_unit.set(29usize, 1u8, { + let ksymbol: u64 = unsafe { ::std::mem::transmute(ksymbol) }; + ksymbol as u64 + }); + __bindgen_bitfield_unit.set(30usize, 1u8, { + let bpf_event: u64 = unsafe { ::std::mem::transmute(bpf_event) }; + bpf_event as u64 + }); + __bindgen_bitfield_unit.set(31usize, 1u8, { + let aux_output: u64 = unsafe { ::std::mem::transmute(aux_output) }; + aux_output as u64 + }); + __bindgen_bitfield_unit.set(32usize, 1u8, { + let cgroup: u64 = unsafe { ::std::mem::transmute(cgroup) }; + cgroup as u64 + }); + __bindgen_bitfield_unit.set(33usize, 31u8, { + let __reserved_1: u64 = unsafe { ::std::mem::transmute(__reserved_1) }; + __reserved_1 as u64 + }); + __bindgen_bitfield_unit + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct perf_event_mmap_page { + pub version: __u32, + pub compat_version: __u32, + pub lock: __u32, + pub index: __u32, + pub offset: __s64, + pub time_enabled: __u64, + pub time_running: __u64, + pub __bindgen_anon_1: perf_event_mmap_page__bindgen_ty_1, + pub pmc_width: __u16, + pub time_shift: __u16, + pub time_mult: __u32, + pub time_offset: __u64, + pub time_zero: __u64, + pub size: __u32, + pub __reserved: [__u8; 948usize], + pub data_head: __u64, + pub data_tail: __u64, + pub data_offset: __u64, + pub data_size: __u64, + pub aux_head: __u64, + pub aux_tail: __u64, + pub aux_offset: __u64, + pub aux_size: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union perf_event_mmap_page__bindgen_ty_1 { + pub capabilities: __u64, + pub __bindgen_anon_1: perf_event_mmap_page__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[repr(align(8))] +#[derive(Debug, Copy, Clone)] +pub struct perf_event_mmap_page__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize], u64>, +} +impl perf_event_mmap_page__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn cap_bit0(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u64) } + } + #[inline] + pub fn set_cap_bit0(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn cap_bit0_is_deprecated(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u64) } + } + #[inline] + pub fn set_cap_bit0_is_deprecated(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn cap_user_rdpmc(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u64) } + } + #[inline] + pub fn set_cap_user_rdpmc(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn cap_user_time(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u64) } + } + #[inline] + pub fn set_cap_user_time(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn cap_user_time_zero(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u64) } + } + #[inline] + pub fn set_cap_user_time_zero(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn cap_____res(&self) -> __u64 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 59u8) as u64) } + } + #[inline] + pub fn set_cap_____res(&mut self, val: __u64) { + unsafe { + let val: u64 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 59u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + cap_bit0: __u64, + cap_bit0_is_deprecated: __u64, + cap_user_rdpmc: __u64, + cap_user_time: __u64, + cap_user_time_zero: __u64, + cap_____res: __u64, + ) -> __BindgenBitfieldUnit<[u8; 8usize], u64> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u64> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let cap_bit0: u64 = unsafe { ::std::mem::transmute(cap_bit0) }; + cap_bit0 as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let cap_bit0_is_deprecated: u64 = + unsafe { ::std::mem::transmute(cap_bit0_is_deprecated) }; + cap_bit0_is_deprecated as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let cap_user_rdpmc: u64 = unsafe { ::std::mem::transmute(cap_user_rdpmc) }; + cap_user_rdpmc as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let cap_user_time: u64 = unsafe { ::std::mem::transmute(cap_user_time) }; + cap_user_time as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let cap_user_time_zero: u64 = unsafe { ::std::mem::transmute(cap_user_time_zero) }; + cap_user_time_zero as u64 + }); + __bindgen_bitfield_unit.set(5usize, 59u8, { + let cap_____res: u64 = unsafe { ::std::mem::transmute(cap_____res) }; + cap_____res as u64 + }); + __bindgen_bitfield_unit + } +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct perf_event_header { + pub type_: __u32, + pub misc: __u16, + pub size: __u16, +} +pub mod perf_event_type { + pub type Type = ::std::os::raw::c_uint; + pub const PERF_RECORD_MMAP: Type = 1; + pub const PERF_RECORD_LOST: Type = 2; + pub const PERF_RECORD_COMM: Type = 3; + pub const PERF_RECORD_EXIT: Type = 4; + pub const PERF_RECORD_THROTTLE: Type = 5; + pub const PERF_RECORD_UNTHROTTLE: Type = 6; + pub const PERF_RECORD_FORK: Type = 7; + pub const PERF_RECORD_READ: Type = 8; + pub const PERF_RECORD_SAMPLE: Type = 9; + pub const PERF_RECORD_MMAP2: Type = 10; + pub const PERF_RECORD_AUX: Type = 11; + pub const PERF_RECORD_ITRACE_START: Type = 12; + pub const PERF_RECORD_LOST_SAMPLES: Type = 13; + pub const PERF_RECORD_SWITCH: Type = 14; + pub const PERF_RECORD_SWITCH_CPU_WIDE: Type = 15; + pub const PERF_RECORD_NAMESPACES: Type = 16; + pub const PERF_RECORD_KSYMBOL: Type = 17; + pub const PERF_RECORD_BPF_EVENT: Type = 18; + pub const PERF_RECORD_CGROUP: Type = 19; + pub const PERF_RECORD_MAX: Type = 20; +} +pub mod _bindgen_ty_79 { + pub type Type = ::std::os::raw::c_uint; + pub const IFLA_XDP_UNSPEC: Type = 0; + pub const IFLA_XDP_FD: Type = 1; + pub const IFLA_XDP_ATTACHED: Type = 2; + pub const IFLA_XDP_FLAGS: Type = 3; + pub const IFLA_XDP_PROG_ID: Type = 4; + pub const IFLA_XDP_DRV_PROG_ID: Type = 5; + pub const IFLA_XDP_SKB_PROG_ID: Type = 6; + pub const IFLA_XDP_HW_PROG_ID: Type = 7; + pub const IFLA_XDP_EXPECTED_FD: Type = 8; + pub const __IFLA_XDP_MAX: Type = 9; +} +#[doc = "\t\tLink layer specific messages."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ifinfomsg { + pub ifi_family: ::std::os::raw::c_uchar, + pub __ifi_pad: ::std::os::raw::c_uchar, + pub ifi_type: ::std::os::raw::c_ushort, + pub ifi_index: ::std::os::raw::c_int, + pub ifi_flags: ::std::os::raw::c_uint, + pub ifi_change: ::std::os::raw::c_uint, +} diff --git a/aya/src/generated/perf_bindings.rs b/aya/src/generated/linux_bindings_x86_64.rs similarity index 63% rename from aya/src/generated/perf_bindings.rs rename to aya/src/generated/linux_bindings_x86_64.rs index 825c7e3b..f70f12e8 100644 --- a/aya/src/generated/perf_bindings.rs +++ b/aya/src/generated/linux_bindings_x86_64.rs @@ -81,16 +81,574 @@ where } } } +pub const BPF_LD: u32 = 0; +pub const BPF_LDX: u32 = 1; +pub const BPF_ST: u32 = 2; +pub const BPF_STX: u32 = 3; +pub const BPF_ALU: u32 = 4; +pub const BPF_W: u32 = 0; +pub const BPF_H: u32 = 8; +pub const BPF_B: u32 = 16; +pub const BPF_K: u32 = 0; +pub const BPF_ALU64: u32 = 7; +pub const BPF_DW: u32 = 24; +pub const BPF_PSEUDO_MAP_FD: u32 = 1; +pub const BPF_PSEUDO_MAP_VALUE: u32 = 2; +pub const BPF_PSEUDO_BTF_ID: u32 = 3; +pub const BPF_PSEUDO_CALL: u32 = 1; +pub const BTF_KIND_UNKN: u32 = 0; +pub const BTF_KIND_INT: u32 = 1; +pub const BTF_KIND_PTR: u32 = 2; +pub const BTF_KIND_ARRAY: u32 = 3; +pub const BTF_KIND_STRUCT: u32 = 4; +pub const BTF_KIND_UNION: u32 = 5; +pub const BTF_KIND_ENUM: u32 = 6; +pub const BTF_KIND_FWD: u32 = 7; +pub const BTF_KIND_TYPEDEF: u32 = 8; +pub const BTF_KIND_VOLATILE: u32 = 9; +pub const BTF_KIND_CONST: u32 = 10; +pub const BTF_KIND_RESTRICT: u32 = 11; +pub const BTF_KIND_FUNC: u32 = 12; +pub const BTF_KIND_FUNC_PROTO: u32 = 13; +pub const BTF_KIND_VAR: u32 = 14; +pub const BTF_KIND_DATASEC: u32 = 15; +pub const BTF_KIND_MAX: u32 = 15; +pub const BTF_INT_SIGNED: u32 = 1; +pub const BTF_INT_CHAR: u32 = 2; +pub const BTF_INT_BOOL: u32 = 4; pub const PERF_FLAG_FD_NO_GROUP: u32 = 1; pub const PERF_FLAG_FD_OUTPUT: u32 = 2; pub const PERF_FLAG_PID_CGROUP: u32 = 4; pub const PERF_FLAG_FD_CLOEXEC: u32 = 8; +pub const NLMSG_ALIGNTO: u32 = 4; +pub const XDP_FLAGS_UPDATE_IF_NOEXIST: u32 = 1; +pub const XDP_FLAGS_SKB_MODE: u32 = 2; +pub const XDP_FLAGS_DRV_MODE: u32 = 4; +pub const XDP_FLAGS_HW_MODE: u32 = 8; +pub const XDP_FLAGS_REPLACE: u32 = 16; +pub const XDP_FLAGS_MODES: u32 = 14; +pub const XDP_FLAGS_MASK: u32 = 31; pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; pub type __u16 = ::std::os::raw::c_ushort; pub type __s32 = ::std::os::raw::c_int; pub type __u32 = ::std::os::raw::c_uint; pub type __s64 = ::std::os::raw::c_longlong; pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_insn { + pub code: __u8, + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, + pub off: __s16, + pub imm: __s32, +} +impl bpf_insn { + #[inline] + pub fn dst_reg(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) } + } + #[inline] + pub fn set_dst_reg(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 4u8, val as u64) + } + } + #[inline] + pub fn src_reg(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) } + } + #[inline] + pub fn set_src_reg(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 4u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1(dst_reg: __u8, src_reg: __u8) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 4u8, { + let dst_reg: u8 = unsafe { ::std::mem::transmute(dst_reg) }; + dst_reg as u64 + }); + __bindgen_bitfield_unit.set(4usize, 4u8, { + let src_reg: u8 = unsafe { ::std::mem::transmute(src_reg) }; + src_reg as u64 + }); + __bindgen_bitfield_unit + } +} +pub mod bpf_cmd { + pub type Type = ::std::os::raw::c_uint; + pub const BPF_MAP_CREATE: Type = 0; + pub const BPF_MAP_LOOKUP_ELEM: Type = 1; + pub const BPF_MAP_UPDATE_ELEM: Type = 2; + pub const BPF_MAP_DELETE_ELEM: Type = 3; + pub const BPF_MAP_GET_NEXT_KEY: Type = 4; + pub const BPF_PROG_LOAD: Type = 5; + pub const BPF_OBJ_PIN: Type = 6; + pub const BPF_OBJ_GET: Type = 7; + pub const BPF_PROG_ATTACH: Type = 8; + pub const BPF_PROG_DETACH: Type = 9; + pub const BPF_PROG_TEST_RUN: Type = 10; + pub const BPF_PROG_GET_NEXT_ID: Type = 11; + pub const BPF_MAP_GET_NEXT_ID: Type = 12; + pub const BPF_PROG_GET_FD_BY_ID: Type = 13; + pub const BPF_MAP_GET_FD_BY_ID: Type = 14; + pub const BPF_OBJ_GET_INFO_BY_FD: Type = 15; + pub const BPF_PROG_QUERY: Type = 16; + pub const BPF_RAW_TRACEPOINT_OPEN: Type = 17; + pub const BPF_BTF_LOAD: Type = 18; + pub const BPF_BTF_GET_FD_BY_ID: Type = 19; + pub const BPF_TASK_FD_QUERY: Type = 20; + pub const BPF_MAP_LOOKUP_AND_DELETE_ELEM: Type = 21; + pub const BPF_MAP_FREEZE: Type = 22; + pub const BPF_BTF_GET_NEXT_ID: Type = 23; + pub const BPF_MAP_LOOKUP_BATCH: Type = 24; + pub const BPF_MAP_LOOKUP_AND_DELETE_BATCH: Type = 25; + pub const BPF_MAP_UPDATE_BATCH: Type = 26; + pub const BPF_MAP_DELETE_BATCH: Type = 27; + pub const BPF_LINK_CREATE: Type = 28; + pub const BPF_LINK_UPDATE: Type = 29; + pub const BPF_LINK_GET_FD_BY_ID: Type = 30; + pub const BPF_LINK_GET_NEXT_ID: Type = 31; + pub const BPF_ENABLE_STATS: Type = 32; + pub const BPF_ITER_CREATE: Type = 33; + pub const BPF_LINK_DETACH: Type = 34; + pub const BPF_PROG_BIND_MAP: Type = 35; +} +pub mod bpf_map_type { + pub type Type = ::std::os::raw::c_uint; + pub const BPF_MAP_TYPE_UNSPEC: Type = 0; + pub const BPF_MAP_TYPE_HASH: Type = 1; + pub const BPF_MAP_TYPE_ARRAY: Type = 2; + pub const BPF_MAP_TYPE_PROG_ARRAY: Type = 3; + pub const BPF_MAP_TYPE_PERF_EVENT_ARRAY: Type = 4; + pub const BPF_MAP_TYPE_PERCPU_HASH: Type = 5; + pub const BPF_MAP_TYPE_PERCPU_ARRAY: Type = 6; + pub const BPF_MAP_TYPE_STACK_TRACE: Type = 7; + pub const BPF_MAP_TYPE_CGROUP_ARRAY: Type = 8; + pub const BPF_MAP_TYPE_LRU_HASH: Type = 9; + pub const BPF_MAP_TYPE_LRU_PERCPU_HASH: Type = 10; + pub const BPF_MAP_TYPE_LPM_TRIE: Type = 11; + pub const BPF_MAP_TYPE_ARRAY_OF_MAPS: Type = 12; + pub const BPF_MAP_TYPE_HASH_OF_MAPS: Type = 13; + pub const BPF_MAP_TYPE_DEVMAP: Type = 14; + pub const BPF_MAP_TYPE_SOCKMAP: Type = 15; + pub const BPF_MAP_TYPE_CPUMAP: Type = 16; + pub const BPF_MAP_TYPE_XSKMAP: Type = 17; + pub const BPF_MAP_TYPE_SOCKHASH: Type = 18; + pub const BPF_MAP_TYPE_CGROUP_STORAGE: Type = 19; + pub const BPF_MAP_TYPE_REUSEPORT_SOCKARRAY: Type = 20; + pub const BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE: Type = 21; + pub const BPF_MAP_TYPE_QUEUE: Type = 22; + pub const BPF_MAP_TYPE_STACK: Type = 23; + pub const BPF_MAP_TYPE_SK_STORAGE: Type = 24; + pub const BPF_MAP_TYPE_DEVMAP_HASH: Type = 25; + pub const BPF_MAP_TYPE_STRUCT_OPS: Type = 26; + pub const BPF_MAP_TYPE_RINGBUF: Type = 27; + pub const BPF_MAP_TYPE_INODE_STORAGE: Type = 28; + pub const BPF_MAP_TYPE_TASK_STORAGE: Type = 29; +} +pub mod bpf_prog_type { + pub type Type = ::std::os::raw::c_uint; + pub const BPF_PROG_TYPE_UNSPEC: Type = 0; + pub const BPF_PROG_TYPE_SOCKET_FILTER: Type = 1; + pub const BPF_PROG_TYPE_KPROBE: Type = 2; + pub const BPF_PROG_TYPE_SCHED_CLS: Type = 3; + pub const BPF_PROG_TYPE_SCHED_ACT: Type = 4; + pub const BPF_PROG_TYPE_TRACEPOINT: Type = 5; + pub const BPF_PROG_TYPE_XDP: Type = 6; + pub const BPF_PROG_TYPE_PERF_EVENT: Type = 7; + pub const BPF_PROG_TYPE_CGROUP_SKB: Type = 8; + pub const BPF_PROG_TYPE_CGROUP_SOCK: Type = 9; + pub const BPF_PROG_TYPE_LWT_IN: Type = 10; + pub const BPF_PROG_TYPE_LWT_OUT: Type = 11; + pub const BPF_PROG_TYPE_LWT_XMIT: Type = 12; + pub const BPF_PROG_TYPE_SOCK_OPS: Type = 13; + pub const BPF_PROG_TYPE_SK_SKB: Type = 14; + pub const BPF_PROG_TYPE_CGROUP_DEVICE: Type = 15; + pub const BPF_PROG_TYPE_SK_MSG: Type = 16; + pub const BPF_PROG_TYPE_RAW_TRACEPOINT: Type = 17; + pub const BPF_PROG_TYPE_CGROUP_SOCK_ADDR: Type = 18; + pub const BPF_PROG_TYPE_LWT_SEG6LOCAL: Type = 19; + pub const BPF_PROG_TYPE_LIRC_MODE2: Type = 20; + pub const BPF_PROG_TYPE_SK_REUSEPORT: Type = 21; + pub const BPF_PROG_TYPE_FLOW_DISSECTOR: Type = 22; + pub const BPF_PROG_TYPE_CGROUP_SYSCTL: Type = 23; + pub const BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE: Type = 24; + pub const BPF_PROG_TYPE_CGROUP_SOCKOPT: Type = 25; + pub const BPF_PROG_TYPE_TRACING: Type = 26; + pub const BPF_PROG_TYPE_STRUCT_OPS: Type = 27; + pub const BPF_PROG_TYPE_EXT: Type = 28; + pub const BPF_PROG_TYPE_LSM: Type = 29; + pub const BPF_PROG_TYPE_SK_LOOKUP: Type = 30; +} +pub mod bpf_attach_type { + pub type Type = ::std::os::raw::c_uint; + pub const BPF_CGROUP_INET_INGRESS: Type = 0; + pub const BPF_CGROUP_INET_EGRESS: Type = 1; + pub const BPF_CGROUP_INET_SOCK_CREATE: Type = 2; + pub const BPF_CGROUP_SOCK_OPS: Type = 3; + pub const BPF_SK_SKB_STREAM_PARSER: Type = 4; + pub const BPF_SK_SKB_STREAM_VERDICT: Type = 5; + pub const BPF_CGROUP_DEVICE: Type = 6; + pub const BPF_SK_MSG_VERDICT: Type = 7; + pub const BPF_CGROUP_INET4_BIND: Type = 8; + pub const BPF_CGROUP_INET6_BIND: Type = 9; + pub const BPF_CGROUP_INET4_CONNECT: Type = 10; + pub const BPF_CGROUP_INET6_CONNECT: Type = 11; + pub const BPF_CGROUP_INET4_POST_BIND: Type = 12; + pub const BPF_CGROUP_INET6_POST_BIND: Type = 13; + pub const BPF_CGROUP_UDP4_SENDMSG: Type = 14; + pub const BPF_CGROUP_UDP6_SENDMSG: Type = 15; + pub const BPF_LIRC_MODE2: Type = 16; + pub const BPF_FLOW_DISSECTOR: Type = 17; + pub const BPF_CGROUP_SYSCTL: Type = 18; + pub const BPF_CGROUP_UDP4_RECVMSG: Type = 19; + pub const BPF_CGROUP_UDP6_RECVMSG: Type = 20; + pub const BPF_CGROUP_GETSOCKOPT: Type = 21; + pub const BPF_CGROUP_SETSOCKOPT: Type = 22; + pub const BPF_TRACE_RAW_TP: Type = 23; + pub const BPF_TRACE_FENTRY: Type = 24; + pub const BPF_TRACE_FEXIT: Type = 25; + pub const BPF_MODIFY_RETURN: Type = 26; + pub const BPF_LSM_MAC: Type = 27; + pub const BPF_TRACE_ITER: Type = 28; + pub const BPF_CGROUP_INET4_GETPEERNAME: Type = 29; + pub const BPF_CGROUP_INET6_GETPEERNAME: Type = 30; + pub const BPF_CGROUP_INET4_GETSOCKNAME: Type = 31; + pub const BPF_CGROUP_INET6_GETSOCKNAME: Type = 32; + pub const BPF_XDP_DEVMAP: Type = 33; + pub const BPF_CGROUP_INET_SOCK_RELEASE: Type = 34; + pub const BPF_XDP_CPUMAP: Type = 35; + pub const BPF_SK_LOOKUP: Type = 36; + pub const BPF_XDP: Type = 37; + pub const __MAX_BPF_ATTACH_TYPE: Type = 38; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr { + pub __bindgen_anon_1: bpf_attr__bindgen_ty_1, + pub __bindgen_anon_2: bpf_attr__bindgen_ty_2, + pub batch: bpf_attr__bindgen_ty_3, + pub __bindgen_anon_3: bpf_attr__bindgen_ty_4, + pub __bindgen_anon_4: bpf_attr__bindgen_ty_5, + pub __bindgen_anon_5: bpf_attr__bindgen_ty_6, + pub test: bpf_attr__bindgen_ty_7, + pub __bindgen_anon_6: bpf_attr__bindgen_ty_8, + pub info: bpf_attr__bindgen_ty_9, + pub query: bpf_attr__bindgen_ty_10, + pub raw_tracepoint: bpf_attr__bindgen_ty_11, + pub __bindgen_anon_7: bpf_attr__bindgen_ty_12, + pub task_fd_query: bpf_attr__bindgen_ty_13, + pub link_create: bpf_attr__bindgen_ty_14, + pub link_update: bpf_attr__bindgen_ty_15, + pub link_detach: bpf_attr__bindgen_ty_16, + pub enable_stats: bpf_attr__bindgen_ty_17, + pub iter_create: bpf_attr__bindgen_ty_18, + pub prog_bind_map: bpf_attr__bindgen_ty_19, + _bindgen_union_align: [u64; 15usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_1 { + pub map_type: __u32, + pub key_size: __u32, + pub value_size: __u32, + pub max_entries: __u32, + pub map_flags: __u32, + pub inner_map_fd: __u32, + pub numa_node: __u32, + pub map_name: [::std::os::raw::c_char; 16usize], + pub map_ifindex: __u32, + pub btf_fd: __u32, + pub btf_key_type_id: __u32, + pub btf_value_type_id: __u32, + pub btf_vmlinux_value_type_id: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct bpf_attr__bindgen_ty_2 { + pub map_fd: __u32, + pub key: __u64, + pub __bindgen_anon_1: bpf_attr__bindgen_ty_2__bindgen_ty_1, + pub flags: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_2__bindgen_ty_1 { + pub value: __u64, + pub next_key: __u64, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_3 { + pub in_batch: __u64, + pub out_batch: __u64, + pub keys: __u64, + pub values: __u64, + pub count: __u32, + pub map_fd: __u32, + pub elem_flags: __u64, + pub flags: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct bpf_attr__bindgen_ty_4 { + pub prog_type: __u32, + pub insn_cnt: __u32, + pub insns: __u64, + pub license: __u64, + pub log_level: __u32, + pub log_size: __u32, + pub log_buf: __u64, + pub kern_version: __u32, + pub prog_flags: __u32, + pub prog_name: [::std::os::raw::c_char; 16usize], + pub prog_ifindex: __u32, + pub expected_attach_type: __u32, + pub prog_btf_fd: __u32, + pub func_info_rec_size: __u32, + pub func_info: __u64, + pub func_info_cnt: __u32, + pub line_info_rec_size: __u32, + pub line_info: __u64, + pub line_info_cnt: __u32, + pub attach_btf_id: __u32, + pub __bindgen_anon_1: bpf_attr__bindgen_ty_4__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_4__bindgen_ty_1 { + pub attach_prog_fd: __u32, + pub attach_btf_obj_fd: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_5 { + pub pathname: __u64, + pub bpf_fd: __u32, + pub file_flags: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_6 { + pub target_fd: __u32, + pub attach_bpf_fd: __u32, + pub attach_type: __u32, + pub attach_flags: __u32, + pub replace_bpf_fd: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_7 { + pub prog_fd: __u32, + pub retval: __u32, + pub data_size_in: __u32, + pub data_size_out: __u32, + pub data_in: __u64, + pub data_out: __u64, + pub repeat: __u32, + pub duration: __u32, + pub ctx_size_in: __u32, + pub ctx_size_out: __u32, + pub ctx_in: __u64, + pub ctx_out: __u64, + pub flags: __u32, + pub cpu: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct bpf_attr__bindgen_ty_8 { + pub __bindgen_anon_1: bpf_attr__bindgen_ty_8__bindgen_ty_1, + pub next_id: __u32, + pub open_flags: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_8__bindgen_ty_1 { + pub start_id: __u32, + pub prog_id: __u32, + pub map_id: __u32, + pub btf_id: __u32, + pub link_id: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_9 { + pub bpf_fd: __u32, + pub info_len: __u32, + pub info: __u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_10 { + pub target_fd: __u32, + pub attach_type: __u32, + pub query_flags: __u32, + pub attach_flags: __u32, + pub prog_ids: __u64, + pub prog_cnt: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_11 { + pub name: __u64, + pub prog_fd: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_12 { + pub btf: __u64, + pub btf_log_buf: __u64, + pub btf_size: __u32, + pub btf_log_size: __u32, + pub btf_log_level: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_13 { + pub pid: __u32, + pub fd: __u32, + pub flags: __u32, + pub buf_len: __u32, + pub buf: __u64, + pub prog_id: __u32, + pub fd_type: __u32, + pub probe_offset: __u64, + pub probe_addr: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct bpf_attr__bindgen_ty_14 { + pub prog_fd: __u32, + pub __bindgen_anon_1: bpf_attr__bindgen_ty_14__bindgen_ty_1, + pub attach_type: __u32, + pub flags: __u32, + pub __bindgen_anon_2: bpf_attr__bindgen_ty_14__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_14__bindgen_ty_1 { + pub target_fd: __u32, + pub target_ifindex: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union bpf_attr__bindgen_ty_14__bindgen_ty_2 { + pub target_btf_id: __u32, + pub __bindgen_anon_1: bpf_attr__bindgen_ty_14__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: [u64; 2usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_14__bindgen_ty_2__bindgen_ty_1 { + pub iter_info: __u64, + pub iter_info_len: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_15 { + pub link_fd: __u32, + pub new_prog_fd: __u32, + pub flags: __u32, + pub old_prog_fd: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_16 { + pub link_fd: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_17 { + pub type_: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_18 { + pub link_fd: __u32, + pub flags: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_attr__bindgen_ty_19 { + pub prog_fd: __u32, + pub map_fd: __u32, + pub flags: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_header { + pub magic: __u16, + pub version: __u8, + pub flags: __u8, + pub hdr_len: __u32, + pub type_off: __u32, + pub type_len: __u32, + pub str_off: __u32, + pub str_len: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct btf_type { + pub name_off: __u32, + pub info: __u32, + pub __bindgen_anon_1: btf_type__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union btf_type__bindgen_ty_1 { + pub size: __u32, + pub type_: __u32, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_enum { + pub name_off: __u32, + pub val: __s32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_array { + pub type_: __u32, + pub index_type: __u32, + pub nelems: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_member { + pub name_off: __u32, + pub type_: __u32, + pub offset: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_param { + pub name_off: __u32, + pub type_: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_var { + pub linkage: __u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct btf_var_secinfo { + pub type_: __u32, + pub offset: __u32, + pub size: __u32, +} pub mod perf_type_id { pub type Type = ::std::os::raw::c_uint; pub const PERF_TYPE_HARDWARE: Type = 0; @@ -915,3 +1473,26 @@ pub mod perf_event_type { pub const PERF_RECORD_CGROUP: Type = 19; pub const PERF_RECORD_MAX: Type = 20; } +pub mod _bindgen_ty_79 { + pub type Type = ::std::os::raw::c_uint; + pub const IFLA_XDP_UNSPEC: Type = 0; + pub const IFLA_XDP_FD: Type = 1; + pub const IFLA_XDP_ATTACHED: Type = 2; + pub const IFLA_XDP_FLAGS: Type = 3; + pub const IFLA_XDP_PROG_ID: Type = 4; + pub const IFLA_XDP_DRV_PROG_ID: Type = 5; + pub const IFLA_XDP_SKB_PROG_ID: Type = 6; + pub const IFLA_XDP_HW_PROG_ID: Type = 7; + pub const IFLA_XDP_EXPECTED_FD: Type = 8; + pub const __IFLA_XDP_MAX: Type = 9; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ifinfomsg { + pub ifi_family: ::std::os::raw::c_uchar, + pub __ifi_pad: ::std::os::raw::c_uchar, + pub ifi_type: ::std::os::raw::c_ushort, + pub ifi_index: ::std::os::raw::c_int, + pub ifi_flags: ::std::os::raw::c_uint, + pub ifi_change: ::std::os::raw::c_uint, +} diff --git a/aya/src/generated/mod.rs b/aya/src/generated/mod.rs index 582f7a60..1deb535a 100644 --- a/aya/src/generated/mod.rs +++ b/aya/src/generated/mod.rs @@ -1,15 +1,15 @@ #![allow(dead_code, non_camel_case_types, non_snake_case)] -// FIXME: generate for x86_64 and aarch64 - -mod bpf_bindings; -mod btf_bindings; mod btf_internal_bindings; -mod netlink_bindings; -mod perf_bindings; +#[cfg(target_arch = "aarch64")] +mod linux_bindings_aarch64; +#[cfg(target_arch = "x86_64")] +mod linux_bindings_x86_64; -pub use bpf_bindings::*; -pub use btf_bindings::*; pub use btf_internal_bindings::*; -pub use netlink_bindings::*; -pub use perf_bindings::*; + +#[cfg(target_arch = "x86_64")] +pub use linux_bindings_x86_64::*; + +#[cfg(target_arch = "aarch64")] +pub use linux_bindings_aarch64::*; diff --git a/aya/src/generated/netlink_bindings.rs b/aya/src/generated/netlink_bindings.rs deleted file mode 100644 index 786992ad..00000000 --- a/aya/src/generated/netlink_bindings.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* automatically generated by rust-bindgen 0.55.1 */ - -pub const NLMSG_ALIGNTO: u32 = 4; -pub const XDP_FLAGS_UPDATE_IF_NOEXIST: u32 = 1; -pub const XDP_FLAGS_SKB_MODE: u32 = 2; -pub const XDP_FLAGS_DRV_MODE: u32 = 4; -pub const XDP_FLAGS_HW_MODE: u32 = 8; -pub const XDP_FLAGS_REPLACE: u32 = 16; -pub const XDP_FLAGS_MODES: u32 = 14; -pub const XDP_FLAGS_MASK: u32 = 31; -pub mod _bindgen_ty_41 { - pub type Type = ::std::os::raw::c_uint; - pub const IFLA_XDP_UNSPEC: Type = 0; - pub const IFLA_XDP_FD: Type = 1; - pub const IFLA_XDP_ATTACHED: Type = 2; - pub const IFLA_XDP_FLAGS: Type = 3; - pub const IFLA_XDP_PROG_ID: Type = 4; - pub const IFLA_XDP_DRV_PROG_ID: Type = 5; - pub const IFLA_XDP_SKB_PROG_ID: Type = 6; - pub const IFLA_XDP_HW_PROG_ID: Type = 7; - pub const IFLA_XDP_EXPECTED_FD: Type = 8; - pub const __IFLA_XDP_MAX: Type = 9; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ifinfomsg { - pub ifi_family: ::std::os::raw::c_uchar, - pub __ifi_pad: ::std::os::raw::c_uchar, - pub ifi_type: ::std::os::raw::c_ushort, - pub ifi_index: ::std::os::raw::c_int, - pub ifi_flags: ::std::os::raw::c_uint, - pub ifi_change: ::std::os::raw::c_uint, -} diff --git a/aya/src/sys/netlink.rs b/aya/src/sys/netlink.rs index 9f908cab..10673d26 100644 --- a/aya/src/sys/netlink.rs +++ b/aya/src/sys/netlink.rs @@ -1,5 +1,4 @@ use std::{io, mem, os::unix::io::RawFd, ptr}; -use thiserror::Error; use libc::{ c_int, close, getsockname, nlattr, nlmsgerr, nlmsghdr, recv, send, setsockopt, sockaddr_nl, @@ -8,7 +7,7 @@ use libc::{ }; use crate::generated::{ - _bindgen_ty_41::{IFLA_XDP_EXPECTED_FD, IFLA_XDP_FD, IFLA_XDP_FLAGS}, + _bindgen_ty_79::{IFLA_XDP_EXPECTED_FD, IFLA_XDP_FD, IFLA_XDP_FLAGS}, ifinfomsg, NLMSG_ALIGNTO, XDP_FLAGS_REPLACE, };