aya: fix warnings

pull/1/head
Alessandro Decina 4 years ago
parent dda8534d9d
commit 9e12c9324c

@ -55,7 +55,7 @@ pub use array::{Array, PerCpuArray, ProgramArray};
pub use hash_map::{HashMap, PerCpuHashMap}; pub use hash_map::{HashMap, PerCpuHashMap};
pub use map_lock::*; pub use map_lock::*;
pub use perf::PerfEventArray; pub use perf::PerfEventArray;
pub use sock::SockMap; pub use sock::{SockHash, SockMap};
pub use stack_trace::StackTraceMap; pub use stack_trace::StackTraceMap;
#[derive(Error, Debug)] #[derive(Error, Debug)]
@ -300,10 +300,6 @@ pub(crate) struct PerCpuKernelMem {
} }
impl PerCpuKernelMem { impl PerCpuKernelMem {
pub(crate) fn as_ptr(&self) -> *const u8 {
self.bytes.as_ptr()
}
pub(crate) fn as_mut_ptr(&mut self) -> *mut u8 { pub(crate) fn as_mut_ptr(&mut self) -> *mut u8 {
self.bytes.as_mut_ptr() self.bytes.as_mut_ptr()
} }

@ -5,7 +5,7 @@ use std::{
os::unix::prelude::{AsRawFd, RawFd}, os::unix::prelude::{AsRawFd, RawFd},
}; };
#[cfg(feature = "async_std")] #[cfg(all(not(feature = "async_tokio"), feature = "async_std"))]
use async_io::Async; use async_io::Async;
#[cfg(feature = "async_tokio")] #[cfg(feature = "async_tokio")]

@ -1,8 +1,6 @@
use std::ops::Deref;
use crate::{ use crate::{
generated::{bpf_attach_type::BPF_SK_MSG_VERDICT, bpf_prog_type::BPF_PROG_TYPE_SK_MSG}, generated::{bpf_attach_type::BPF_SK_MSG_VERDICT, bpf_prog_type::BPF_PROG_TYPE_SK_MSG},
maps::{sock::SocketMap, Map, SockMap}, maps::sock::SocketMap,
programs::{load_program, LinkRef, ProgAttachLink, ProgramData, ProgramError}, programs::{load_program, LinkRef, ProgAttachLink, ProgramData, ProgramError},
sys::bpf_prog_attach, sys::bpf_prog_attach,
}; };

@ -1,11 +1,9 @@
use std::ops::Deref;
use crate::{ use crate::{
generated::{ generated::{
bpf_attach_type::{BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT}, bpf_attach_type::{BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT},
bpf_prog_type::BPF_PROG_TYPE_SK_SKB, bpf_prog_type::BPF_PROG_TYPE_SK_SKB,
}, },
maps::{sock::SocketMap, Map, SockMap}, maps::sock::SocketMap,
programs::{load_program, LinkRef, ProgAttachLink, ProgramData, ProgramError}, programs::{load_program, LinkRef, ProgAttachLink, ProgramData, ProgramError},
sys::bpf_prog_attach, sys::bpf_prog_attach,
}; };

@ -94,13 +94,6 @@ pub(crate) fn bpf_map_lookup_elem<K: Pod, V: Pod>(
lookup(fd, key, flags, bpf_cmd::BPF_MAP_LOOKUP_ELEM) lookup(fd, key, flags, bpf_cmd::BPF_MAP_LOOKUP_ELEM)
} }
pub(crate) fn bpf_map_lookup_and_delete_elem<K: Pod, V: Pod>(
fd: RawFd,
key: &K,
) -> Result<Option<V>, (c_long, io::Error)> {
lookup(fd, key, 0, bpf_cmd::BPF_MAP_LOOKUP_AND_DELETE_ELEM)
}
pub(crate) fn bpf_map_lookup_elem_per_cpu<K: Pod, V: Pod>( pub(crate) fn bpf_map_lookup_elem_per_cpu<K: Pod, V: Pod>(
fd: RawFd, fd: RawFd,
key: &K, key: &K,

@ -1,6 +1,6 @@
//! Utility functions. //! Utility functions.
use std::{ use std::{
collections::{BTreeMap, HashMap}, collections::BTreeMap,
fs::{self, File}, fs::{self, File},
io::{self, BufReader}, io::{self, BufReader},
str::FromStr, str::FromStr,

Loading…
Cancel
Save