Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build-aya-bpf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: nightly-2023-01-10
components: rust-src
override: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-aya.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: nightly-2023-01-10
components: rustfmt, clippy, rust-src
target: x86_64-unknown-linux-musl
override: true
Expand Down
9 changes: 2 additions & 7 deletions aya-obj/src/btf/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,9 +799,10 @@ impl DeclTag {
}
}

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
#[repr(u32)]
pub enum BtfKind {
#[default]
Unknown = 0,
Int = 1,
Ptr = 2,
Expand Down Expand Up @@ -879,12 +880,6 @@ impl Display for BtfKind {
}
}

impl Default for BtfKind {
fn default() -> Self {
BtfKind::Unknown
}
}

unsafe fn read<T>(data: &[u8]) -> Result<T, BtfError> {
if mem::size_of::<T>() > data.len() {
return Err(BtfError::InvalidTypeInfo);
Expand Down
9 changes: 2 additions & 7 deletions aya-obj/src/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ pub struct BtfMapDef {
/// Upon pinning a map, a file representation is created for the map,
/// so that the map can be alive and retrievable across sessions.
#[repr(u32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
pub enum PinningType {
/// No pinning
#[default]
None = 0,
/// Pin by the name
ByName = 1,
Expand Down Expand Up @@ -112,12 +113,6 @@ impl TryFrom<u32> for PinningType {
}
}

impl Default for PinningType {
fn default() -> Self {
PinningType::None
}
}

/// Map definition in legacy BPF map declaration style
#[allow(non_camel_case_types)]
#[repr(C)]
Expand Down
7 changes: 1 addition & 6 deletions aya-obj/src/obj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,6 @@ mod tests {
map_flags: 5,
id: 0,
pinning: PinningType::None,
..Default::default()
};

assert_eq!(
Expand All @@ -1482,7 +1481,6 @@ mod tests {
map_flags: 5,
id: 6,
pinning: PinningType::ByName,
..Default::default()
};

assert_eq!(parse_map_def("foo", bytes_of(&def)).unwrap(), def);
Expand All @@ -1498,7 +1496,6 @@ mod tests {
map_flags: 5,
id: 6,
pinning: PinningType::ByName,
..Default::default()
};
let mut buf = [0u8; 128];
unsafe { ptr::write_unaligned(buf.as_mut_ptr() as *mut _, def) };
Expand Down Expand Up @@ -1529,7 +1526,6 @@ mod tests {
map_flags: 5,
id: 0,
pinning: PinningType::None,
..Default::default()
})
),
"foo"
Expand Down Expand Up @@ -1664,7 +1660,7 @@ mod tests {
buf.extend(&map_data);
buf.extend(&map_data);
// throw in some padding
buf.extend(&[0, 0, 0, 0]);
buf.extend([0, 0, 0, 0]);
buf.extend(&map_data);
assert_matches!(
obj.parse_section(fake_section(BpfSectionKind::Maps, "maps", buf.as_slice(),)),
Expand Down Expand Up @@ -2198,7 +2194,6 @@ mod tests {
map_flags: BPF_F_RDONLY_PROG,
id: 1,
pinning: PinningType::None,
..Default::default()
},
section_index: 1,
symbol_index: 1,
Expand Down
11 changes: 2 additions & 9 deletions aya-obj/src/programs/cgroup_sock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,19 @@ use crate::{
};

/// Defines where to attach a `CgroupSock` program.
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default)]
pub enum CgroupSockAttachType {
/// Called after the IPv4 bind events.
PostBind4,
/// Called after the IPv6 bind events.
PostBind6,
/// Attach to IPv4 connect events.
#[default]
SockCreate,
/// Attach to IPv6 connect events.
SockRelease,
}

impl Default for CgroupSockAttachType {
// The kernel checks for a 0 attach_type and sets it to sock_create
// We may as well do that here also
fn default() -> Self {
CgroupSockAttachType::SockCreate
}
}

impl From<CgroupSockAttachType> for bpf_attach_type {
fn from(s: CgroupSockAttachType) -> bpf_attach_type {
match s {
Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build]
publish = "site"
command = "rustup toolchain install nightly -c rust-src && cargo xtask docs"
command = "rustup toolchain install nightly-2023-01-10 -c rust-src && cargo xtask docs"
2 changes: 1 addition & 1 deletion xtask/src/build_ebpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn build_rust_ebpf(opts: &BuildEbpfOptions) -> anyhow::Result<()> {

let target = format!("--target={}", opts.target);
let mut args = vec![
"+nightly",
"+nightly-2023-01-10",
"build",
"--verbose",
target.as_str(),
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/docs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn build_docs(working_dir: &PathBuf, abs_header_path: &Path) -> Result<(), anyho
.expect("failed to replace logo");
assert!(replace.success());

let args = vec!["+nightly", "doc", "--no-deps", "--all-features"];
let args = vec!["+nightly-2023-01-10", "doc", "--no-deps", "--all-features"];

let status = Command::new("cargo")
.current_dir(working_dir)
Expand Down