aya-obj,aya-ebpf-bindings: hook up loongarch64

This causes rustfmt to format those files.

Squish some other conditional compilation to get rustfmt sorting.
reviewable/pr1204/r1
Tamir Duberstein 2 months ago
parent 56ebe1406e
commit a408a051d3
No known key found for this signature in database

@ -47,11 +47,7 @@ where
index % 8
};
let mask = 1 << bit_index;
if val {
byte | mask
} else {
byte & !mask
}
if val { byte | mask } else { byte & !mask }
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {

@ -1,28 +1,34 @@
//! eBPF bindings generated by rust-bindgen
mod btf_internal_bindings;
#[cfg(target_arch = "aarch64")]
// don't re-export __u8 __u16 etc which are already exported by the
// linux_bindings_* module
pub use btf_internal_bindings::{bpf_core_relo, bpf_core_relo_kind, btf_ext_header};
#[allow(dead_code)]
mod linux_bindings_aarch64;
#[cfg(target_arch = "arm")]
#[allow(dead_code)]
mod linux_bindings_armv7;
#[cfg(target_arch = "mips")]
#[allow(dead_code)]
mod linux_bindings_loongarch64;
#[allow(dead_code)]
mod linux_bindings_mips;
#[cfg(target_arch = "powerpc64")]
#[allow(dead_code)]
mod linux_bindings_powerpc64;
#[cfg(target_arch = "riscv64")]
#[allow(dead_code)]
mod linux_bindings_riscv64;
#[cfg(target_arch = "s390x")]
#[allow(dead_code)]
mod linux_bindings_s390x;
#[cfg(target_arch = "x86_64")]
#[allow(dead_code)]
mod linux_bindings_x86_64;
// don't re-export __u8 __u16 etc which are already exported by the
// linux_bindings_* module
pub use btf_internal_bindings::{bpf_core_relo, bpf_core_relo_kind, btf_ext_header};
#[cfg(target_arch = "aarch64")]
pub use linux_bindings_aarch64::*;
#[cfg(target_arch = "arm")]
pub use linux_bindings_armv7::*;
#[cfg(target_arch = "loongarch64")]
pub use linux_bindings_loongarch64::*;
#[cfg(target_arch = "mips")]
pub use linux_bindings_mips::*;
#[cfg(target_arch = "powerpc64")]

@ -12,7 +12,18 @@ fn main() {
}
println!("cargo:rustc-cfg=bpf_target_arch=\"{arch}\"");
}
println!(
"cargo::rustc-check-cfg=cfg(bpf_target_arch, values(\"x86_64\",\"arm\",\"aarch64\",\"riscv64\",\"powerpc64\",\"s390x\",\"mips\"))"
);
print!("cargo::rustc-check-cfg=cfg(bpf_target_arch, values(");
for arch in [
"aarch64",
"arm",
"loongarch64",
"mips",
"powerpc64",
"riscv64",
"s390x",
"x86_64",
] {
print!("\"{arch}\",");
}
println!("))");
}

@ -1,2 +0,0 @@
pub mod bindings;
pub mod helpers;

@ -1,2 +0,0 @@
pub mod bindings;
pub mod helpers;

