Skip to content

Commit 941e655

Browse files
Danilo Krummrichojeda
authored andcommitted
rust: alloc: rename KernelAllocator to Kmalloc
Subsequent patches implement `Vmalloc` and `KVmalloc` allocators, hence align `KernelAllocator` to this naming scheme. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Danilo Krummrich <dakr@kernel.org> Link: https://lore.kernel.org/r/20241004154149.93856-4-dakr@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent a654a6e commit 941e655

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rust/kernel/alloc/allocator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use super::{flags::*, Flags};
66
use core::alloc::{GlobalAlloc, Layout};
77
use core::ptr;
88

9-
struct KernelAllocator;
9+
struct Kmalloc;
1010

1111
/// Returns a proper size to alloc a new object aligned to `new_layout`'s alignment.
1212
fn aligned_size(new_layout: Layout) -> usize {
@@ -37,7 +37,7 @@ pub(crate) unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layout, flags: F
3737
}
3838

3939
// SAFETY: TODO.
40-
unsafe impl GlobalAlloc for KernelAllocator {
40+
unsafe impl GlobalAlloc for Kmalloc {
4141
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
4242
// SAFETY: `ptr::null_mut()` is null and `layout` has a non-zero size by the function safety
4343
// requirement.
@@ -74,7 +74,7 @@ unsafe impl GlobalAlloc for KernelAllocator {
7474
}
7575

7676
#[global_allocator]
77-
static ALLOCATOR: KernelAllocator = KernelAllocator;
77+
static ALLOCATOR: Kmalloc = Kmalloc;
7878

7979
// See <https://github.com/rust-lang/rust/pull/86844>.
8080
#[no_mangle]

0 commit comments

Comments
 (0)