mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
base: use 'Ram_quota' in 'Ram_session' args
This patch replaces the former use of size_t with the use of the 'Ram_quota' type to improve type safety (in particular to avoid accidentally mixing up RAM quotas with cap quotas). Issue #2398
This commit is contained in:
committed by
Christian Helmuth
parent
ff68d77c7d
commit
58f44d39c5
@@ -94,22 +94,22 @@ namespace Genode {
|
||||
return RAM_SESSION_IMPL::ref_account(session);
|
||||
}
|
||||
|
||||
int transfer_quota(Ram_session_capability session, size_t size)
|
||||
int transfer_quota(Ram_session_capability session, Ram_quota size)
|
||||
{
|
||||
Lock::Guard lock_guard(_lock);
|
||||
return RAM_SESSION_IMPL::transfer_quota(session, size);
|
||||
}
|
||||
|
||||
size_t quota()
|
||||
Ram_quota ram_quota() const override
|
||||
{
|
||||
Lock::Guard lock_guard(_lock);
|
||||
return RAM_SESSION_IMPL::quota();
|
||||
return RAM_SESSION_IMPL::ram_quota();
|
||||
}
|
||||
|
||||
size_t used()
|
||||
Ram_quota used_ram() const override
|
||||
{
|
||||
Lock::Guard lock_guard(_lock);
|
||||
return RAM_SESSION_IMPL::used();
|
||||
return RAM_SESSION_IMPL::used_ram();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -91,11 +91,11 @@ struct Stack_area_ram_session : Genode::Ram_session
|
||||
|
||||
int ref_account(Genode::Ram_session_capability) override { return 0; }
|
||||
|
||||
int transfer_quota(Genode::Ram_session_capability, Genode::size_t) override { return 0; }
|
||||
int transfer_quota(Genode::Ram_session_capability, Genode::Ram_quota) override { return 0; }
|
||||
|
||||
Genode::size_t quota() override { return 0; }
|
||||
Genode::Ram_quota ram_quota() const override { return { 0 }; }
|
||||
|
||||
Genode::size_t used() override { return 0; }
|
||||
Genode::Ram_quota used_ram() const override { return { 0 }; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user