diff --git a/kernel/comps/console/src/font.rs b/kernel/comps/console/src/font.rs index 873dc0cf1..4ce3a4241 100644 --- a/kernel/comps/console/src/font.rs +++ b/kernel/comps/console/src/font.rs @@ -8,10 +8,7 @@ use font8x8::UnicodeFonts; /// A bitmap font. /// -/// Currently it's mainly used to draw texts on the framebuffer console. See -/// [`FramebufferConsole::set_font`]. -/// -/// [`FramebufferConsole::set_font`]: crate::FramebufferConsole::set_font +/// Currently it's mainly used to draw texts on the framebuffer console. #[derive(Debug)] pub struct BitmapFont { width: usize, diff --git a/kernel/comps/input/src/input_handler.rs b/kernel/comps/input/src/input_handler.rs index 12c9b7cd0..71fb446ff 100644 --- a/kernel/comps/input/src/input_handler.rs +++ b/kernel/comps/input/src/input_handler.rs @@ -27,7 +27,6 @@ pub enum ConnectError { /// /// [`register_handler_class`]: crate::register_handler_class /// [`connect`]: Self::connect -/// [`InputHandler`]: crate::InputHandler pub trait InputHandlerClass: Send + Sync + Any + Debug { /// Returns the class name of the handler class. fn name(&self) -> &str; diff --git a/kernel/comps/virtio/src/device/input/mod.rs b/kernel/comps/virtio/src/device/input/mod.rs index f90668a74..d1ffadf3d 100644 --- a/kernel/comps/virtio/src/device/input/mod.rs +++ b/kernel/comps/virtio/src/device/input/mod.rs @@ -34,7 +34,7 @@ use crate::transport::VirtioTransport; pub const DEVICE_NAME: &str = "Virtio-Input"; -/// Select value used for [`device::InputDevice::query_config_select()`]. +/// Select value used for `device::InputDevice::select_config`. #[repr(u8)] #[derive(Debug, Clone, Copy)] pub enum InputConfigSelect { diff --git a/kernel/libs/aster-bigtcp/src/iface/iface.rs b/kernel/libs/aster-bigtcp/src/iface/iface.rs index 6e6f0eca5..9b14079f5 100644 --- a/kernel/libs/aster-bigtcp/src/iface/iface.rs +++ b/kernel/libs/aster-bigtcp/src/iface/iface.rs @@ -64,15 +64,15 @@ impl dyn Iface { } /// Gets the IPv4 address of the iface, if any. - /// - /// FIXME: One iface may have multiple IPv4 addresses. + // + // FIXME: One iface may have multiple IPv4 addresses. pub fn ipv4_addr(&self) -> Option { self.common().ipv4_addr() } /// Retrieves the prefix length of the interface's IPv4 address. /// - /// Both [`Self::ipv4_addr`] and this method will either return `Some(_)` + /// Both `Self::ipv4_addr` and this method will either return `Some(_)` /// or both will return `None`. pub fn prefix_len(&self) -> Option { self.common().prefix_len() @@ -90,6 +90,8 @@ impl dyn Iface { } /// Returns a reference to the associated [`ScheduleNextPoll`]. + /// + /// [`ScheduleNextPoll`]: crate::iface::sched::ScheduleNextPoll pub fn sched_poll(&self) -> &E::ScheduleNextPoll { self.common().sched_poll() } diff --git a/kernel/libs/aster-bigtcp/src/lib.rs b/kernel/libs/aster-bigtcp/src/lib.rs index a20132563..8aa234cc1 100644 --- a/kernel/libs/aster-bigtcp/src/lib.rs +++ b/kernel/libs/aster-bigtcp/src/lib.rs @@ -12,6 +12,10 @@ #![no_std] #![deny(unsafe_code)] +// Rustdoc does not render methods of public type aliases that reference private types, +// so links pointing to them cannot be resolved. +// See . +#![expect(rustdoc::private_intra_doc_links)] pub mod boolean_value; pub mod device; diff --git a/kernel/libs/aster-util/src/mem_obj_slice.rs b/kernel/libs/aster-util/src/mem_obj_slice.rs index 67f86d39c..a7457622a 100644 --- a/kernel/libs/aster-util/src/mem_obj_slice.rs +++ b/kernel/libs/aster-util/src/mem_obj_slice.rs @@ -2,13 +2,13 @@ // SPDX-License-Identifier: MPL-2.0 -//! Provides [`MemObjSlice`] for quick duplication and slicing over memory +//! Provides [`Slice`] for quick duplication and slicing over memory //! objects, such as [`UFrame`], [`USegment`], [`IoMem`], [`DmaStream`], etc. //! //! [`UFrame`]: ostd::mm::UFrame //! [`USegment`]: ostd::mm::USegment //! [`IoMem`]: ostd::io::IoMem -//! [`DmaStream`]: ostd::mm::dma::DmaStream +//! [`DmaStream`]: ostd::mm::DmaStream use alloc::sync::Arc; use core::{borrow::Borrow, fmt::Debug, ops::Range}; diff --git a/kernel/src/fs/cgroupfs/systree_node.rs b/kernel/src/fs/cgroupfs/systree_node.rs index 007d30d36..f7b76bd51 100644 --- a/kernel/src/fs/cgroupfs/systree_node.rs +++ b/kernel/src/fs/cgroupfs/systree_node.rs @@ -223,6 +223,8 @@ pub struct CgroupNode { inner: RwMutex>, /// The depth of the node in the cgroupfs [`SysTree`], where the child of /// the root node has a depth of 1. + /// + /// [`SysTree`]: aster_systree::SysTree depth: usize, /// Tracks the "populated" status of this node and its direct children. /// diff --git a/kernel/src/fs/configfs/mod.rs b/kernel/src/fs/configfs/mod.rs index 1986ad1e1..868982973 100644 --- a/kernel/src/fs/configfs/mod.rs +++ b/kernel/src/fs/configfs/mod.rs @@ -26,6 +26,8 @@ pub(super) fn init() { /// /// If a subsystem with the same name has already been registered, /// this function returns an error. +/// +/// [`ConfigFs`]: fs::ConfigFs pub fn register_subsystem(subsystem: Arc) -> Result<()> { ConfigRootNode::singleton().add_child(subsystem)?; @@ -35,6 +37,8 @@ pub fn register_subsystem(subsystem: Arc) -> Result<()> { /// Unregisters a subsystem from the root node of [`ConfigFs`] by its name. /// /// If no subsystem with the given name exists, this function returns an error. +/// +/// [`ConfigFs`]: fs::ConfigFs #[expect(dead_code)] pub fn unregister_subsystem(name: &str) -> Result<()> { ConfigRootNode::singleton().remove_child(name)?; diff --git a/kernel/src/fs/file_table.rs b/kernel/src/fs/file_table.rs index e8945b8ac..10206e8f2 100644 --- a/kernel/src/fs/file_table.rs +++ b/kernel/src/fs/file_table.rs @@ -173,6 +173,7 @@ impl WithFileTable for FileTableRefMut<'_> { /// /// [`RefCell`]: core::cell::RefCell /// [`ThreadLocal`]: crate::process::posix_thread::ThreadLocal +/// [`RwArc::read`]: ostd::sync::RwArc::read macro_rules! get_file_fast { ($file_table:expr, $file_desc:expr) => {{ use alloc::borrow::Cow; diff --git a/kernel/src/fs/inode_handle/mod.rs b/kernel/src/fs/inode_handle/mod.rs index 8385d1ec1..a83e59885 100644 --- a/kernel/src/fs/inode_handle/mod.rs +++ b/kernel/src/fs/inode_handle/mod.rs @@ -309,9 +309,9 @@ pub trait FileIo: Pollable + InodeIo + Send + Sync + 'static { /// Returns whether the `read()`/`write()` operation should use and advance the offset. /// - /// If [`is_seekable`] succeeds but this method returns `false`, the offset in the `seek()` - /// operation will be ignored. In that case, the `seek()` operation will do nothing but - /// succeed. + /// If [`FileIo::check_seekable`] succeeds but this method returns `false`, + /// the offset in the `seek()` operation will be ignored. + /// In that case, the `seek()` operation will do nothing but succeed. fn is_offset_aware(&self) -> bool; // See `FileLike::mappable`. diff --git a/kernel/src/net/socket/netlink/message/attr/mod.rs b/kernel/src/net/socket/netlink/message/attr/mod.rs index 7931acec4..de68358a0 100644 --- a/kernel/src/net/socket/netlink/message/attr/mod.rs +++ b/kernel/src/net/socket/netlink/message/attr/mod.rs @@ -4,7 +4,7 @@ //! //! Netlink attributes provide additional information for each [`segment`]. //! Each netlink attribute consists of two components: -//! 1. Header: The attribute header is of type [`CNlAttrHeader`], +//! 1. Header: The attribute header is of type [`CAttrHeader`], //! which specifies the type and length of the attribute. The attribute //! type belongs to different classes, which rely on the segment type. //! 2. Payload: The attribute's payload, which can vary in type. @@ -12,7 +12,7 @@ //! The payload can also include one or multiple other attributes, //! known as nested attributes. //! -//! Similar to [`super::segment::NlSegment`], attributes have alignment requirements; +//! Similar to [`super::segment::common::SegmentCommon`], attributes have alignment requirements; //! both the header and payload must be aligned to [`super::NLMSG_ALIGN`] //! when being transferred to and from user space. //! diff --git a/kernel/src/net/socket/netlink/route/message/segment/mod.rs b/kernel/src/net/socket/netlink/route/message/segment/mod.rs index 69eb5539d..a5a994bc9 100644 --- a/kernel/src/net/socket/netlink/route/message/segment/mod.rs +++ b/kernel/src/net/socket/netlink/route/message/segment/mod.rs @@ -5,7 +5,7 @@ //! //! Typically, a segment will consist of three parts: //! -//! 1. Header: The headers of all segments are of type [`CMegSegHdr`], +//! 1. Header: The headers of all segments are of type [`CMsgSegHdr`], //! which indicate the type and total length of the segment. //! //! 2. Body: The body is the main component of a segment. @@ -19,7 +19,7 @@ //! The total number of attributes is controlled by the `len` field of the header. //! //! Note that all headers, bodies, and attributes require -//! their starting address in memory to be aligned to [`super::NLMSG_ALIGN`] +//! their starting address in memory to be aligned to [`NLMSG_ALIGN`] //! when copying to and from user space. //! Therefore, necessary padding must be added to ensure alignment. //! @@ -28,6 +28,8 @@ //! ┌────────┬─────────┬──────┬─────────┬──────┬──────┬──────┐ //! │ Header │ Padding │ Body │ Padding │ Attr │ Attr │ Attr │ //! └────────┴─────────┴──────┴─────────┴──────┴──────┴──────┘ +//! +//! [`NLMSG_ALIGN`]: crate::net::socket::netlink::message::NLMSG_ALIGN pub mod addr; mod legacy; diff --git a/kernel/src/process/posix_thread/futex.rs b/kernel/src/process/posix_thread/futex.rs index d5a3eb965..86be02311 100644 --- a/kernel/src/process/posix_thread/futex.rs +++ b/kernel/src/process/posix_thread/futex.rs @@ -156,7 +156,7 @@ pub fn futex_wake_bitset( /// +---+---+-----------+-----------+ /// 4 4 12 12 <== # of bits /// -/// Reference: https://man7.org/linux/man-pages/man2/futex.2.html. +/// Reference: . struct FutexWakeOpEncode { op: FutexWakeOp, /// A flag indicating that the operation will use `1 << oparg` diff --git a/kernel/src/process/process/mod.rs b/kernel/src/process/process/mod.rs index 13d61e59d..800ea13e9 100644 --- a/kernel/src/process/process/mod.rs +++ b/kernel/src/process/process/mod.rs @@ -790,10 +790,10 @@ impl Process { /// Returns a RCU read guard to the cgroup of the process. /// /// The returned cgroup is not a stable snapshot. It may be changed by other threads - /// and encounter race conditions. Users can use [`lock_cgroup_membership`] to obtain + /// and encounter race conditions. Users can use [`CgroupMembership`] to obtain /// a lock to prevent the cgroup from being changed. /// - /// [`lock_cgroup_membership`]: crate::fs::cgroupfs::lock_cgroup_membership + /// [`CgroupMembership`]: crate::fs::cgroupfs::CgroupMembership pub fn cgroup(&self) -> RcuOptionReadGuard<'_, Arc> { self.cgroup.read() } diff --git a/kernel/src/process/task_set.rs b/kernel/src/process/task_set.rs index f5a97daf6..a3297feb7 100644 --- a/kernel/src/process/task_set.rs +++ b/kernel/src/process/task_set.rs @@ -39,7 +39,7 @@ impl TaskSet { /// Inserts a new task to the task set. /// - /// This method will fail if [`Self::set_exited_group`] or [`Self::set_in_execve`] + /// This method will fail if [`Self::set_exited_group`] or [`Self::start_execve`] /// has been called before. pub(super) fn insert(&mut self, task: Arc) -> core::result::Result<(), Arc> { if self.has_exited_group || self.in_execve { diff --git a/kernel/src/sched/sched_class/real_time.rs b/kernel/src/sched/sched_class/real_time.rs index b2cdd3aa1..694fdd3f6 100644 --- a/kernel/src/sched/sched_class/real_time.rs +++ b/kernel/src/sched/sched_class/real_time.rs @@ -62,6 +62,8 @@ impl RealTimePolicy { /// - If the time slice is set, the thread is considered to be an RR /// (round-robin) thread, and will be executed for the time slice, and /// then it will be put back to the inactive array. +/// +/// [`sched_clock`]: super::sched_clock #[derive(Debug)] pub struct RealTimeAttr { prio: AtomicU8, diff --git a/kernel/src/syscall/clock_gettime.rs b/kernel/src/syscall/clock_gettime.rs index b5370e76c..c246bdc15 100644 --- a/kernel/src/syscall/clock_gettime.rs +++ b/kernel/src/syscall/clock_gettime.rs @@ -65,7 +65,7 @@ pub enum ClockId { /// - Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3. /// - A clock ID is invalid if bits 2, 1, and 0 are all set. /// -/// Ref: https://github.com/torvalds/linux/blob/master/include/linux/posix-timers_types.h +/// Ref: . pub enum DynamicClockIdInfo { Pid(u32, DynamicClockType), Tid(u32, DynamicClockType), diff --git a/kernel/src/syscall/signalfd.rs b/kernel/src/syscall/signalfd.rs index b0994b12f..312d7b0b6 100644 --- a/kernel/src/syscall/signalfd.rs +++ b/kernel/src/syscall/signalfd.rs @@ -4,7 +4,7 @@ //! //! The signalfd mechanism allows receiving signals via file descriptor, //! enabling better integration with event loops. -//! See https://man7.org/linux/man-pages/man2/signalfd.2.html +//! See . use core::{ fmt::Display, diff --git a/kernel/src/syscall/utimens.rs b/kernel/src/syscall/utimens.rs index f6381d26c..21e85e786 100644 --- a/kernel/src/syscall/utimens.rs +++ b/kernel/src/syscall/utimens.rs @@ -17,8 +17,8 @@ use crate::{ }; /// The 'sys_utimensat' system call sets the access and modification times of a file. -/// The times are defined by an array of two timespec structures, where times[0] represents the access time, -/// and times[1] represents the modification time. +/// The times are defined by an array of two timespec structures, where `times[0]` represents the access time, +/// and `times[1]` represents the modification time. /// The `flags` argument is a bit mask that can include the following values: /// - `AT_SYMLINK_NOFOLLOW`: If set, the file is not dereferenced if it is a symbolic link. pub fn sys_utimensat( diff --git a/kernel/src/thread/exception.rs b/kernel/src/thread/exception.rs index 91c4dba7a..61019beb7 100644 --- a/kernel/src/thread/exception.rs +++ b/kernel/src/thread/exception.rs @@ -16,10 +16,10 @@ use crate::{ vm::{perms::VmPerms, vmar::Vmar}, }; -/// Page fault information converted from [`CpuExceptionInfo`]. +/// Page fault information converted from [`CpuException`]. /// -/// `From` should be implemented for this struct. -/// If `CpuExceptionInfo` is a page fault, `try_from` should return `Ok(PageFaultInfo)`, +/// `From` should be implemented for this struct. +/// If [`CpuException`] is a page fault, `try_from` should return `Ok(PageFaultInfo)`, /// or `Err(())` (no error information) otherwise. pub struct PageFaultInfo { /// The virtual address where a page fault occurred. diff --git a/kernel/src/time/core/timer.rs b/kernel/src/time/core/timer.rs index 1d5fc96e0..ed35991f9 100644 --- a/kernel/src/time/core/timer.rs +++ b/kernel/src/time/core/timer.rs @@ -28,7 +28,7 @@ pub enum Timeout { /// /// Setting the timer will trigger a callback function upon expiration of /// the set time. To enable its periodic functionality, users should set -/// its `interval` field with [`Timer::set_interval`]. By doing this, +/// its `interval` field with [`TimerGuard::set_interval`]. By doing this, /// the timer will use the interval time to configure a new timing after expiration. pub struct Timer { inner: SpinLock, diff --git a/kernel/src/util/net/options/ip.rs b/kernel/src/util/net/options/ip.rs index 68dad3b5c..c52a5789d 100644 --- a/kernel/src/util/net/options/ip.rs +++ b/kernel/src/util/net/options/ip.rs @@ -13,7 +13,7 @@ use crate::{ /// Socket options for IP socket. /// /// The raw definitions can be found at: -/// https://elixir.bootlin.com/linux/v6.0.19/source/include/uapi/linux/in.h#L94 +/// . #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt)] #[expect(non_camel_case_types)] diff --git a/kernel/src/util/net/options/socket.rs b/kernel/src/util/net/options/socket.rs index b324972d0..484559152 100644 --- a/kernel/src/util/net/options/socket.rs +++ b/kernel/src/util/net/options/socket.rs @@ -15,7 +15,7 @@ use crate::{ /// Socket level options. /// -/// The definition is from https://elixir.bootlin.com/linux/v6.0.9/source/include/uapi/asm-generic/socket.h. +/// The definition is from . #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt, PartialEq, Eq, PartialOrd, Ord)] #[expect(non_camel_case_types)] diff --git a/kernel/src/util/net/options/tcp.rs b/kernel/src/util/net/options/tcp.rs index fded518b7..274aa2678 100644 --- a/kernel/src/util/net/options/tcp.rs +++ b/kernel/src/util/net/options/tcp.rs @@ -13,7 +13,7 @@ use crate::{ /// Sock options for tcp socket. /// -/// The raw definition is from https://elixir.bootlin.com/linux/v6.0.9/source/include/uapi/linux/tcp.h#L92 +/// The raw definition is from . #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt)] #[expect(non_camel_case_types)] diff --git a/kernel/src/util/net/socket.rs b/kernel/src/util/net/socket.rs index fee48d4ed..bacf1d78e 100644 --- a/kernel/src/util/net/socket.rs +++ b/kernel/src/util/net/socket.rs @@ -11,7 +11,7 @@ use crate::{ }; /// Standard well-defined IP protocols. -/// From https://elixir.bootlin.com/linux/v6.0.9/source/include/uapi/linux/in.h. +/// From . #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt)] #[expect(non_camel_case_types)] @@ -45,7 +45,7 @@ pub enum Protocol { } /// Socket types. -/// From https://elixir.bootlin.com/linux/v6.0.9/source/include/linux/net.h +/// From . #[repr(i32)] #[expect(non_camel_case_types)] #[derive(Debug, Clone, Copy, TryFromInt)] diff --git a/kernel/src/vm/vmar/vm_mapping.rs b/kernel/src/vm/vmar/vm_mapping.rs index ff0db0032..59d4f7676 100644 --- a/kernel/src/vm/vmar/vm_mapping.rs +++ b/kernel/src/vm/vmar/vm_mapping.rs @@ -45,6 +45,8 @@ use crate::{ /// /// This type controls the actual mapping in the [`VmSpace`]. It is a linear /// type and cannot be [`Drop`]. To remove a mapping, use [`Self::unmap`]. +/// +/// [`Vmar`]: crate::vm::vmar::Vmar #[derive(Debug)] pub struct VmMapping { /// The size of mapping, in bytes. The map size can even be larger than the @@ -856,6 +858,8 @@ impl Drop for MappedVmo { /// remove the original mappings before inserting the merged mapping /// into the [`Vmar`]. /// - Returns `None` otherwise. +/// +/// [`Vmar`]: crate::vm::vmar::Vmar fn try_merge(left: &VmMapping, right: &VmMapping) -> Option { let is_adjacent = left.map_end() == right.map_to_addr(); let is_type_equal = left.is_shared == right.is_shared diff --git a/kernel/src/vm/vmar/vmar_impls/remap.rs b/kernel/src/vm/vmar/vmar_impls/remap.rs index f1c7da9a6..130ea93fd 100644 --- a/kernel/src/vm/vmar/vmar_impls/remap.rs +++ b/kernel/src/vm/vmar/vmar_impls/remap.rs @@ -23,6 +23,8 @@ impl Vmar { /// mapping does not have to solely map to a whole [`VmMapping`], but it /// must ensure that all existing ranges have a mapping. Otherwise, this /// method will return an `Err`. + /// + /// [`VmMapping`]: crate::vm::vmar::vm_mapping::VmMapping pub fn resize_mapping( &self, map_addr: Vaddr,