alloc.rs (c5fb51b71788926feef0d07f30c8af1d5e4af1a6) | alloc.rs (47cb6bf7860ce33bdd000198f8b65cf9fb3324b4) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2 3//! Implementation of the kernel's memory allocation infrastructure. 4 5#[cfg(not(any(test, testlib)))] 6pub mod allocator; 7pub mod kbox; 8pub mod kvec; --- 109 unchanged lines hidden (view full) --- 118/// The kernel's [`Allocator`] trait. 119/// 120/// An implementation of [`Allocator`] can allocate, re-allocate and free memory buffers described 121/// via [`Layout`]. 122/// 123/// [`Allocator`] is designed to be implemented as a ZST; [`Allocator`] functions do not operate on 124/// an object instance. 125/// | 1// SPDX-License-Identifier: GPL-2.0 2 3//! Implementation of the kernel's memory allocation infrastructure. 4 5#[cfg(not(any(test, testlib)))] 6pub mod allocator; 7pub mod kbox; 8pub mod kvec; --- 109 unchanged lines hidden (view full) --- 118/// The kernel's [`Allocator`] trait. 119/// 120/// An implementation of [`Allocator`] can allocate, re-allocate and free memory buffers described 121/// via [`Layout`]. 122/// 123/// [`Allocator`] is designed to be implemented as a ZST; [`Allocator`] functions do not operate on 124/// an object instance. 125/// |
126/// In order to be able to support `#[derive(SmartPointer)]` later on, we need to avoid a design | 126/// In order to be able to support `#[derive(CoercePointee)]` later on, we need to avoid a design |
127/// that requires an `Allocator` to be instantiated, hence its functions must not contain any kind 128/// of `self` parameter. 129/// 130/// # Safety 131/// 132/// - A memory allocation returned from an allocator must remain valid until it is explicitly freed. 133/// 134/// - Any pointer to a valid memory allocation must be valid to be passed to any other [`Allocator`] --- 90 unchanged lines hidden --- | 127/// that requires an `Allocator` to be instantiated, hence its functions must not contain any kind 128/// of `self` parameter. 129/// 130/// # Safety 131/// 132/// - A memory allocation returned from an allocator must remain valid until it is explicitly freed. 133/// 134/// - Any pointer to a valid memory allocation must be valid to be passed to any other [`Allocator`] --- 90 unchanged lines hidden --- |