Browse Source

aya: Rename forget_link to take_link

Signed-off-by: Dave Tucker <[email protected]>
Dave Tucker 2 years ago
parent
commit
b2a6f00212

+ 2 - 2
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<OwnedLink<CgroupSkbLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 
     /// Detaches the program.

+ 2 - 2
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<OwnedLink<CgroupSockAddrLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 
     /// Detaches the program.

+ 2 - 2
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<OwnedLink<CgroupSockoptLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 
     /// Detaches the program.

+ 2 - 2
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<OwnedLink<CgroupSysctlLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 
     /// Detaches the program.

+ 2 - 2
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<OwnedLink<ExtensionLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<FEntryLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<FExitLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<KProbeLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 5
aya/src/programs/lirc_mode2.rs

@@ -86,11 +86,8 @@ impl LircMode2 {
     ///
     /// 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: LircLinkId,
-    ) -> Result<OwnedLink<LircLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+    pub fn take_link(&mut self, link_id: LircLinkId) -> Result<OwnedLink<LircLink>, ProgramError> {
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 
     /// Queries the lirc device for attached programs.

+ 2 - 2
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<OwnedLink<LsmLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+    pub fn take_link(&mut self, link_id: LsmLinkId) -> Result<OwnedLink<LsmLink>, ProgramError> {
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
aya/src/programs/mod.rs

@@ -381,7 +381,7 @@ impl<T: Link> ProgramData<T> {
         Ok(())
     }
 
-    pub(crate) fn forget_link(&mut self, link_id: T::Id) -> Result<T, ProgramError> {
+    pub(crate) fn take_link(&mut self, link_id: T::Id) -> Result<T, ProgramError> {
         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)

+ 2 - 5
aya/src/programs/perf_event.rs

@@ -182,10 +182,7 @@ impl PerfEvent {
     ///
     /// 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: PerfLinkId,
-    ) -> Result<OwnedLink<PerfLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+    pub fn take_link(&mut self, link_id: PerfLinkId) -> Result<OwnedLink<PerfLink>, ProgramError> {
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }

+ 2 - 2
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<OwnedLink<RawTracePointLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<SkLookupLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 
     /// Detaches the program.

+ 2 - 2
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<OwnedLink<SkMsgLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<SkSkbLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<SockOpsLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<SocketFilterLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<SchedClassifierLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<BtfTracePointLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<TracePointLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<UProbeLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 2 - 2
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<OwnedLink<XdpLink>, ProgramError> {
-        Ok(OwnedLink::new(self.data.forget_link(link_id)?))
+    pub fn take_link(&mut self, link_id: XdpLinkId) -> Result<OwnedLink<XdpLink>, ProgramError> {
+        Ok(OwnedLink::new(self.data.take_link(link_id)?))
     }
 }
 

+ 1 - 1
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();