Skip to content

Commit

Permalink
doc(aya): Improve the description of take_link methods
Browse files Browse the repository at this point in the history
Don't mix the tenses.
  • Loading branch information
vadorovsky committed Nov 24, 2024
1 parent bf2164c commit 85c73af
Show file tree
Hide file tree
Showing 24 changed files with 91 additions and 72 deletions.
7 changes: 4 additions & 3 deletions aya/src/programs/cgroup_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ impl CgroupDevice {
}
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`CgroupDeviceLink`] is dropped, the link is
/// detached.
pub fn take_link(
&mut self,
link_id: CgroupDeviceLinkId,
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/cgroup_skb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ impl CgroupSkb {
}
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`CgroupSkbLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: CgroupSkbLinkId) -> Result<CgroupSkbLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/cgroup_sock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ impl CgroupSock {
}
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`CgroupSockLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: CgroupSockLinkId) -> Result<CgroupSockLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/cgroup_sock_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ impl CgroupSockAddr {
}
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`CgroupSockAddrLink`] is dropped, the link is
/// detached.
pub fn take_link(
&mut self,
link_id: CgroupSockAddrLinkId,
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/cgroup_sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ impl CgroupSockopt {
}
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`CgroupSockoptLink`] is dropped, the link is
/// detached.
pub fn take_link(
&mut self,
link_id: CgroupSockoptLinkId,
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/cgroup_sysctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ impl CgroupSysctl {
}
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`CgroupSysctlLink`] is dropped, the link is
/// detached.
pub fn take_link(
&mut self,
link_id: CgroupSysctlLinkId,
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ impl Extension {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`ExtensionLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: ExtensionLinkId) -> Result<ExtensionLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/fentry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ impl FEntry {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`FEntryLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: FEntryLinkId) -> Result<FEntryLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
6 changes: 3 additions & 3 deletions aya/src/programs/fexit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ impl FExit {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned `FExitLink` is dropped, the link is detached.
pub fn take_link(&mut self, link_id: FExitLinkId) -> Result<FExitLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/kprobe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ impl KProbe {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`KProbeLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: KProbeLinkId) -> Result<KProbeLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
6 changes: 3 additions & 3 deletions aya/src/programs/lirc_mode2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ impl LircMode2 {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`LircLink`] is dropped, the link is detached.
pub fn take_link(&mut self, link_id: LircLinkId) -> Result<LircLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
6 changes: 3 additions & 3 deletions aya/src/programs/lsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ impl Lsm {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`LsmLink`] is dropped, the link is detached.
pub fn take_link(&mut self, link_id: LsmLinkId) -> Result<LsmLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/perf_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,11 @@ impl PerfEvent {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`PerfEventLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: PerfEventLinkId) -> Result<PerfEventLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/raw_trace_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ impl RawTracePoint {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`RawTracePointLink`] is dropped, the link is
/// detached.
pub fn take_link(
&mut self,
link_id: RawTracePointLinkId,
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/sk_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ impl SkLookup {
.insert(SkLookupLink::new(FdLink::new(link_fd)))
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`SkLookupLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: SkLookupLinkId) -> Result<SkLookupLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/sk_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ impl SkMsg {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`SkMsgLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: SkMsgLinkId) -> Result<SkMsgLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
6 changes: 3 additions & 3 deletions aya/src/programs/sk_skb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ impl SkSkb {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`SkSkbLink`] is dropped, the link is detached.
pub fn take_link(&mut self, link_id: SkSkbLinkId) -> Result<SkSkbLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/sock_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ impl SockOps {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`SockOpsLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: SockOpsLinkId) -> Result<SockOpsLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/socket_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ impl SocketFilter {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`SocketFilterLink`] is dropped, the link is
/// detached.
pub fn take_link(
&mut self,
link_id: SocketFilterLinkId,
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/tc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@ impl SchedClassifier {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`SchedClassifierLink`] is dropped, the link is
/// detached.
pub fn take_link(
&mut self,
link_id: SchedClassifierLinkId,
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/tp_btf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ impl BtfTracePoint {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`BtfTracePointLink`] is dropped, the link is
/// detached.
pub fn take_link(
&mut self,
link_id: BtfTracePointLinkId,
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/trace_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ impl TracePoint {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`TracePointLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: TracePointLinkId) -> Result<TracePointLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
7 changes: 4 additions & 3 deletions aya/src/programs/uprobe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ impl UProbe {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`UProbeLink`] is dropped, the link is
/// detached.
pub fn take_link(&mut self, link_id: UProbeLinkId) -> Result<UProbeLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down
6 changes: 3 additions & 3 deletions aya/src/programs/xdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ impl Xdp {
self.data.links.remove(link_id)
}

/// Takes ownership of the link referenced by the provided link_id.
/// Takes ownership of the link referenced by the provided `link_id`.
///
/// The link will be detached on `Drop` and the caller is now responsible
/// for managing its lifetime.
/// The caller takes the responsibility of managing the lifetime of the
/// link. When the returned [`XdpLink`] is dropped, the link is detached.
pub fn take_link(&mut self, link_id: XdpLinkId) -> Result<XdpLink, ProgramError> {
self.data.take_link(link_id)
}
Expand Down

0 comments on commit 85c73af

Please sign in to comment.