From ba312c48d561b5a414cdd1301c322266e38118a4 Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Fri, 20 May 2022 19:14:06 +0100 Subject: [PATCH] xtask: Add all crates to sidebar Signed-off-by: Dave Tucker --- aya/src/programs/cgroup_sock_addr.rs | 14 +++++++------- xtask/src/docs/mod.rs | 9 ++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/aya/src/programs/cgroup_sock_addr.rs b/aya/src/programs/cgroup_sock_addr.rs index 9593dfea..e8c5d908 100644 --- a/aya/src/programs/cgroup_sock_addr.rs +++ b/aya/src/programs/cgroup_sock_addr.rs @@ -17,9 +17,9 @@ use crate::{ /// A program that can be used to inspect or modify socket addresses (`struct sockaddr`). /// -/// [`SockAddr`] programs can be used to inspect or modify socket addresses passed to +/// [`CgroupSockAddr`] programs can be used to inspect or modify socket addresses passed to /// various syscalls within a [cgroup]. They can be attached to a number of different -/// places as described in [`SockAddrAttachType`]. +/// places as described in [`CgroupSockAddrAttachType`]. /// /// [cgroup]: https://man7.org/linux/man-pages/man7/cgroups.7.html /// @@ -68,7 +68,7 @@ impl CgroupSockAddr { /// Attaches the program to the given cgroup. /// - /// The returned value can be used to detach, see [SockAddr::detach]. + /// The returned value can be used to detach, see [CgroupSockAddr::detach]. pub fn attach(&mut self, cgroup: T) -> Result { let prog_fd = self.data.fd_or_err()?; let cgroup_fd = cgroup.as_raw_fd(); @@ -115,7 +115,7 @@ impl CgroupSockAddr { /// Detaches the program. /// - /// See [SockAddr::attach]. + /// See [CgroupSockAddr::attach]. pub fn detach(&mut self, link_id: CgroupSockAddrLinkId) -> Result<(), ProgramError> { self.data.links.remove(link_id) } @@ -152,15 +152,15 @@ impl Link for CgroupSockAddrLinkInner { } define_link_wrapper!( - /// The link used by [SockAddr] programs. + /// The link used by [CgroupSockAddr] programs. CgroupSockAddrLink, - /// The type returned by [SockAddr::attach]. Can be passed to [SockAddr::detach]. + /// The type returned by [CgroupSockAddr::attach]. Can be passed to [CgroupSockAddr::detach]. CgroupSockAddrLinkId, CgroupSockAddrLinkInner, CgroupSockAddrLinkIdInner ); -/// Defines where to attach a [`SockAddr`] program. +/// Defines where to attach a [`CgroupSockAddr`] program. #[derive(Copy, Clone, Debug)] pub enum CgroupSockAddrAttachType { /// Attach to IPv4 bind events. diff --git a/xtask/src/docs/mod.rs b/xtask/src/docs/mod.rs index cd48de24..7cc0922d 100644 --- a/xtask/src/docs/mod.rs +++ b/xtask/src/docs/mod.rs @@ -3,7 +3,7 @@ use std::{ process::Command, }; -use std::{fs, io}; +use std::{fs, io, io::Write}; pub fn docs() -> Result<(), anyhow::Error> { let mut working_dir = PathBuf::from("."); @@ -33,6 +33,13 @@ pub fn docs() -> Result<(), anyhow::Error> { copy_dir_all("./bpf/target/doc", "./target/doc")?; + let crates_js = b"window.ALL_CRATES = [\"aya\", \"aya_bpf\", \"aya_bpf_bindings\", \"aya_bpf_cty\", \"aya_bpf_macros\", \"aya_gen\"];\n"; + let mut file = fs::File::options() + .read(true) + .write(true) + .open("./target/doc/crates.js")?; + file.write_all(crates_js)?; + Ok(()) }