mirror of https://github.com/aya-rs/aya
aya-obj: migrate bindgen destination
Aya::obj depends on bindgen generated files, and we start by migrating bindgen generated files. This commit adds the new aya-obj crate to the workplace and migrates generated files into the crate. We use core instead of std in an effort to make the final crate no_std. Bindgen was run against libbpf v1.0.1. Refs: #473pull/475/head
parent
c6f93b1775
commit
81bc307dce
@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "aya-obj"
|
||||
version = "0.11.0"
|
||||
description = "A library for loading and relocating eBPF object files"
|
||||
keywords = ["ebpf", "bpf", "linux", "kernel"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
authors = ["The Aya Contributors"]
|
||||
repository = "https://github.com/aya-rs/aya"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/aya-obj"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
@ -0,0 +1 @@
|
||||
# aya-obj
|
@ -1,10 +1,10 @@
|
||||
/* automatically generated by rust-bindgen 0.60.1 */
|
||||
/* automatically generated by rust-bindgen 0.63.0 */
|
||||
|
||||
pub type __u8 = ::std::os::raw::c_uchar;
|
||||
pub type __u16 = ::std::os::raw::c_ushort;
|
||||
pub type __u32 = ::std::os::raw::c_uint;
|
||||
pub type __u8 = ::core::ffi::c_uchar;
|
||||
pub type __u16 = ::core::ffi::c_ushort;
|
||||
pub type __u32 = ::core::ffi::c_uint;
|
||||
pub mod bpf_core_relo_kind {
|
||||
pub type Type = ::std::os::raw::c_uint;
|
||||
pub type Type = ::core::ffi::c_uint;
|
||||
pub const BPF_CORE_FIELD_BYTE_OFFSET: Type = 0;
|
||||
pub const BPF_CORE_FIELD_BYTE_SIZE: Type = 1;
|
||||
pub const BPF_CORE_FIELD_EXISTS: Type = 2;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,86 @@
|
||||
//! eBPF bindings generated by rust-bindgen
|
||||
|
||||
#![allow(
|
||||
dead_code,
|
||||
non_camel_case_types,
|
||||
non_snake_case,
|
||||
clippy::all,
|
||||
missing_docs
|
||||
)]
|
||||
|
||||
mod btf_internal_bindings;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
mod linux_bindings_aarch64;
|
||||
#[cfg(target_arch = "arm")]
|
||||
mod linux_bindings_armv7;
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
mod linux_bindings_riscv64;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
mod linux_bindings_x86_64;
|
||||
|
||||
pub use btf_internal_bindings::*;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub use linux_bindings_x86_64::*;
|
||||
|
||||
#[cfg(target_arch = "arm")]
|
||||
pub use linux_bindings_armv7::*;
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub use linux_bindings_aarch64::*;
|
||||
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
pub use linux_bindings_riscv64::*;
|
||||
|
||||
pub mod maps {
|
||||
/// Invalid map type encontered
|
||||
pub struct InvalidMapTypeError {
|
||||
/// The map type
|
||||
pub map_type: u32,
|
||||
}
|
||||
|
||||
impl TryFrom<u32> for super::bpf_map_type {
|
||||
type Error = InvalidMapTypeError;
|
||||
|
||||
fn try_from(map_type: u32) -> Result<Self, Self::Error> {
|
||||
use super::bpf_map_type::*;
|
||||
Ok(match map_type {
|
||||
x if x == BPF_MAP_TYPE_UNSPEC as u32 => BPF_MAP_TYPE_UNSPEC,
|
||||
x if x == BPF_MAP_TYPE_HASH as u32 => BPF_MAP_TYPE_HASH,
|
||||
x if x == BPF_MAP_TYPE_ARRAY as u32 => BPF_MAP_TYPE_ARRAY,
|
||||
x if x == BPF_MAP_TYPE_PROG_ARRAY as u32 => BPF_MAP_TYPE_PROG_ARRAY,
|
||||
x if x == BPF_MAP_TYPE_PERF_EVENT_ARRAY as u32 => BPF_MAP_TYPE_PERF_EVENT_ARRAY,
|
||||
x if x == BPF_MAP_TYPE_PERCPU_HASH as u32 => BPF_MAP_TYPE_PERCPU_HASH,
|
||||
x if x == BPF_MAP_TYPE_PERCPU_ARRAY as u32 => BPF_MAP_TYPE_PERCPU_ARRAY,
|
||||
x if x == BPF_MAP_TYPE_STACK_TRACE as u32 => BPF_MAP_TYPE_STACK_TRACE,
|
||||
x if x == BPF_MAP_TYPE_CGROUP_ARRAY as u32 => BPF_MAP_TYPE_CGROUP_ARRAY,
|
||||
x if x == BPF_MAP_TYPE_LRU_HASH as u32 => BPF_MAP_TYPE_LRU_HASH,
|
||||
x if x == BPF_MAP_TYPE_LRU_PERCPU_HASH as u32 => BPF_MAP_TYPE_LRU_PERCPU_HASH,
|
||||
x if x == BPF_MAP_TYPE_LPM_TRIE as u32 => BPF_MAP_TYPE_LPM_TRIE,
|
||||
x if x == BPF_MAP_TYPE_BLOOM_FILTER as u32 => BPF_MAP_TYPE_BLOOM_FILTER,
|
||||
x if x == BPF_MAP_TYPE_ARRAY_OF_MAPS as u32 => BPF_MAP_TYPE_ARRAY_OF_MAPS,
|
||||
x if x == BPF_MAP_TYPE_HASH_OF_MAPS as u32 => BPF_MAP_TYPE_HASH_OF_MAPS,
|
||||
x if x == BPF_MAP_TYPE_DEVMAP as u32 => BPF_MAP_TYPE_DEVMAP,
|
||||
x if x == BPF_MAP_TYPE_SOCKMAP as u32 => BPF_MAP_TYPE_SOCKMAP,
|
||||
x if x == BPF_MAP_TYPE_CPUMAP as u32 => BPF_MAP_TYPE_CPUMAP,
|
||||
x if x == BPF_MAP_TYPE_XSKMAP as u32 => BPF_MAP_TYPE_XSKMAP,
|
||||
x if x == BPF_MAP_TYPE_SOCKHASH as u32 => BPF_MAP_TYPE_SOCKHASH,
|
||||
x if x == BPF_MAP_TYPE_CGROUP_STORAGE as u32 => BPF_MAP_TYPE_CGROUP_STORAGE,
|
||||
x if x == BPF_MAP_TYPE_REUSEPORT_SOCKARRAY as u32 => BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
|
||||
x if x == BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE as u32 => {
|
||||
BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE
|
||||
}
|
||||
x if x == BPF_MAP_TYPE_QUEUE as u32 => BPF_MAP_TYPE_QUEUE,
|
||||
x if x == BPF_MAP_TYPE_STACK as u32 => BPF_MAP_TYPE_STACK,
|
||||
x if x == BPF_MAP_TYPE_SK_STORAGE as u32 => BPF_MAP_TYPE_SK_STORAGE,
|
||||
x if x == BPF_MAP_TYPE_DEVMAP_HASH as u32 => BPF_MAP_TYPE_DEVMAP_HASH,
|
||||
x if x == BPF_MAP_TYPE_STRUCT_OPS as u32 => BPF_MAP_TYPE_STRUCT_OPS,
|
||||
x if x == BPF_MAP_TYPE_RINGBUF as u32 => BPF_MAP_TYPE_RINGBUF,
|
||||
x if x == BPF_MAP_TYPE_INODE_STORAGE as u32 => BPF_MAP_TYPE_INODE_STORAGE,
|
||||
x if x == BPF_MAP_TYPE_TASK_STORAGE as u32 => BPF_MAP_TYPE_TASK_STORAGE,
|
||||
_ => return Err(InvalidMapTypeError { map_type }),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
//! A library for loading and relocating eBPF object files.
|
||||
|
||||
#![no_std]
|
||||
#![doc(
|
||||
html_logo_url = "https://aya-rs.dev/assets/images/crabby.svg",
|
||||
html_favicon_url = "https://aya-rs.dev/assets/images/crabby.svg"
|
||||
)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![deny(clippy::all, missing_docs)]
|
||||
#![allow(clippy::missing_safety_doc, clippy::len_without_is_empty)]
|
||||
|
||||
pub mod generated;
|
@ -1,31 +0,0 @@
|
||||
#![allow(
|
||||
dead_code,
|
||||
non_camel_case_types,
|
||||
non_snake_case,
|
||||
clippy::all,
|
||||
missing_docs
|
||||
)]
|
||||
|
||||
mod btf_internal_bindings;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
mod linux_bindings_aarch64;
|
||||
#[cfg(target_arch = "arm")]
|
||||
mod linux_bindings_armv7;
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
mod linux_bindings_riscv64;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
mod linux_bindings_x86_64;
|
||||
|
||||
pub use btf_internal_bindings::*;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub use linux_bindings_x86_64::*;
|
||||
|
||||
#[cfg(target_arch = "arm")]
|
||||
pub use linux_bindings_armv7::*;
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub use linux_bindings_aarch64::*;
|
||||
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
pub use linux_bindings_riscv64::*;
|
Loading…
Reference in New Issue