From a2349ea88089f29c6a2587d2bea9ce01bf03e73e Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Mon, 6 Jun 2022 12:46:06 +0100 Subject: [PATCH] aya: Rename forget_link to take_link Signed-off-by: Dave Tucker --- aya/src/programs/cgroup_skb.rs | 4 ++-- aya/src/programs/cgroup_sock_addr.rs | 4 ++-- aya/src/programs/cgroup_sockopt.rs | 4 ++-- aya/src/programs/cgroup_sysctl.rs | 4 ++-- aya/src/programs/extension.rs | 4 ++-- aya/src/programs/fentry.rs | 4 ++-- aya/src/programs/fexit.rs | 4 ++-- aya/src/programs/kprobe.rs | 4 ++-- aya/src/programs/lirc_mode2.rs | 4 ++-- aya/src/programs/lsm.rs | 4 ++-- aya/src/programs/mod.rs | 4 ++-- aya/src/programs/perf_event.rs | 4 ++-- aya/src/programs/raw_trace_point.rs | 4 ++-- aya/src/programs/sk_lookup.rs | 4 ++-- aya/src/programs/sk_msg.rs | 4 ++-- aya/src/programs/sk_skb.rs | 4 ++-- aya/src/programs/sock_ops.rs | 4 ++-- aya/src/programs/socket_filter.rs | 4 ++-- aya/src/programs/tc.rs | 4 ++-- aya/src/programs/tp_btf.rs | 4 ++-- aya/src/programs/trace_point.rs | 4 ++-- aya/src/programs/uprobe.rs | 4 ++-- aya/src/programs/xdp.rs | 4 ++-- test/cases/010_load/030_unload/test.rs | 2 +- 24 files changed, 47 insertions(+), 47 deletions(-) diff --git a/aya/src/programs/cgroup_skb.rs b/aya/src/programs/cgroup_skb.rs index 6852407aa..08d010691 100644 --- a/aya/src/programs/cgroup_skb.rs +++ b/aya/src/programs/cgroup_skb.rs @@ -128,11 +128,11 @@ impl CgroupSkb { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: CgroupSkbLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } /// Detaches the program. diff --git a/aya/src/programs/cgroup_sock_addr.rs b/aya/src/programs/cgroup_sock_addr.rs index 0d04ed0c8..e810b7565 100644 --- a/aya/src/programs/cgroup_sock_addr.rs +++ b/aya/src/programs/cgroup_sock_addr.rs @@ -107,11 +107,11 @@ impl CgroupSockAddr { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: CgroupSockAddrLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } /// Detaches the program. diff --git a/aya/src/programs/cgroup_sockopt.rs b/aya/src/programs/cgroup_sockopt.rs index 79ad4c4ae..b680b3f6a 100644 --- a/aya/src/programs/cgroup_sockopt.rs +++ b/aya/src/programs/cgroup_sockopt.rs @@ -103,11 +103,11 @@ impl CgroupSockopt { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: CgroupSockoptLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } /// Detaches the program. diff --git a/aya/src/programs/cgroup_sysctl.rs b/aya/src/programs/cgroup_sysctl.rs index 756702b78..94c0412c3 100644 --- a/aya/src/programs/cgroup_sysctl.rs +++ b/aya/src/programs/cgroup_sysctl.rs @@ -99,11 +99,11 @@ impl CgroupSysctl { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: CgroupSysctlLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } /// Detaches the program. diff --git a/aya/src/programs/extension.rs b/aya/src/programs/extension.rs index 9efe796a6..03e6ab2aa 100644 --- a/aya/src/programs/extension.rs +++ b/aya/src/programs/extension.rs @@ -154,11 +154,11 @@ impl Extension { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: ExtensionLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/fentry.rs b/aya/src/programs/fentry.rs index 86c353267..4245ed06a 100644 --- a/aya/src/programs/fentry.rs +++ b/aya/src/programs/fentry.rs @@ -80,11 +80,11 @@ impl FEntry { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: FEntryLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/fexit.rs b/aya/src/programs/fexit.rs index 408896c22..437d55c93 100644 --- a/aya/src/programs/fexit.rs +++ b/aya/src/programs/fexit.rs @@ -80,11 +80,11 @@ impl FExit { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: FExitLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/kprobe.rs b/aya/src/programs/kprobe.rs index a5bf0475b..71212990f 100644 --- a/aya/src/programs/kprobe.rs +++ b/aya/src/programs/kprobe.rs @@ -81,11 +81,11 @@ impl KProbe { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: KProbeLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/lirc_mode2.rs b/aya/src/programs/lirc_mode2.rs index e210a734f..66f47cf76 100644 --- a/aya/src/programs/lirc_mode2.rs +++ b/aya/src/programs/lirc_mode2.rs @@ -86,11 +86,11 @@ impl LircMode2 { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: LircLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } /// Queries the lirc device for attached programs. diff --git a/aya/src/programs/lsm.rs b/aya/src/programs/lsm.rs index 87109df9d..1aa51e0b9 100644 --- a/aya/src/programs/lsm.rs +++ b/aya/src/programs/lsm.rs @@ -85,8 +85,8 @@ impl Lsm { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link(&mut self, link_id: LsmLinkId) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + pub fn take_link(&mut self, link_id: LsmLinkId) -> Result, ProgramError> { + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/mod.rs b/aya/src/programs/mod.rs index 5cbd15656..a4efc86f5 100644 --- a/aya/src/programs/mod.rs +++ b/aya/src/programs/mod.rs @@ -381,7 +381,7 @@ impl ProgramData { Ok(()) } - pub(crate) fn forget_link(&mut self, link_id: T::Id) -> Result { + pub(crate) fn take_link(&mut self, link_id: T::Id) -> Result { self.links.forget(link_id) } } @@ -556,7 +556,7 @@ macro_rules! impl_program_unload { /// Unloads the program from the kernel. /// /// Links will be detached before unloading the program. Note - /// that owned links obtained using `forget_link()` will not be + /// that owned links obtained using `take_link()` will not be /// detached. pub fn unload(&mut self) -> Result<(), ProgramError> { unload_program(&mut self.data) diff --git a/aya/src/programs/perf_event.rs b/aya/src/programs/perf_event.rs index 44c15c3eb..b8c127ea6 100644 --- a/aya/src/programs/perf_event.rs +++ b/aya/src/programs/perf_event.rs @@ -182,10 +182,10 @@ impl PerfEvent { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: PerfLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/raw_trace_point.rs b/aya/src/programs/raw_trace_point.rs index fd4656fad..be8a7f4d5 100644 --- a/aya/src/programs/raw_trace_point.rs +++ b/aya/src/programs/raw_trace_point.rs @@ -64,11 +64,11 @@ impl RawTracePoint { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: RawTracePointLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/sk_lookup.rs b/aya/src/programs/sk_lookup.rs index 4f8e2f033..cd347f995 100644 --- a/aya/src/programs/sk_lookup.rs +++ b/aya/src/programs/sk_lookup.rs @@ -78,11 +78,11 @@ impl SkLookup { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: SkLookupLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } /// Detaches the program. diff --git a/aya/src/programs/sk_msg.rs b/aya/src/programs/sk_msg.rs index 7568e3be0..7ff50a0b8 100644 --- a/aya/src/programs/sk_msg.rs +++ b/aya/src/programs/sk_msg.rs @@ -100,11 +100,11 @@ impl SkMsg { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: SkMsgLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/sk_skb.rs b/aya/src/programs/sk_skb.rs index bf4f27779..d9c518992 100644 --- a/aya/src/programs/sk_skb.rs +++ b/aya/src/programs/sk_skb.rs @@ -95,11 +95,11 @@ impl SkSkb { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: SkSkbLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/sock_ops.rs b/aya/src/programs/sock_ops.rs index d4a4d3858..f36075766 100644 --- a/aya/src/programs/sock_ops.rs +++ b/aya/src/programs/sock_ops.rs @@ -87,11 +87,11 @@ impl SockOps { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: SockOpsLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/socket_filter.rs b/aya/src/programs/socket_filter.rs index ef9e08305..afbc84c47 100644 --- a/aya/src/programs/socket_filter.rs +++ b/aya/src/programs/socket_filter.rs @@ -107,11 +107,11 @@ impl SocketFilter { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: SocketFilterLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/tc.rs b/aya/src/programs/tc.rs index 941ed18ed..a3f3eeb76 100644 --- a/aya/src/programs/tc.rs +++ b/aya/src/programs/tc.rs @@ -146,11 +146,11 @@ impl SchedClassifier { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: SchedClassifierLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/tp_btf.rs b/aya/src/programs/tp_btf.rs index d68785f38..25f99a180 100644 --- a/aya/src/programs/tp_btf.rs +++ b/aya/src/programs/tp_btf.rs @@ -83,11 +83,11 @@ impl BtfTracePoint { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: BtfTracePointLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/trace_point.rs b/aya/src/programs/trace_point.rs index 43d356060..e4f88bff6 100644 --- a/aya/src/programs/trace_point.rs +++ b/aya/src/programs/trace_point.rs @@ -100,11 +100,11 @@ impl TracePoint { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: TracePointLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/uprobe.rs b/aya/src/programs/uprobe.rs index fa1f7a9ac..91cd25a8d 100644 --- a/aya/src/programs/uprobe.rs +++ b/aya/src/programs/uprobe.rs @@ -133,11 +133,11 @@ impl UProbe { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link( + pub fn take_link( &mut self, link_id: UProbeLinkId, ) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/aya/src/programs/xdp.rs b/aya/src/programs/xdp.rs index 713d4b7de..06bc6cb4f 100644 --- a/aya/src/programs/xdp.rs +++ b/aya/src/programs/xdp.rs @@ -138,8 +138,8 @@ impl Xdp { /// /// The link will be detached on `Drop` and the caller is now responsible /// for managing its lifetime. - pub fn forget_link(&mut self, link_id: XdpLinkId) -> Result, ProgramError> { - Ok(OwnedLink::new(self.data.forget_link(link_id)?)) + pub fn take_link(&mut self, link_id: XdpLinkId) -> Result, ProgramError> { + Ok(OwnedLink::new(self.data.take_link(link_id)?)) } } diff --git a/test/cases/010_load/030_unload/test.rs b/test/cases/010_load/030_unload/test.rs index eb88ad5cb..ed0d725ba 100755 --- a/test/cases/010_load/030_unload/test.rs +++ b/test/cases/010_load/030_unload/test.rs @@ -34,7 +34,7 @@ fn main() { let link = dispatcher.attach("eth0", XdpFlags::default()).unwrap(); { - let link_owned = dispatcher.forget_link(link); + let link_owned = dispatcher.take_link(link); dispatcher.unload().unwrap();