Fix CI, clippy and feedback

Signed-off-by: Milan <milan@mdaverde.com>
pull/466/head
Milan 2 years ago
parent 8f1163a400
commit 4b6d97e4db

@ -7,7 +7,7 @@ use expand::{
SockoptArgs, TracePoint, Xdp,
};
use proc_macro::TokenStream;
use syn::{parse_macro_input, token::Token, ItemFn, ItemStatic};
use syn::{parse_macro_input, ItemFn, ItemStatic};
#[proc_macro_attribute]
pub fn map(attrs: TokenStream, item: TokenStream) -> TokenStream {
@ -523,19 +523,11 @@ pub fn sk_lookup(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// macros::cgroup_device,
/// programs::DeviceContext,
/// };
/// use aya_log_ebpf::info;
///
/// #[cgroup_device(name="cgroup_dev")]
/// pub fn cgroup_dev(ctx: DeviceContext) -> i32 {
/// match try_cgroup_dev(ctx) {
/// Ok(ret) => ret,
/// Err(ret) => ret,
/// }
/// }
///
/// fn try_cgroup_dev(ctx: DeviceContext) -> Result<i32, i32> {
/// info!(&ctx, "device operation called");
/// Ok(0)
/// // Reject all device access
/// return 0;
/// }
/// ```
#[proc_macro_attribute]

@ -9,7 +9,7 @@ use crate::{
sys::{bpf_link_create, bpf_prog_attach, kernel_version},
};
/// A program used to watch or prevent device interaction from a cgroup
/// A program used to watch or prevent device interaction from a cgroup.
///
/// [`CgroupDevice`] programs can be attached to a cgroup and will be called every
/// time a process inside that cgroup tries to access (e.g. read, write, mknod)
@ -41,6 +41,7 @@ impl CgroupDevice {
pub fn load(&mut self) -> Result<(), ProgramError> {
load_program(BPF_PROG_TYPE_CGROUP_DEVICE, &mut self.data)
}
/// Attaches the program to the given cgroup.
///
/// The returned value can be used to detach, see [CgroupDevice::detach]

Loading…
Cancel
Save