Merge pull request #273 from dave-tucker/fix_sidebar

xtask: Add all crates to sidebar
pull/274/head^2
Dave Tucker 3 years ago committed by GitHub
commit 9904237ac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,9 +17,9 @@ use crate::{
/// A program that can be used to inspect or modify socket addresses (`struct sockaddr`). /// 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 /// 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 /// [cgroup]: https://man7.org/linux/man-pages/man7/cgroups.7.html
/// ///
@ -68,7 +68,7 @@ impl CgroupSockAddr {
/// Attaches the program to the given cgroup. /// 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<T: AsRawFd>(&mut self, cgroup: T) -> Result<CgroupSockAddrLinkId, ProgramError> { pub fn attach<T: AsRawFd>(&mut self, cgroup: T) -> Result<CgroupSockAddrLinkId, ProgramError> {
let prog_fd = self.data.fd_or_err()?; let prog_fd = self.data.fd_or_err()?;
let cgroup_fd = cgroup.as_raw_fd(); let cgroup_fd = cgroup.as_raw_fd();
@ -115,7 +115,7 @@ impl CgroupSockAddr {
/// Detaches the program. /// Detaches the program.
/// ///
/// See [SockAddr::attach]. /// See [CgroupSockAddr::attach].
pub fn detach(&mut self, link_id: CgroupSockAddrLinkId) -> Result<(), ProgramError> { pub fn detach(&mut self, link_id: CgroupSockAddrLinkId) -> Result<(), ProgramError> {
self.data.links.remove(link_id) self.data.links.remove(link_id)
} }
@ -152,15 +152,15 @@ impl Link for CgroupSockAddrLinkInner {
} }
define_link_wrapper!( define_link_wrapper!(
/// The link used by [SockAddr] programs. /// The link used by [CgroupSockAddr] programs.
CgroupSockAddrLink, 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, CgroupSockAddrLinkId,
CgroupSockAddrLinkInner, CgroupSockAddrLinkInner,
CgroupSockAddrLinkIdInner CgroupSockAddrLinkIdInner
); );
/// Defines where to attach a [`SockAddr`] program. /// Defines where to attach a [`CgroupSockAddr`] program.
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub enum CgroupSockAddrAttachType { pub enum CgroupSockAddrAttachType {
/// Attach to IPv4 bind events. /// Attach to IPv4 bind events.

@ -3,7 +3,7 @@ use std::{
process::Command, process::Command,
}; };
use std::{fs, io}; use std::{fs, io, io::Write};
pub fn docs() -> Result<(), anyhow::Error> { pub fn docs() -> Result<(), anyhow::Error> {
let mut working_dir = PathBuf::from("."); let mut working_dir = PathBuf::from(".");
@ -33,6 +33,13 @@ pub fn docs() -> Result<(), anyhow::Error> {
copy_dir_all("./bpf/target/doc", "./target/doc")?; 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(()) Ok(())
} }

Loading…
Cancel
Save