@ -1,40 +1,60 @@
#![expect(
clippy::all,
dead_code,
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
unsafe_op_in_unsafe_fn
)]
#![deny(warnings)]
#![no_std]
#[cfg(bpf_target_arch = "x86_64")]
mod x86_64;
#[cfg(bpf_target_arch = "arm")]
mod armv7;
#[cfg(bpf_target_arch = "aarch64")]
mod aarch64;
#[cfg(bpf_target_arch = "riscv64")]
mod riscv64;
#[cfg(bpf_target_arch = "powerpc64")]
mod powerpc64;
#[cfg(bpf_target_arch = "s390x")]
mod s390x;
#[cfg(bpf_target_arch = "mips")]
mod mips;
#[allow(dead_code)]
mod aarch64 {
pub mod bindings;
pub mod helpers;
}
#[allow(dead_code)]
mod armv7 {
pub mod bindings;
pub mod helpers;
}
#[allow(dead_code)]
mod loongarch64 {
pub mod bindings;
pub mod helpers;
}
#[allow(dead_code)]
mod mips {
pub mod bindings;
pub mod helpers;
}
#[allow(dead_code)]
mod powerpc64 {
pub mod bindings;
pub mod helpers;
}
#[allow(dead_code)]
mod riscv64 {
pub mod bindings;
pub mod helpers;
}
#[allow(dead_code)]
mod s390x {
pub mod bindings;
pub mod helpers;
}
#[allow(dead_code)]
mod x86_64 {
pub mod bindings;
pub mod helpers;
}
mod generated {
#[cfg(bpf_target_arch = "aarch64")]
pub use super::aarch64::*;
#[cfg(bpf_target_arch = "arm")]
pub use super::armv7::*;
#[cfg(bpf_target_arch = "loongarch64")]
pub use super::loongarch64::*;
#[cfg(bpf_target_arch = "mips")]
pub use super::mips::*;
#[cfg(bpf_target_arch = "powerpc64")]
@ -46,6 +66,7 @@ mod generated {
#[cfg(bpf_target_arch = "x86_64")]
pub use super::x86_64::*;
}
pub use generated::helpers;
pub mod bindings {
@ -61,7 +82,7 @@ pub mod bindings {
pub const TC_ACT_REDIRECT: i32 = crate::generated::bindings::TC_ACT_REDIRECT as i32;
pub const TC_ACT_TRAP: i32 = crate::generated::bindings::TC_ACT_TRAP as i32;
pub const TC_ACT_VALUE_MAX: i32 = crate::generated::bindings::TC_ACT_VALUE_MAX as i32;
pub const TC_ACT_EXT_VAL_MASK: i32 = 268435455;
pub const TC_ACT_EXT_VAL_MASK: i32 = crate::generated::bindings::TC_ACT_EXT_VAL_MASK as i32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]

@ -45,11 +45,7 @@ where
index % 8
};
let mask = 1 << bit_index;
if val {
byte | mask
} else {
byte & !mask
}
if val { byte | mask } else { byte & !mask }
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {

@ -1,2 +0,0 @@
pub mod bindings;
pub mod helpers;

@ -1,2 +0,0 @@
pub mod bindings;
pub mod helpers;

@ -1,2 +0,0 @@
pub mod bindings;
pub mod helpers;

@ -1,2 +0,0 @@
pub mod bindings;
pub mod helpers;

@ -1,2 +0,0 @@
pub mod bindings;
pub mod helpers;

@ -6,7 +6,6 @@
//! versions but that may change in any new patch release.
#![no_std]
#![expect(non_camel_case_types)]
#![deny(warnings)]
// AD = Architecture dependent
pub use ad::*;
@ -20,22 +19,16 @@ mod ad {
#[cfg(bpf_target_arch = "arm")]
pub type c_char = super::c_uchar;
#[cfg(bpf_target_arch = "aarch64")]
pub type c_char = super::c_uchar;
#[cfg(bpf_target_arch = "powerpc64")]
pub type c_char = super::c_uchar;
#[cfg(bpf_target_arch = "riscv64")]
pub type c_char = super::c_uchar;
#[cfg(bpf_target_arch = "s390x")]
pub type c_char = super::c_uchar;
#[cfg(bpf_target_arch = "mips")]
pub type c_char = super::c_uchar;
#[cfg(bpf_target_arch = "x86_64")]
pub type c_char = super::c_schar;
}

@ -13,9 +13,20 @@ fn main() {
}
println!("cargo:rustc-cfg=bpf_target_arch=\"{arch}\"");
}
println!(
"cargo::rustc-check-cfg=cfg(bpf_target_arch, values(\"x86_64\",\"arm\",\"aarch64\",\"riscv64\",\"powerpc64\",\"s390x\",\"mips\"))"
);
print!("cargo::rustc-check-cfg=cfg(bpf_target_arch, values(");
for arch in [
"aarch64",
"arm",
"loongarch64",
"mips",
"powerpc64",
"riscv64",
"s390x",
"x86_64",
] {
print!("\"{arch}\",");
}
println!("))");
println!("cargo::rustc-check-cfg=cfg(unstable)");
}

@ -11,7 +11,6 @@
#![cfg_attr(unstable, expect(incomplete_features), feature(generic_const_exprs))]
#![cfg_attr(unstable, feature(never_type))]
#![cfg_attr(target_arch = "bpf", feature(asm_experimental_arch))]
#![deny(warnings)]
#![warn(clippy::cast_lossless, clippy::cast_sign_loss)]
#![no_std]

Loading…
Cancel
Save