From 5693fb994123b88eb856af83c5b8f79afd1d789f Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Fri, 9 Sep 2022 09:24:39 +0000 Subject: [PATCH] aya: Rename from_pinned and from_path to from_pin Signed-off-by: Dave Tucker --- aya/src/maps/mod.rs | 4 ++-- aya/src/programs/links.rs | 2 +- aya/src/programs/mod.rs | 2 +- test/integration-test/src/tests/load.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aya/src/maps/mod.rs b/aya/src/maps/mod.rs index 09edd8d2..9d8a13d1 100644 --- a/aya/src/maps/mod.rs +++ b/aya/src/maps/mod.rs @@ -303,7 +303,7 @@ impl Map { } /// Loads a map from a pinned path in bpffs. - pub fn from_pinned>(path: P) -> Result { + pub fn from_pin>(path: P) -> Result { let path_string = CString::new(path.as_ref().to_string_lossy().into_owned()).map_err(|e| { MapError::PinError { @@ -334,7 +334,7 @@ impl Map { /// Loads a map from a [`RawFd`]. /// - /// If loading from a BPF Filesystem (bpffs) you should use [`Map::from_pinned`]. + /// If loading from a BPF Filesystem (bpffs) you should use [`Map::from_pin`]. /// This API is intended for cases where you have received a valid BPF FD from some other means. /// For example, you received an FD over Unix Domain Socket. pub fn from_fd(fd: RawFd) -> Result { diff --git a/aya/src/programs/links.rs b/aya/src/programs/links.rs index b35e4983..5efee10f 100644 --- a/aya/src/programs/links.rs +++ b/aya/src/programs/links.rs @@ -188,7 +188,7 @@ impl PinnedLink { } /// Creates a [`PinnedLink`] from a valid path on bpffs. - pub fn from_path>(path: P) -> Result { + pub fn from_pin>(path: P) -> Result { let path_string = CString::new(path.as_ref().to_string_lossy().to_string()).unwrap(); let fd = bpf_get_object(&path_string).map_err(|(code, io_error)| LinkError::SyscallError { diff --git a/aya/src/programs/mod.rs b/aya/src/programs/mod.rs index 1cd51ef1..7f392f7a 100644 --- a/aya/src/programs/mod.rs +++ b/aya/src/programs/mod.rs @@ -818,7 +818,7 @@ impl ProgramInfo { } /// Loads a program from a pinned path in bpffs. - pub fn from_pinned>(path: P) -> Result { + pub fn from_pin>(path: P) -> Result { let path_string = CString::new(path.as_ref().to_str().unwrap()).unwrap(); let fd = bpf_get_object(&path_string).map_err(|(_, io_error)| ProgramError::SyscallError { diff --git a/test/integration-test/src/tests/load.rs b/test/integration-test/src/tests/load.rs index dfea2752..37ff0e8f 100644 --- a/test/integration-test/src/tests/load.rs +++ b/test/integration-test/src/tests/load.rs @@ -155,7 +155,7 @@ fn pin_lifecycle() -> anyhow::Result<()> { let prog: &mut Xdp = bpf.program_mut("pass").unwrap().try_into().unwrap(); prog.load().unwrap(); - let link = PinnedLink::from_path("/sys/fs/bpf/aya-xdp-test-lo")?.unpin()?; + let link = PinnedLink::from_pin("/sys/fs/bpf/aya-xdp-test-lo")?.unpin()?; prog.attach_to_link(link.try_into()?)?; assert_loaded("pass", true); }