Skip to content

Commit

Permalink
Fix CI, clippy and feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Milan <milan@mdaverde.com>
  • Loading branch information
mdaverde committed Dec 14, 2022
1 parent 8f1163a commit 4b6d97e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
14 changes: 3 additions & 11 deletions aya-bpf-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion aya/src/programs/cgroup_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 4b6d97e

Please sign in to comment.