From 30e200f4ae54a2216418bd43512e8024c4bf82e5 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Sun, 6 Apr 2025 11:58:32 +0200 Subject: [PATCH] base/ram.h: rename Unmapped... to Constrained... The 'Allocation' template clears the way for precisely differentiating allocators via (a variety of) C++ types. It turns out that this approach alleviate the need to consider the differentiation between mapped/unmapped in ram.h. With the new approach, a mapped allocator can be built as a template taking a ram allocator (constrained/unconstrained) and a local region-map (core local_rm, env local_rm) as ingredients. Since the differentiation between constrained/unconstrained has its natural place at ram.h, name the current RAM allocator 'Ram::Constrained_allocator', in anticipation of a future 'Ram::Unconstrained_allocator' with weakened error conditions. Issue #5502 --- repos/base/include/base/ram.h | 8 ++++---- repos/base/include/base/ram_allocator.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/repos/base/include/base/ram.h b/repos/base/include/base/ram.h index 9d6c0f3eb9..c4d16a5c0e 100644 --- a/repos/base/include/base/ram.h +++ b/repos/base/include/base/ram.h @@ -28,7 +28,7 @@ namespace Genode::Ram { using Capability = Genode::Capability; using Error = Alloc_error; - struct Unmapped_allocator; + struct Constrained_allocator; template struct Accounted_allocator; } @@ -37,7 +37,7 @@ namespace Genode::Ram { /** * Allocator of RAM inaccessible by the component at allocation time */ -struct Genode::Ram::Unmapped_allocator : Interface, Noncopyable +struct Genode::Ram::Constrained_allocator : Interface, Noncopyable { struct Attr { @@ -46,7 +46,7 @@ struct Genode::Ram::Unmapped_allocator : Interface, Noncopyable }; using Error = Ram::Error; - using Allocation = Genode::Allocation; + using Allocation = Genode::Allocation; using Result = Allocation::Attempt; virtual Result try_alloc(size_t size, Cache cache = CACHED) = 0; @@ -136,7 +136,7 @@ struct Genode::Ram::Accounted_allocator : ALLOC namespace Genode::Ram { /* shortcuts for the most commonly used type of allocator */ - using Allocator = Unmapped_allocator; + using Allocator = Constrained_allocator; using Allocation = Allocator::Allocation; } diff --git a/repos/base/include/base/ram_allocator.h b/repos/base/include/base/ram_allocator.h index b7ffe9e704..934aff2e0c 100644 --- a/repos/base/include/base/ram_allocator.h +++ b/repos/base/include/base/ram_allocator.h @@ -29,7 +29,7 @@ namespace Genode { } -struct Genode::Ram_allocator : Ram::Unmapped_allocator +struct Genode::Ram_allocator : Ram::Constrained_allocator { /** * Allocate RAM @@ -71,7 +71,7 @@ struct Genode::Ram_allocator : Ram::Unmapped_allocator } /* type aliases used for API transition */ - using Alloc_result = Ram::Unmapped_allocator::Result; + using Alloc_result = Ram::Constrained_allocator::Result; using Alloc_error = Ram::Error; using Denied = Genode::Denied; };