|  |  | @ -73,6 +73,20 @@ use aya::{ | 
			
		
	
		
		
			
				
					
					|  |  |  |     Bpf, Pod, |  |  |  |     Bpf, Pod, | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #[derive(Copy, Clone)] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #[repr(transparent)] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | struct RecordFieldWrapper(RecordField); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #[derive(Copy, Clone)] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #[repr(transparent)] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | struct ArgumentWrapper(Argument); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #[derive(Copy, Clone)] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #[repr(transparent)] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | struct DisplayHintWrapper(DisplayHint); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | unsafe impl aya::Pod for RecordFieldWrapper {} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | unsafe impl aya::Pod for ArgumentWrapper {} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | unsafe impl aya::Pod for DisplayHintWrapper {} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /// Log messages generated by `aya_log_ebpf` using the [log] crate.
 |  |  |  | /// Log messages generated by `aya_log_ebpf` using the [log] crate.
 | 
			
		
	
		
		
			
				
					
					|  |  |  | ///
 |  |  |  | ///
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /// For more details see the [module level documentation](crate).
 |  |  |  | /// For more details see the [module level documentation](crate).
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -197,12 +211,12 @@ impl Formatter<[u8; 6]> for UpperMacFormatter { | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | trait Format { |  |  |  | trait Format { | 
			
		
	
		
		
			
				
					
					|  |  |  |     fn format(&self, last_hint: Option<DisplayHint>) -> Result<String, ()>; |  |  |  |     fn format(&self, last_hint: Option<DisplayHintWrapper>) -> Result<String, ()>; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | impl Format for u32 { |  |  |  | impl Format for u32 { | 
			
		
	
		
		
			
				
					
					|  |  |  |     fn format(&self, last_hint: Option<DisplayHint>) -> Result<String, ()> { |  |  |  |     fn format(&self, last_hint: Option<DisplayHintWrapper>) -> Result<String, ()> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         match last_hint { |  |  |  |         match last_hint.map(|h| h.0) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::Default) => Ok(DefaultFormatter::format(self)), |  |  |  |             Some(DisplayHint::Default) => Ok(DefaultFormatter::format(self)), | 
			
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::LowerHex) => Ok(LowerHexFormatter::format(self)), |  |  |  |             Some(DisplayHint::LowerHex) => Ok(LowerHexFormatter::format(self)), | 
			
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::UpperHex) => Ok(UpperHexFormatter::format(self)), |  |  |  |             Some(DisplayHint::UpperHex) => Ok(UpperHexFormatter::format(self)), | 
			
		
	
	
		
		
			
				
					|  |  | @ -216,8 +230,8 @@ impl Format for u32 { | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | impl Format for [u8; 6] { |  |  |  | impl Format for [u8; 6] { | 
			
		
	
		
		
			
				
					
					|  |  |  |     fn format(&self, last_hint: Option<DisplayHint>) -> Result<String, ()> { |  |  |  |     fn format(&self, last_hint: Option<DisplayHintWrapper>) -> Result<String, ()> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         match last_hint { |  |  |  |         match last_hint.map(|h| h.0) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::Default) => Err(()), |  |  |  |             Some(DisplayHint::Default) => Err(()), | 
			
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::LowerHex) => Err(()), |  |  |  |             Some(DisplayHint::LowerHex) => Err(()), | 
			
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::UpperHex) => Err(()), |  |  |  |             Some(DisplayHint::UpperHex) => Err(()), | 
			
		
	
	
		
		
			
				
					|  |  | @ -231,8 +245,8 @@ impl Format for [u8; 6] { | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | impl Format for [u8; 16] { |  |  |  | impl Format for [u8; 16] { | 
			
		
	
		
		
			
				
					
					|  |  |  |     fn format(&self, last_hint: Option<DisplayHint>) -> Result<String, ()> { |  |  |  |     fn format(&self, last_hint: Option<DisplayHintWrapper>) -> Result<String, ()> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         match last_hint { |  |  |  |         match last_hint.map(|h| h.0) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::Default) => Err(()), |  |  |  |             Some(DisplayHint::Default) => Err(()), | 
			
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::LowerHex) => Err(()), |  |  |  |             Some(DisplayHint::LowerHex) => Err(()), | 
			
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::UpperHex) => Err(()), |  |  |  |             Some(DisplayHint::UpperHex) => Err(()), | 
			
		
	
	
		
		
			
				
					|  |  | @ -246,8 +260,8 @@ impl Format for [u8; 16] { | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | impl Format for [u16; 8] { |  |  |  | impl Format for [u16; 8] { | 
			
		
	
		
		
			
				
					
					|  |  |  |     fn format(&self, last_hint: Option<DisplayHint>) -> Result<String, ()> { |  |  |  |     fn format(&self, last_hint: Option<DisplayHintWrapper>) -> Result<String, ()> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         match last_hint { |  |  |  |         match last_hint.map(|h| h.0) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::Default) => Err(()), |  |  |  |             Some(DisplayHint::Default) => Err(()), | 
			
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::LowerHex) => Err(()), |  |  |  |             Some(DisplayHint::LowerHex) => Err(()), | 
			
		
	
		
		
			
				
					
					|  |  |  |             Some(DisplayHint::UpperHex) => Err(()), |  |  |  |             Some(DisplayHint::UpperHex) => Err(()), | 
			
		
	
	
		
		
			
				
					|  |  | @ -263,8 +277,8 @@ impl Format for [u16; 8] { | 
			
		
	
		
		
			
				
					
					|  |  |  | macro_rules! impl_format { |  |  |  | macro_rules! impl_format { | 
			
		
	
		
		
			
				
					
					|  |  |  |     ($type:ident) => { |  |  |  |     ($type:ident) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |         impl Format for $type { |  |  |  |         impl Format for $type { | 
			
		
	
		
		
			
				
					
					|  |  |  |             fn format(&self, last_hint: Option<DisplayHint>) -> Result<String, ()> { |  |  |  |             fn format(&self, last_hint: Option<DisplayHintWrapper>) -> Result<String, ()> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 match last_hint { |  |  |  |                 match last_hint.map(|h| h.0) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     Some(DisplayHint::Default) => Ok(DefaultFormatter::format(self)), |  |  |  |                     Some(DisplayHint::Default) => Ok(DefaultFormatter::format(self)), | 
			
		
	
		
		
			
				
					
					|  |  |  |                     Some(DisplayHint::LowerHex) => Ok(LowerHexFormatter::format(self)), |  |  |  |                     Some(DisplayHint::LowerHex) => Ok(LowerHexFormatter::format(self)), | 
			
		
	
		
		
			
				
					
					|  |  |  |                     Some(DisplayHint::UpperHex) => Ok(UpperHexFormatter::format(self)), |  |  |  |                     Some(DisplayHint::UpperHex) => Ok(UpperHexFormatter::format(self)), | 
			
		
	
	
		
		
			
				
					|  |  | @ -293,8 +307,8 @@ impl_format!(usize); | 
			
		
	
		
		
			
				
					
					|  |  |  | macro_rules! impl_format_float { |  |  |  | macro_rules! impl_format_float { | 
			
		
	
		
		
			
				
					
					|  |  |  |     ($type:ident) => { |  |  |  |     ($type:ident) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |         impl Format for $type { |  |  |  |         impl Format for $type { | 
			
		
	
		
		
			
				
					
					|  |  |  |             fn format(&self, last_hint: Option<DisplayHint>) -> Result<String, ()> { |  |  |  |             fn format(&self, last_hint: Option<DisplayHintWrapper>) -> Result<String, ()> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 match last_hint { |  |  |  |                 match last_hint.map(|h| h.0) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     Some(DisplayHint::Default) => Ok(DefaultFormatter::format(self)), |  |  |  |                     Some(DisplayHint::Default) => Ok(DefaultFormatter::format(self)), | 
			
		
	
		
		
			
				
					
					|  |  |  |                     Some(DisplayHint::LowerHex) => Err(()), |  |  |  |                     Some(DisplayHint::LowerHex) => Err(()), | 
			
		
	
		
		
			
				
					
					|  |  |  |                     Some(DisplayHint::UpperHex) => Err(()), |  |  |  |                     Some(DisplayHint::UpperHex) => Err(()), | 
			
		
	
	
		
		
			
				
					|  |  | @ -353,9 +367,9 @@ fn log_buf(mut buf: &[u8], logger: &dyn Log) -> Result<(), ()> { | 
			
		
	
		
		
			
				
					
					|  |  |  |     let mut num_args = None; |  |  |  |     let mut num_args = None; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     for _ in 0..LOG_FIELDS { |  |  |  |     for _ in 0..LOG_FIELDS { | 
			
		
	
		
		
			
				
					
					|  |  |  |         let (attr, rest) = unsafe { TagLenValue::<'_, RecordField>::try_read(buf)? }; |  |  |  |         let (attr, rest) = unsafe { TagLenValue::<'_, RecordFieldWrapper>::try_read(buf)? }; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         match attr.tag { |  |  |  |         match attr.tag.0 { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             RecordField::Target => { |  |  |  |             RecordField::Target => { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 target = Some(std::str::from_utf8(attr.value).map_err(|_| ())?); |  |  |  |                 target = Some(std::str::from_utf8(attr.value).map_err(|_| ())?); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
	
		
		
			
				
					|  |  | @ -380,11 +394,11 @@ fn log_buf(mut buf: &[u8], logger: &dyn Log) -> Result<(), ()> { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     let mut full_log_msg = String::new(); |  |  |  |     let mut full_log_msg = String::new(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     let mut last_hint: Option<DisplayHint> = None; |  |  |  |     let mut last_hint: Option<DisplayHintWrapper> = None; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     for _ in 0..num_args.ok_or(())? { |  |  |  |     for _ in 0..num_args.ok_or(())? { | 
			
		
	
		
		
			
				
					
					|  |  |  |         let (attr, rest) = unsafe { TagLenValue::<'_, Argument>::try_read(buf)? }; |  |  |  |         let (attr, rest) = unsafe { TagLenValue::<'_, ArgumentWrapper>::try_read(buf)? }; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         match attr.tag { |  |  |  |         match attr.tag.0 { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             Argument::DisplayHint => { |  |  |  |             Argument::DisplayHint => { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 last_hint = Some(unsafe { ptr::read_unaligned(attr.value.as_ptr() as *const _) }); |  |  |  |                 last_hint = Some(unsafe { ptr::read_unaligned(attr.value.as_ptr() as *const _) }); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |