mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-20 09:02:09 +00:00
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
This commit is contained in:
parent
08010003e3
commit
30e200f4ae
repos/base/include/base
@ -28,7 +28,7 @@ namespace Genode::Ram {
|
||||
using Capability = Genode::Capability<Dataspace>;
|
||||
using Error = Alloc_error;
|
||||
|
||||
struct Unmapped_allocator;
|
||||
struct Constrained_allocator;
|
||||
|
||||
template <typename> 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<Unmapped_allocator>;
|
||||
using Allocation = Genode::Allocation<Constrained_allocator>;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user