Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aya-log-ebpf-macros: fix compile errors #613

Merged
merged 1 commit into from
May 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions aya-log-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ impl_formatter_for_types!(
}
);

pub trait Ipv4Formatter {}
impl Ipv4Formatter for u32 {}

pub trait Ipv6Formatter {}
impl Ipv6Formatter for [u8; 16] {}
impl Ipv6Formatter for [u16; 8] {}
pub trait IpFormatter {}
impl IpFormatter for u32 {}
impl IpFormatter for [u8; 16] {}
impl IpFormatter for [u16; 8] {}

pub trait LowerMacFormatter {}
impl LowerMacFormatter for [u8; 6] {}
Expand All @@ -94,9 +92,7 @@ pub fn check_impl_lower_hex<T: LowerHexFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_upper_hex<T: UpperHexFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_ipv4<T: Ipv4Formatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_ipv6<T: Ipv6Formatter>(_v: T) {}
pub fn check_impl_ip<T: IpFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_lower_mac<T: LowerMacFormatter>(_v: T) {}
#[inline(always)]
Expand Down
3 changes: 1 addition & 2 deletions aya-log-ebpf-macros/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ fn hint_to_format_check(hint: DisplayHint) -> Result<Expr> {
DisplayHint::Default => parse_str("::aya_log_ebpf::macro_support::check_impl_default"),
DisplayHint::LowerHex => parse_str("::aya_log_ebpf::macro_support::check_impl_lower_hex"),
DisplayHint::UpperHex => parse_str("::aya_log_ebpf::macro_support::check_impl_upper_hex"),
DisplayHint::Ipv4 => parse_str("::aya_log_ebpf::macro_support::check_impl_ipv4"),
DisplayHint::Ipv6 => parse_str("::aya_log_ebpf::macro_support::check_impl_ipv6"),
DisplayHint::Ip => parse_str("::aya_log_ebpf::macro_support::check_impl_ip"),
DisplayHint::LowerMac => parse_str("::aya_log_ebpf::macro_support::check_impl_lower_mac"),
DisplayHint::UpperMac => parse_str("::aya_log_ebpf::macro_support::check_impl_upper_mac"),
}
Expand Down
8 changes: 4 additions & 4 deletions bpf/aya-log-ebpf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ pub static mut AYA_LOGS: PerfEventByteArray = PerfEventByteArray::new(0);
#[doc(hidden)]
pub mod macro_support {
pub use aya_log_common::{
check_impl_default, check_impl_ipv4, check_impl_ipv6, check_impl_lower_hex,
check_impl_lower_mac, check_impl_upper_hex, check_impl_upper_mac, DefaultFormatter,
DisplayHint, Ipv4Formatter, Ipv6Formatter, Level, LowerHexFormatter, LowerMacFormatter,
UpperHexFormatter, UpperMacFormatter, LOG_BUF_CAPACITY,
check_impl_default, check_impl_ip, check_impl_lower_hex, check_impl_lower_mac,
check_impl_upper_hex, check_impl_upper_mac, DefaultFormatter, DisplayHint, IpFormatter,
Level, LowerHexFormatter, LowerMacFormatter, UpperHexFormatter, UpperMacFormatter,
LOG_BUF_CAPACITY,
};
pub use aya_log_ebpf_macros::log;
}
Loading