Skip to content

Commit 008c963

Browse files
Danilo Krummrichfbq
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/20240911225449.152928-4-dakr@kernel.org
1 parent 1b11f25 commit 008c963

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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
/// Calls `krealloc` with a proper size to alloc a new object aligned to `new_layout`'s alignment.
1212
///
@@ -31,7 +31,7 @@ pub(crate) unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layout, flags: F
3131
unsafe { bindings::krealloc(ptr as *const core::ffi::c_void, size, flags.0) as *mut u8 }
3232
}
3333

34-
unsafe impl GlobalAlloc for KernelAllocator {
34+
unsafe impl GlobalAlloc for Kmalloc {
3535
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
3636
// SAFETY: `ptr::null_mut()` is null and `layout` has a non-zero size by the function safety
3737
// requirement.
@@ -67,7 +67,7 @@ unsafe impl GlobalAlloc for KernelAllocator {
6767
}
6868

6969
#[global_allocator]
70-
static ALLOCATOR: KernelAllocator = KernelAllocator;
70+
static ALLOCATOR: Kmalloc = Kmalloc;
7171

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

0 commit comments

Comments
 (0)