From 6609aafb050255aea5a2559837498216757a301a Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 8 May 2017 14:32:03 +0200 Subject: [PATCH] Replace Quota_exceeded by Insufficient_ram_quota This patch replaces the 'Parent::Quota_exceeded', 'Service::Quota_exceeded', and 'Root::Quota_exceeded' exceptions by the single 'Insufficient_ram_quota' exception type. Furthermore, the 'Parent' interface distinguished now between 'Out_of_ram' (the child's RAM is exhausted) from 'Insufficient_ram_quota' (the child's RAM donation does not suffice to establish the session). This eliminates ambiguities and removes the need to convert exception types along the path of the session creation. Issue #2398 --- repos/base-hw/src/core/platform_pd.cc | 2 +- .../virtualization/vm_session_component.cc | 2 +- .../core/spec/arm_v7/vm_session_component.cc | 2 +- .../include/base/attached_io_mem_dataspace.h | 2 +- repos/base/include/base/env.h | 5 +- repos/base/include/base/local_connection.h | 4 +- repos/base/include/base/service.h | 21 ++++---- repos/base/include/base/session_state.h | 4 +- repos/base/include/parent/parent.h | 23 ++++----- repos/base/include/root/component.h | 4 +- repos/base/include/root/root.h | 5 +- repos/base/src/core/include/core_parent.h | 2 +- repos/base/src/core/include/cpu_root.h | 2 +- .../base/internal/expanding_parent_client.h | 2 +- repos/base/src/lib/base/child.cc | 49 ++++++++++--------- repos/base/src/lib/base/component.cc | 4 +- repos/base/src/lib/base/root_proxy.cc | 4 +- repos/base/src/lib/base/session_state.cc | 20 ++++---- repos/dde_bsd/src/drivers/audio/main.cc | 4 +- .../src/lib/usb/include/usb_nic_component.h | 4 +- repos/dde_linux/src/lib/usb/raw/raw.cc | 6 +-- repos/dde_linux/src/lib/wifi/nic.cc | 2 +- repos/dde_rump/src/server/rump_fs/main.cc | 2 +- repos/libports/src/server/ffat_fs/main.cc | 2 +- .../src/server/fuse_fs/fuse_fs_main.cc | 2 +- repos/os/include/block/component.h | 4 +- repos/os/include/gpio/component.h | 2 +- repos/os/include/nic/root.h | 4 +- repos/os/include/os/attached_mmio.h | 2 +- .../os/include/os/child_policy_dynamic_rom.h | 2 +- repos/os/include/os/slave.h | 4 +- repos/os/include/regulator/component.h | 2 +- repos/os/include/report_rom/report_service.h | 2 +- repos/os/src/drivers/ahci/main.cc | 2 +- repos/os/src/drivers/audio/spec/linux/main.cc | 2 +- repos/os/src/drivers/nic/spec/pbxa9/main.cc | 4 +- .../platform/spec/x86/pci_session_component.h | 4 +- .../drivers/timer/include/root_component.h | 2 +- repos/os/src/init/server.cc | 10 ++-- repos/os/src/server/fs_log/main.cc | 2 +- repos/os/src/server/iso9660/iso9660.cc | 2 +- repos/os/src/server/iso9660/main.cc | 2 +- repos/os/src/server/lx_fs/main.cc | 2 +- repos/os/src/server/mixer/mixer.cc | 2 +- repos/os/src/server/nic_bridge/component.h | 4 +- repos/os/src/server/nic_dump/component.cc | 4 +- repos/os/src/server/nic_loopback/main.cc | 4 +- repos/os/src/server/nic_router/component.cc | 4 +- repos/os/src/server/nitpicker/main.cc | 2 +- repos/os/src/server/part_blk/component.h | 4 +- repos/os/src/server/ram_fs/main.cc | 2 +- repos/os/src/server/terminal_log/main.cc | 2 +- repos/os/src/server/trace_fs/main.cc | 2 +- repos/os/src/server/vfs/main.cc | 2 +- repos/ports/src/app/openvpn/main.cc | 4 +- 55 files changed, 135 insertions(+), 134 deletions(-) diff --git a/repos/base-hw/src/core/platform_pd.cc b/repos/base-hw/src/core/platform_pd.cc index 930511357..cd434c251 100644 --- a/repos/base-hw/src/core/platform_pd.cc +++ b/repos/base-hw/src/core/platform_pd.cc @@ -38,7 +38,7 @@ void * Hw::Address_space::_table_alloc() void * ret; if (!_cma()->alloc_aligned(sizeof(Page_table), (void**)&ret, Page_table::ALIGNM_LOG2).ok()) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); return ret; } diff --git a/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.cc b/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.cc index c29320a68..ef781b4a6 100644 --- a/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.cc +++ b/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.cc @@ -83,7 +83,7 @@ void * Vm_session_component::_alloc_table() if (!cma()->alloc_aligned(sizeof(Table), (void**)&table, Table::ALIGNM_LOG2).ok()) { error("failed to allocate kernel object"); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return table; } diff --git a/repos/base-hw/src/core/spec/arm_v7/vm_session_component.cc b/repos/base-hw/src/core/spec/arm_v7/vm_session_component.cc index 0356a2e14..a1564c42a 100644 --- a/repos/base-hw/src/core/spec/arm_v7/vm_session_component.cc +++ b/repos/base-hw/src/core/spec/arm_v7/vm_session_component.cc @@ -24,7 +24,7 @@ addr_t Vm_session_component::_alloc_ds(size_t &ram_quota) if (_ds_size() > ram_quota || platform()->ram_alloc()->alloc_aligned(_ds_size(), (void**)&addr, get_page_size_log2()).error()) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); ram_quota -= _ds_size(); return addr; } diff --git a/repos/base/include/base/attached_io_mem_dataspace.h b/repos/base/include/base/attached_io_mem_dataspace.h index c8beb3159..e9fa44d70 100644 --- a/repos/base/include/base/attached_io_mem_dataspace.h +++ b/repos/base/include/base/attached_io_mem_dataspace.h @@ -46,7 +46,7 @@ class Genode::Attached_io_mem_dataspace * \param write_combined enable write combining for the resource * * \throw Parent::Service_denied - * \throw Parent::Quota_exceeded + * \throw Insufficient_ram_quota * \throw Parent::Unavailable * \throw Rm_session::Attach_failed */ diff --git a/repos/base/include/base/env.h b/repos/base/include/base/env.h index bdd9c4a10..52fdfac16 100644 --- a/repos/base/include/base/env.h +++ b/repos/base/include/base/env.h @@ -92,9 +92,8 @@ struct Genode::Env * \param args session constructor arguments * \param affinity preferred CPU affinity for the session * - * \throw Service_denied parent denies session request - * \throw Quota_exceeded our own quota does not suffice for - * the creation of the new session + * \throw Service_denied + * \throw Insufficient_ram_quota * \throw Unavailable * * This method blocks until the session is available or an error diff --git a/repos/base/include/base/local_connection.h b/repos/base/include/base/local_connection.h index c34c07ca8..65305d9ff 100644 --- a/repos/base/include/base/local_connection.h +++ b/repos/base/include/base/local_connection.h @@ -68,13 +68,13 @@ struct Genode::Local_connection_base : Noncopyable _session_state->service().initiate_request(*_session_state); - if (_session_state->phase == Session_state::QUOTA_EXCEEDED) + if (_session_state->phase == Session_state::INSUFFICIENT_RAM_QUOTA) ram_quota += 4096; else break; } - if (_session_state->phase == Session_state::QUOTA_EXCEEDED) + if (_session_state->phase == Session_state::INSUFFICIENT_RAM_QUOTA) warning("giving up to increase session quota for ", service.name(), " session " "after ", (int)NUM_ATTEMPTS, " attempts"); } diff --git a/repos/base/include/base/service.h b/repos/base/include/base/service.h index 04b134146..64ae29c36 100644 --- a/repos/base/include/base/service.h +++ b/repos/base/include/base/service.h @@ -57,9 +57,8 @@ class Genode::Service : Noncopyable ** Exception types ** *********************/ - class Invalid_args { }; - class Unavailable { }; - class Quota_exceeded { }; + class Invalid_args : Exception { }; + class Unavailable : Exception { }; /** * Constructor @@ -132,7 +131,7 @@ class Genode::Local_service : public Service * Create session * * \throw Denied - * \throw Quota_exceeded + * \throw Insufficient_ram_quota */ virtual SESSION &create(Args const &, Affinity) = 0; @@ -202,8 +201,8 @@ class Genode::Local_service : public Service } catch (typename Factory::Denied) { session.phase = Session_state::INVALID_ARGS; } - catch (Quota_exceeded) { - session.phase = Session_state::QUOTA_EXCEEDED; } + catch (Insufficient_ram_quota) { + session.phase = Session_state::INSUFFICIENT_RAM_QUOTA; } break; @@ -229,7 +228,7 @@ class Genode::Local_service : public Service break; case Session_state::INVALID_ARGS: - case Session_state::QUOTA_EXCEEDED: + case Session_state::INSUFFICIENT_RAM_QUOTA: case Session_state::AVAILABLE: case Session_state::CAP_HANDED_OUT: case Session_state::CLOSED: @@ -285,9 +284,9 @@ class Genode::Parent_service : public Service session.phase = Session_state::AVAILABLE; } - catch (Parent::Quota_exceeded) { + catch (Insufficient_ram_quota) { session.id_at_parent.destruct(); - session.phase = Session_state::INVALID_ARGS; } + session.phase = Session_state::INSUFFICIENT_RAM_QUOTA; } catch (Parent::Service_denied) { session.id_at_parent.destruct(); @@ -304,7 +303,7 @@ class Genode::Parent_service : public Service try { _env.upgrade(session.id_at_parent->id(), args.string()); } - catch (Parent::Quota_exceeded) { + catch (Out_of_ram) { warning("quota exceeded while upgrading parent session"); } session.confirm_ram_upgrade(); @@ -322,7 +321,7 @@ class Genode::Parent_service : public Service break; case Session_state::INVALID_ARGS: - case Session_state::QUOTA_EXCEEDED: + case Session_state::INSUFFICIENT_RAM_QUOTA: case Session_state::AVAILABLE: case Session_state::CAP_HANDED_OUT: case Session_state::CLOSED: diff --git a/repos/base/include/base/session_state.h b/repos/base/include/base/session_state.h index cfa243d8d..a009ec472 100644 --- a/repos/base/include/base/session_state.h +++ b/repos/base/include/base/session_state.h @@ -79,7 +79,7 @@ class Genode::Session_state : public Parent::Client, public Parent::Server, enum Phase { CREATE_REQUESTED, INVALID_ARGS, - QUOTA_EXCEEDED, + INSUFFICIENT_RAM_QUOTA, AVAILABLE, CAP_HANDED_OUT, UPGRADE_REQUESTED, @@ -185,7 +185,7 @@ class Genode::Session_state : public Parent::Client, public Parent::Server, case CREATE_REQUESTED: case INVALID_ARGS: - case QUOTA_EXCEEDED: + case INSUFFICIENT_RAM_QUOTA: case CLOSED: return false; diff --git a/repos/base/include/parent/parent.h b/repos/base/include/parent/parent.h index 638257e79..7c9a11dcd 100644 --- a/repos/base/include/parent/parent.h +++ b/repos/base/include/parent/parent.h @@ -59,7 +59,6 @@ class Genode::Parent class Exception : public ::Genode::Exception { }; class Service_denied : public Exception { }; - class Quota_exceeded : public Exception { }; class Unavailable : public Exception { }; typedef Rpc_in_buffer<64> Service_name; @@ -160,9 +159,9 @@ class Genode::Parent * \param args session constructor arguments * \param affinity preferred CPU affinity for the session * - * \throw Service_denied parent denies session request - * \throw Quota_exceeded our own quota does not suffice for - * the creation of the new session + * \throw Service_denied parent denies session request + * \throw Insufficient_ram_quota donated RAM quota does not suffice + * \throw Out_of_ram session RAM quota exceeds our resources * * \return session capability of the new session is immediately * available, or an invalid capability @@ -183,8 +182,7 @@ class Genode::Parent * Request session capability * * \throw Service_denied - * \throw Quota_exceeded session quota does not suffice for - * the creation of the new session + * \throw Insufficient_ram_quota * * In the exception case, the parent implicitly closes the session. */ @@ -198,7 +196,7 @@ class Genode::Parent * \param id ID of recipient session * \param args description of the amount of quota to transfer * - * \throw Quota_exceeded quota could not be transferred + * \throw Out_of_ram * * The 'args' argument has the same principle format as the 'args' * argument of the 'session' operation. @@ -217,7 +215,8 @@ class Genode::Parent * Interface for providing services */ - enum Session_response { SESSION_OK, SESSION_CLOSED, INVALID_ARGS, QUOTA_EXCEEDED }; + enum Session_response { SESSION_OK, SESSION_CLOSED, INVALID_ARGS, + INSUFFICIENT_RAM_QUOTA }; /** * Set state of a session provided by the child service @@ -295,14 +294,16 @@ class Genode::Parent Service_name const &); GENODE_RPC(Rpc_session_sigh, void, session_sigh, Signal_context_capability); GENODE_RPC_THROW(Rpc_session, Session_capability, session, - GENODE_TYPE_LIST(Service_denied, Quota_exceeded, Unavailable), + GENODE_TYPE_LIST(Service_denied, Out_of_ram, + Insufficient_ram_quota, Unavailable), Client::Id, Service_name const &, Session_args const &, Affinity const &); GENODE_RPC_THROW(Rpc_session_cap, Session_capability, session_cap, - GENODE_TYPE_LIST(Service_denied, Quota_exceeded, Unavailable), + GENODE_TYPE_LIST(Service_denied, + Insufficient_ram_quota, Unavailable), Client::Id); GENODE_RPC_THROW(Rpc_upgrade, Upgrade_result, upgrade, - GENODE_TYPE_LIST(Quota_exceeded), + GENODE_TYPE_LIST(Out_of_ram), Client::Id, Upgrade_args const &); GENODE_RPC(Rpc_close, Close_result, close, Client::Id); GENODE_RPC(Rpc_session_response, void, session_response, diff --git a/repos/base/include/root/component.h b/repos/base/include/root/component.h index c3ffe2528..ffdb743f8 100644 --- a/repos/base/include/root/component.h +++ b/repos/base/include/root/component.h @@ -146,7 +146,7 @@ class Genode::Root_component : public Rpc_object >, warning("insufficient ram quota " "for ", SESSION_TYPE::service_name(), " session, " "provided=", ram_quota, ", required=", needed); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } Ram_quota const remaining_ram_quota { ram_quota.value - needed }; @@ -284,7 +284,7 @@ class Genode::Root_component : public Rpc_object >, { try { return _create(args, affinity); } - catch (Root::Quota_exceeded) { throw Service::Quota_exceeded(); } + catch (Insufficient_ram_quota) { throw; } catch (...) { throw typename Local_service::Factory::Denied(); } } diff --git a/repos/base/include/root/root.h b/repos/base/include/root/root.h index 55c0b7cbe..585d297ef 100644 --- a/repos/base/include/root/root.h +++ b/repos/base/include/root/root.h @@ -47,7 +47,7 @@ struct Genode::Root * Create session * * \throw Unavailable - * \throw Quota_exceeded + * \throw Insufficient_ram_quota * \throw Invalid_args * * \return capability to new session @@ -71,7 +71,8 @@ struct Genode::Root *********************/ GENODE_RPC_THROW(Rpc_session, Session_capability, session, - GENODE_TYPE_LIST(Unavailable, Quota_exceeded, Invalid_args), + GENODE_TYPE_LIST(Unavailable, Insufficient_ram_quota, + Invalid_args), Session_args const &, Affinity const &); GENODE_RPC_THROW(Rpc_upgrade, void, upgrade, GENODE_TYPE_LIST(Invalid_args), diff --git a/repos/base/src/core/include/core_parent.h b/repos/base/src/core/include/core_parent.h index 16e85d4a4..13e0b9759 100644 --- a/repos/base/src/core/include/core_parent.h +++ b/repos/base/src/core/include/core_parent.h @@ -73,7 +73,7 @@ class Genode::Core_parent : public Parent Session_capability session_cap(Client::Id) override { return Session_capability(); } Upgrade_result upgrade(Client::Id, Upgrade_args const &) override { - throw Quota_exceeded(); } + throw Out_of_ram(); } Close_result close(Client::Id) override { return CLOSE_DONE; } diff --git a/repos/base/src/core/include/cpu_root.h b/repos/base/src/core/include/cpu_root.h index f203c7cb2..29eda6659 100644 --- a/repos/base/src/core/include/cpu_root.h +++ b/repos/base/src/core/include/cpu_root.h @@ -40,7 +40,7 @@ namespace Genode { Arg_string::find_arg(args, "ram_quota").ulong_value(0); if (ram_quota < Trace::Control_area::SIZE) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); return new (md_alloc()) Cpu_session_component( diff --git a/repos/base/src/include/base/internal/expanding_parent_client.h b/repos/base/src/include/base/internal/expanding_parent_client.h index c093e94eb..989a7120c 100644 --- a/repos/base/src/include/base/internal/expanding_parent_client.h +++ b/repos/base/src/include/base/internal/expanding_parent_client.h @@ -112,7 +112,7 @@ class Genode::Expanding_parent_client : public Parent_client * caller to issue (and respond to) a resource request. */ enum { NUM_ATTEMPTS = 2 }; - return retry( + return retry( [&] () { return Parent_client::upgrade(id, args); }, [&] () { resource_request(Resource_args(args.string())); }, NUM_ATTEMPTS); diff --git a/repos/base/src/lib/base/child.cc b/repos/base/src/lib/base/child.cc index 21393edce..94d9b2df8 100644 --- a/repos/base/src/lib/base/child.cc +++ b/repos/base/src/lib/base/child.cc @@ -147,7 +147,7 @@ void Child::session_sigh(Signal_context_capability sigh) _id_space.for_each([&] (Session_state const &session) { if (session.phase == Session_state::AVAILABLE || - session.phase == Session_state::QUOTA_EXCEEDED || + session.phase == Session_state::INSUFFICIENT_RAM_QUOTA || session.phase == Session_state::INVALID_ARGS) { if (sigh.valid() && session.async_client_notify) @@ -160,7 +160,7 @@ void Child::session_sigh(Signal_context_capability sigh) /** * Create session-state object for a dynamically created session * - * \throw Parent::Quota_exceeded + * \throw Insufficient_ram_quota * \throw Parent::Service_denied */ Session_state & @@ -171,16 +171,15 @@ create_session(Child_policy::Name const &child_name, Service &service, Affinity const &affinity) { try { - return service.create_session(factory, id_space, id, label, args, affinity); - } - catch (Service::Quota_exceeded) { - error(child_name, " requested session with insufficient session quota"); - throw Parent::Quota_exceeded(); - } + return service.create_session(factory, id_space, id, label, args, affinity); } + + catch (Insufficient_ram_quota) { + error(child_name, " requested session with insufficient RAM quota"); + throw; } catch (Allocator::Out_of_memory) { - error("could not allocate session meta data for child ", child_name); - throw Parent::Quota_exceeded(); - } + error(child_name, " session meta data could not be allocated"); + throw Out_of_ram(); } + catch (Id_space::Conflicting_id) { error(child_name, " requested conflicting session ID ", id, " " @@ -249,7 +248,7 @@ Session_capability Child::session(Parent::Client::Id id, size_t const keep_ram_quota = _session_factory.session_costs(); if (ram_quota.value < keep_ram_quota) - throw Parent::Quota_exceeded(); + throw Insufficient_ram_quota(); /* ram quota to be forwarded to the server */ Ram_quota const forward_ram_quota { ram_quota.value - keep_ram_quota }; @@ -286,9 +285,9 @@ Session_capability Child::session(Parent::Client::Id id, throw Service_denied(); } - if (session.phase == Session_state::QUOTA_EXCEEDED) { + if (session.phase == Session_state::INSUFFICIENT_RAM_QUOTA) { _revert_quota_and_destroy(session); - throw Parent::Quota_exceeded(); + throw Insufficient_ram_quota(); } /* finish transaction */ @@ -300,7 +299,7 @@ Session_capability Child::session(Parent::Client::Id id, * Release session meta data if one of the quota transfers went wrong. */ session.destroy(); - throw Parent::Quota_exceeded(); + throw Out_of_ram(); } /* @@ -329,7 +328,7 @@ Session_capability Child::session_cap(Client::Id id) auto lamda = [&] (Session_state &session) { if (session.phase == Session_state::INVALID_ARGS - || session.phase == Session_state::QUOTA_EXCEEDED) { + || session.phase == Session_state::INSUFFICIENT_RAM_QUOTA) { Session_state::Phase const phase = session.phase; @@ -340,10 +339,11 @@ Session_capability Child::session_cap(Client::Id id) */ _revert_quota_and_destroy(session); - if (phase == Session_state::INVALID_ARGS) - throw Parent::Service_denied(); - else - throw Parent::Quota_exceeded(); + switch (phase) { + case Session_state::INVALID_ARGS: throw Parent::Service_denied(); + case Session_state::INSUFFICIENT_RAM_QUOTA: throw Insufficient_ram_quota(); + default: break; + } } if (!session.alive()) @@ -404,7 +404,7 @@ Parent::Upgrade_result Child::upgrade(Client::Id id, Parent::Upgrade_args const } catch (Transfer::Quota_exceeded) { warning(_policy.name(), ": upgrade of ", session.service().name(), " failed"); - throw Parent::Quota_exceeded(); + throw Out_of_ram(); } if (session.phase == Session_state::CAP_HANDED_OUT) { @@ -455,7 +455,7 @@ Child::Close_result Child::_close(Session_state &session) * without involving the server */ if (session.phase == Session_state::INVALID_ARGS - || session.phase == Session_state::QUOTA_EXCEEDED) { + || session.phase == Session_state::INSUFFICIENT_RAM_QUOTA) { _revert_quota_and_destroy(session); return CLOSE_DONE; } @@ -554,8 +554,8 @@ void Child::session_response(Server::Id id, Session_response response) session.ready_callback->session_ready(session); break; - case Parent::QUOTA_EXCEEDED: - session.phase = Session_state::QUOTA_EXCEEDED; + case Parent::INSUFFICIENT_RAM_QUOTA: + session.phase = Session_state::INSUFFICIENT_RAM_QUOTA; if (session.ready_callback) session.ready_callback->session_ready(session); break; @@ -705,6 +705,7 @@ void Child::_try_construct_env_dependent_members() Child_address_space(_pd.session(), _policy).region_map(), _parent_cap); } + catch (Out_of_ram) { _error("out of RAM during ELF loading"); } catch (Ram_session::Alloc_failed) { _error("RAM allocation failed during ELF loading"); } catch (Cpu_session::Thread_creation_failed) { _error("unable to create initial thread"); } catch (Cpu_session::Out_of_metadata) { _error("CPU session quota exhausted"); } diff --git a/repos/base/src/lib/base/component.cc b/repos/base/src/lib/base/component.cc index 99dbefb5d..ad27ca5c7 100644 --- a/repos/base/src/lib/base/component.cc +++ b/repos/base/src/lib/base/component.cc @@ -135,7 +135,7 @@ namespace { strncpy(argbuf, args.string(), sizeof(argbuf)); Ram_quota ram_quota = ram_quota_from_args(argbuf); - return retry( + return retry( [&] () { Arg_string::set_arg(argbuf, sizeof(argbuf), "ram_quota", @@ -172,7 +172,7 @@ namespace { warning("giving up to increase session quota for ", name.string(), " session " "after ", (int)NUM_ATTEMPTS, " attempts"); - throw Parent::Quota_exceeded(); + throw Insufficient_ram_quota(); } void upgrade(Parent::Client::Id id, Parent::Upgrade_args const &args) override diff --git a/repos/base/src/lib/base/root_proxy.cc b/repos/base/src/lib/base/root_proxy.cc index fb787769e..da052e968 100644 --- a/repos/base/src/lib/base/root_proxy.cc +++ b/repos/base/src/lib/base/root_proxy.cc @@ -185,8 +185,8 @@ void Root_proxy::_handle_session_request(Xml_node request) } catch (Root::Invalid_args) { _env.parent().session_response(id, Parent::INVALID_ARGS); } - catch (Root::Quota_exceeded) { - _env.parent().session_response(id, Parent::QUOTA_EXCEEDED); } + catch (Insufficient_ram_quota) { + _env.parent().session_response(id, Parent::INSUFFICIENT_RAM_QUOTA); } catch (Root::Unavailable) { _env.parent().session_response(id, Parent::INVALID_ARGS); } } diff --git a/repos/base/src/lib/base/session_state.cc b/repos/base/src/lib/base/session_state.cc index 27ba1f568..f5da491fb 100644 --- a/repos/base/src/lib/base/session_state.cc +++ b/repos/base/src/lib/base/session_state.cc @@ -30,14 +30,14 @@ struct Formatted_phase typedef Genode::Session_state State; switch (_phase) { - case State::CREATE_REQUESTED: print(output, "CREATE_REQUESTED"); break; - case State::INVALID_ARGS: print(output, "INVALID_ARGS"); break; - case State::QUOTA_EXCEEDED: print(output, "QUOTA_EXCEEDED"); break; - case State::AVAILABLE: print(output, "AVAILABLE"); break; - case State::CAP_HANDED_OUT: print(output, "CAP_HANDED_OUT"); break; - case State::UPGRADE_REQUESTED: print(output, "UPGRADE_REQUESTED"); break; - case State::CLOSE_REQUESTED: print(output, "CLOSE_REQUESTED"); break; - case State::CLOSED: print(output, "CLOSED"); break; + case State::CREATE_REQUESTED: print(output, "CREATE_REQUESTED"); break; + case State::INVALID_ARGS: print(output, "INVALID_ARGS"); break; + case State::INSUFFICIENT_RAM_QUOTA: print(output, "INSUFFICIENT_RAM_QUOTA"); break; + case State::AVAILABLE: print(output, "AVAILABLE"); break; + case State::CAP_HANDED_OUT: print(output, "CAP_HANDED_OUT"); break; + case State::UPGRADE_REQUESTED: print(output, "UPGRADE_REQUESTED"); break; + case State::CLOSE_REQUESTED: print(output, "CLOSE_REQUESTED"); break; + case State::CLOSED: print(output, "CLOSED"); break; } } }; @@ -87,7 +87,7 @@ void Session_state::generate_session_request(Xml_generator &xml) const break; case INVALID_ARGS: - case QUOTA_EXCEEDED: + case INSUFFICIENT_RAM_QUOTA: case AVAILABLE: case CAP_HANDED_OUT: case CLOSED: @@ -155,7 +155,7 @@ void Session_state::destroy() Session_state::Session_state(Service &service, Id_space &client_id_space, Parent::Client::Id client_id, - Session_label const &label, + Session::Label const &label, Args const &args, Affinity const &affinity) : diff --git a/repos/dde_bsd/src/drivers/audio/main.cc b/repos/dde_bsd/src/drivers/audio/main.cc index fd2332d98..76216c7b8 100644 --- a/repos/dde_bsd/src/drivers/audio/main.cc +++ b/repos/dde_bsd/src/drivers/audio/main.cc @@ -226,7 +226,7 @@ struct Audio_out::Root_policy (sizeof(Stream) > ram_quota - session_size)) { Genode::error("insufficient 'ram_quota', got ", ram_quota, " need ", sizeof(Stream) + session_size); - throw ::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } char channel_name[16]; @@ -417,7 +417,7 @@ struct Audio_in::Root_policy Genode::error("insufficient 'ram_quota', got ", ram_quota, " need ", sizeof(Stream) + session_size, ", denying '",Genode::label_from_args(args),"'"); - throw Genode::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } char channel_name[16]; diff --git a/repos/dde_linux/src/lib/usb/include/usb_nic_component.h b/repos/dde_linux/src/lib/usb/include/usb_nic_component.h index d38f94b43..3634cacf8 100644 --- a/repos/dde_linux/src/lib/usb/include/usb_nic_component.h +++ b/repos/dde_linux/src/lib/usb/include/usb_nic_component.h @@ -240,7 +240,7 @@ class Root : public Root_component /* deplete ram quota by the memory needed for the session structure */ size_t session_size = max(4096UL, (unsigned long)sizeof(Usb_nic::Session_component)); if (ram_quota < session_size) - throw Genode::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); /* * Check if donated ram quota suffices for both communication @@ -250,7 +250,7 @@ class Root : public Root_component tx_buf_size + rx_buf_size > ram_quota - session_size) { Genode::error("insufficient 'ram_quota', got ", ram_quota, " need %ld", tx_buf_size + rx_buf_size + session_size); - throw Genode::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } return new (Root::md_alloc()) diff --git a/repos/dde_linux/src/lib/usb/raw/raw.cc b/repos/dde_linux/src/lib/usb/raw/raw.cc index afdb8c6be..54460d0e6 100644 --- a/repos/dde_linux/src/lib/usb/raw/raw.cc +++ b/repos/dde_linux/src/lib/usb/raw/raw.cc @@ -822,12 +822,12 @@ class Usb::Root : public Genode::Root_component /* check session quota */ size_t session_size = max(4096, sizeof(Session_component)); if (ram_quota < session_size) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); if (tx_buf_size > ram_quota - session_size) { error("Insufficient 'ram_quota',got ", ram_quota, " need ", - tx_buf_size + session_size); - throw Root::Quota_exceeded(); + tx_buf_size + session_size); + throw Insufficient_ram_quota(); } Ram_dataspace_capability tx_ds = _env.ram().alloc(tx_buf_size); diff --git a/repos/dde_linux/src/lib/wifi/nic.cc b/repos/dde_linux/src/lib/wifi/nic.cc index fac98f422..8cf865f8f 100644 --- a/repos/dde_linux/src/lib/wifi/nic.cc +++ b/repos/dde_linux/src/lib/wifi/nic.cc @@ -180,7 +180,7 @@ class Root : public Genode::Root_component if (session_size > ram_quota) { Genode::error("insufficient 'ram_quota' from ", label.string(), " got ", ram_quota, "need ", session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } ram_quota -= session_size; diff --git a/repos/libports/src/server/ffat_fs/main.cc b/repos/libports/src/server/ffat_fs/main.cc index 1dbc9fe75..8908bb037 100644 --- a/repos/libports/src/server/ffat_fs/main.cc +++ b/repos/libports/src/server/ffat_fs/main.cc @@ -944,7 +944,7 @@ namespace File_system { if (max((size_t)4096, session_size) > ram_quota) { error("insufficient 'ram_quota', got ", ram_quota, ", " "need ", session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(_env, _heap, tx_buf_size, diff --git a/repos/libports/src/server/fuse_fs/fuse_fs_main.cc b/repos/libports/src/server/fuse_fs/fuse_fs_main.cc index f3eb1768a..450597e40 100644 --- a/repos/libports/src/server/fuse_fs/fuse_fs_main.cc +++ b/repos/libports/src/server/fuse_fs/fuse_fs_main.cc @@ -480,7 +480,7 @@ class File_system::Root : public Root_component if (max((size_t)4096, session_size) > ram_quota) { Genode::error("insufficient 'ram_quota', got ", ram_quota, " , " "need ", session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(tx_buf_size, _ep, _rm, root_dir, writeable, *md_alloc()); diff --git a/repos/os/include/block/component.h b/repos/os/include/block/component.h index 52f64023b..fe3c4cccd 100644 --- a/repos/os/include/block/component.h +++ b/repos/os/include/block/component.h @@ -270,7 +270,7 @@ class Block::Root : public Genode::Root_component ram_quota - session_size) { error("insufficient 'ram_quota', got ", ram_quota, ", need ", tx_buf_size + session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(_driver_factory, diff --git a/repos/os/include/gpio/component.h b/repos/os/include/gpio/component.h index 9a94bf040..bea177d80 100644 --- a/repos/os/include/gpio/component.h +++ b/repos/os/include/gpio/component.h @@ -133,7 +133,7 @@ class Gpio::Root : public Genode::Root_component Genode::warning("insufficient dontated ram_quota " "(", ram_quota, " bytes), " "require ", sizeof(Session_component), " bytes"); - throw Genode::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } return new (md_alloc()) Session_component(_ep, _driver, pin); diff --git a/repos/os/include/nic/root.h b/repos/os/include/nic/root.h index 4b51e2a84..3494c496e 100644 --- a/repos/os/include/nic/root.h +++ b/repos/os/include/nic/root.h @@ -46,7 +46,7 @@ class Nic::Root : public Genode::Root_component ram_quota - session_size) { Genode::error("insufficient 'ram_quota', got ", ram_quota, ", " "need ", tx_buf_size + rx_buf_size + session_size); - throw Genode::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } return new (Root::md_alloc()) diff --git a/repos/os/include/os/attached_mmio.h b/repos/os/include/os/attached_mmio.h index 8c2e4919a..438d9dd81 100644 --- a/repos/os/include/os/attached_mmio.h +++ b/repos/os/include/os/attached_mmio.h @@ -43,7 +43,7 @@ class Genode::Attached_mmio : public Attached_io_mem_dataspace, * \param write_combined enable write combining for the resource * * \throw Parent::Service_denied - * \throw Parent::Quota_exceeded + * \throw Insufficient_ram_quota * \throw Parent::Unavailable * \throw Rm_session::Attach_failed */ diff --git a/repos/os/include/os/child_policy_dynamic_rom.h b/repos/os/include/os/child_policy_dynamic_rom.h index a15d5aa02..fff97bb4b 100644 --- a/repos/os/include/os/child_policy_dynamic_rom.h +++ b/repos/os/include/os/child_policy_dynamic_rom.h @@ -194,7 +194,7 @@ class Genode::Child_policy_dynamic_rom_file : public Rpc_object, break; case Session_state::INVALID_ARGS: - case Session_state::QUOTA_EXCEEDED: + case Session_state::INSUFFICIENT_RAM_QUOTA: case Session_state::AVAILABLE: case Session_state::CAP_HANDED_OUT: case Session_state::CLOSED: diff --git a/repos/os/include/os/slave.h b/repos/os/include/os/slave.h index 1bfc91a83..5e3520fa9 100644 --- a/repos/os/include/os/slave.h +++ b/repos/os/include/os/slave.h @@ -213,7 +213,7 @@ class Genode::Slave::Connection_base break; case Session_state::INVALID_ARGS: - case Session_state::QUOTA_EXCEEDED: + case Session_state::INSUFFICIENT_RAM_QUOTA: case Session_state::AVAILABLE: case Session_state::CAP_HANDED_OUT: case Session_state::CLOSED: @@ -272,7 +272,7 @@ struct Genode::Slave::Connection : private Connection_base, * Constructor * * \throw Parent::Service_denied parent denies session request - * \throw Parent::Quota_exceeded our own quota does not suffice for + * \throw Out_of_ram our own quota does not suffice for * the creation of the new session */ Connection(Slave::Policy &policy, Args const &args, diff --git a/repos/os/include/regulator/component.h b/repos/os/include/regulator/component.h index 19654d7b7..08202992e 100644 --- a/repos/os/include/regulator/component.h +++ b/repos/os/include/regulator/component.h @@ -81,7 +81,7 @@ class Regulator::Root : size_t session_size = max((size_t)4096, sizeof(Session_component)); if (ram_quota < session_size) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); if (!strlen(reg_name)) throw Root::Invalid_args(); diff --git a/repos/os/include/report_rom/report_service.h b/repos/os/include/report_rom/report_service.h index ac25e23e1..e5507e6f9 100644 --- a/repos/os/include/report_rom/report_service.h +++ b/repos/os/include/report_rom/report_service.h @@ -129,7 +129,7 @@ struct Report::Root : Genode::Root_component if (ram_quota < session_size) { Genode::error("insufficient ram donation from ", label.string()); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } if (buffer_size == 0) { diff --git a/repos/os/src/drivers/ahci/main.cc b/repos/os/src/drivers/ahci/main.cc index 2b8ccaac9..04693d63b 100644 --- a/repos/os/src/drivers/ahci/main.cc +++ b/repos/os/src/drivers/ahci/main.cc @@ -113,7 +113,7 @@ class Block::Root_multiple_clients : public Root_component< ::Session_component> if (max((size_t)4096, session_size) > ram_quota) { error("insufficient 'ram_quota' from '", label, "'," " got ", ram_quota, ", need ", session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } /* Search for configured device */ diff --git a/repos/os/src/drivers/audio/spec/linux/main.cc b/repos/os/src/drivers/audio/spec/linux/main.cc index 021674a15..5a288ba93 100644 --- a/repos/os/src/drivers/audio/spec/linux/main.cc +++ b/repos/os/src/drivers/audio/spec/linux/main.cc @@ -212,7 +212,7 @@ struct Audio_out::Root_policy (sizeof(Stream) > ram_quota - session_size)) { Genode::error("insufficient 'ram_quota', got ", ram_quota, " need ", sizeof(Stream) + session_size); - throw ::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } char channel_name[16]; diff --git a/repos/os/src/drivers/nic/spec/pbxa9/main.cc b/repos/os/src/drivers/nic/spec/pbxa9/main.cc index 78b019e9a..9ac9d0a5a 100644 --- a/repos/os/src/drivers/nic/spec/pbxa9/main.cc +++ b/repos/os/src/drivers/nic/spec/pbxa9/main.cc @@ -66,7 +66,7 @@ class Root : public Genode::Root_component /* deplete ram quota by the memory needed for the session structure */ size_t session_size = max(4096UL, (unsigned long)sizeof(Lan9118)); if (ram_quota < session_size) - throw Genode::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); /* * Check if donated ram quota suffices for both communication @@ -76,7 +76,7 @@ class Root : public Genode::Root_component tx_buf_size + rx_buf_size > ram_quota - session_size) { error("insufficient 'ram_quota', got ", ram_quota, ", " "need ", tx_buf_size + rx_buf_size + session_size); - throw Genode::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } return new (Root::md_alloc()) diff --git a/repos/os/src/drivers/platform/spec/x86/pci_session_component.h b/repos/os/src/drivers/platform/spec/x86/pci_session_component.h index 1fabcb6f2..f802ec864 100644 --- a/repos/os/src/drivers/platform/spec/x86/pci_session_component.h +++ b/repos/os/src/drivers/platform/spec/x86/pci_session_component.h @@ -253,7 +253,7 @@ class Platform::Session_component : public Genode::Rpc_object enum { OVERHEAD = 4096 }; try { _env_ram.transfer_quota(_ram, Genode::Ram_quota{OVERHEAD}); } - catch (...) { throw Genode::Root::Quota_exceeded(); } + catch (...) { throw Genode::Insufficient_ram_quota(); } } bool const _ram_initialized = (_init_ram(), true); @@ -331,7 +331,7 @@ class Platform::Session_component : public Genode::Rpc_object /* thrown by 'Device_pd_policy' or 'Child' */ catch (Genode::Ram_session::Alloc_failed) { throw Out_of_metadata(); } /* throw by 'Slave::Connection' */ - catch (Genode::Parent::Quota_exceeded) { throw Out_of_metadata(); } + catch (Genode::Insufficient_ram_quota) { throw Out_of_metadata(); } Device_pd_client &session() { return _connection; } diff --git a/repos/os/src/drivers/timer/include/root_component.h b/repos/os/src/drivers/timer/include/root_component.h index 3af91cdff..b123898ed 100644 --- a/repos/os/src/drivers/timer/include/root_component.h +++ b/repos/os/src/drivers/timer/include/root_component.h @@ -44,7 +44,7 @@ class Timer::Root_component : public Genode::Root_component Arg_string::find_arg(args, "ram_quota").ulong_value(0); if (ram_quota < sizeof(Session_component)) { - throw Root::Quota_exceeded(); } + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(_timeout_scheduler); diff --git a/repos/os/src/init/server.cc b/repos/os/src/init/server.cc index 6680ce387..ef4b700df 100644 --- a/repos/os/src/init/server.cc +++ b/repos/os/src/init/server.cc @@ -184,7 +184,7 @@ void Init::Server::_handle_create_session_request(Xml_node request, size_t const keep_quota = route.service.factory().session_costs(); if (ram_quota.value < keep_quota) - throw Genode::Service::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); Ram_quota const forward_ram_quota { ram_quota.value - keep_quota }; @@ -223,13 +223,13 @@ void Init::Server::_handle_create_session_request(Xml_node request, if (session.phase == Session_state::INVALID_ARGS) throw Parent::Service_denied(); - if (session.phase == Session_state::QUOTA_EXCEEDED) - throw Genode::Service::Quota_exceeded(); + if (session.phase == Session_state::INSUFFICIENT_RAM_QUOTA) + throw Genode::Insufficient_ram_quota(); } catch (Parent::Service_denied) { _env.parent().session_response(Parent::Server::Id { id.value }, Parent::INVALID_ARGS); } - catch (Genode::Service::Quota_exceeded) { - _env.parent().session_response(Parent::Server::Id { id.value }, Parent::QUOTA_EXCEEDED); } + catch (Genode::Insufficient_ram_quota) { + _env.parent().session_response(Parent::Server::Id { id.value }, Parent::INSUFFICIENT_RAM_QUOTA); } } diff --git a/repos/os/src/server/fs_log/main.cc b/repos/os/src/server/fs_log/main.cc index 543b6c12a..74af65fa8 100644 --- a/repos/os/src/server/fs_log/main.cc +++ b/repos/os/src/server/fs_log/main.cc @@ -70,7 +70,7 @@ class Fs_log::Root_component : size_t ram_quota = Arg_string::find_arg(args, "ram_quota").aligned_size(); if (ram_quota < sizeof(Session_component)) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); Path dir_path; char file_name[MAX_NAME_LEN]; diff --git a/repos/os/src/server/iso9660/iso9660.cc b/repos/os/src/server/iso9660/iso9660.cc index 4165427cc..993525724 100644 --- a/repos/os/src/server/iso9660/iso9660.cc +++ b/repos/os/src/server/iso9660/iso9660.cc @@ -314,7 +314,7 @@ class Volume_descriptor : public Iso::Iso_base Directory_record *buf; if (!(alloc.alloc(ROOT_SIZE, &buf))) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); memcpy(buf, root_record(), ROOT_SIZE); diff --git a/repos/os/src/server/iso9660/main.cc b/repos/os/src/server/iso9660/main.cc index 4c157e9a5..fa988bf25 100644 --- a/repos/os/src/server/iso9660/main.cc +++ b/repos/os/src/server/iso9660/main.cc @@ -142,7 +142,7 @@ class Iso::Root : public Iso::Root_component Arg_string::find_arg(args, "ram_quota").ulong_value(0); size_t session_size = sizeof(Rom_component) + sizeof(File_info); if (ram_quota < session_size) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); Session_label const label = label_from_args(args); strncpy(_path, label.last_element().string(), sizeof(_path)); diff --git a/repos/os/src/server/lx_fs/main.cc b/repos/os/src/server/lx_fs/main.cc index c5f4fdf4a..87db045f7 100644 --- a/repos/os/src/server/lx_fs/main.cc +++ b/repos/os/src/server/lx_fs/main.cc @@ -395,7 +395,7 @@ class File_system::Root : public Root_component if (max((size_t)4096, session_size) > ram_quota) { Genode::error("insufficient 'ram_quota', " "got ", ram_quota, ", need ", session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } try { diff --git a/repos/os/src/server/mixer/mixer.cc b/repos/os/src/server/mixer/mixer.cc index 72e06d7bf..75ff99fde 100644 --- a/repos/os/src/server/mixer/mixer.cc +++ b/repos/os/src/server/mixer/mixer.cc @@ -676,7 +676,7 @@ class Audio_out::Root : public Audio_out::Root_component (sizeof(Stream) > ram_quota - session_size)) { Genode::error("insufficient 'ram_quota', got ", ram_quota, ", " "need ", sizeof(Stream) + session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } Channel::Number ch = number_from_string(channel_name); diff --git a/repos/os/src/server/nic_bridge/component.h b/repos/os/src/server/nic_bridge/component.h index 07e109adc..70009b3c2 100644 --- a/repos/os/src/server/nic_bridge/component.h +++ b/repos/os/src/server/nic_bridge/component.h @@ -217,12 +217,12 @@ class Net::Root : public Genode::Root_component Session_component(_env.ram(), _env.rm(), _env.ep(), ram_quota, tx_buf_size, rx_buf_size, _mac_alloc.alloc(), _nic, ip_addr); - } catch(Mac_allocator::Alloc_failed) { + } catch (Mac_allocator::Alloc_failed) { Genode::warning("Mac address allocation failed!"); throw Root::Unavailable(); } catch(Ram_session::Quota_exceeded) { Genode::warning("insufficient 'ram_quota'"); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } } diff --git a/repos/os/src/server/nic_dump/component.cc b/repos/os/src/server/nic_dump/component.cc index 1351bcf82..c091e8223 100644 --- a/repos/os/src/server/nic_dump/component.cc +++ b/repos/os/src/server/nic_dump/component.cc @@ -132,14 +132,14 @@ Session_component *Net::Root::_create_session(char const *args) max((size_t)4096, sizeof(Session_component)); if (ram_quota < session_size) { - throw Root::Quota_exceeded(); } + throw Insufficient_ram_quota(); } if (tx_buf_size > ram_quota - session_size || rx_buf_size > ram_quota - session_size || tx_buf_size + rx_buf_size > ram_quota - session_size) { error("insufficient 'ram_quota' for session creation"); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(*md_alloc(), ram_quota - session_size, diff --git a/repos/os/src/server/nic_loopback/main.cc b/repos/os/src/server/nic_loopback/main.cc index 3011f599d..d585b0e48 100644 --- a/repos/os/src/server/nic_loopback/main.cc +++ b/repos/os/src/server/nic_loopback/main.cc @@ -156,7 +156,7 @@ class Nic_loopback::Root : public Root_component /* deplete ram quota by the memory needed for the session structure */ size_t session_size = max(4096UL, (size_t)sizeof(Session_component)); if (ram_quota < session_size) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); /* * Check if donated ram quota suffices for both communication @@ -166,7 +166,7 @@ class Nic_loopback::Root : public Root_component tx_buf_size + rx_buf_size > ram_quota - session_size) { error("insufficient 'ram_quota', got ", ram_quota, ", " "need ", tx_buf_size + rx_buf_size + session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(tx_buf_size, rx_buf_size, diff --git a/repos/os/src/server/nic_router/component.cc b/repos/os/src/server/nic_router/component.cc index abca5ea3d..fee54da11 100644 --- a/repos/os/src/server/nic_router/component.cc +++ b/repos/os/src/server/nic_router/component.cc @@ -130,14 +130,14 @@ Session_component *Net::Root::_create_session(char const *args) max((size_t)4096, sizeof(Session_component)); if (ram_quota < session_size) { - throw Root::Quota_exceeded(); } + throw Insufficient_ram_quota(); } if (tx_buf_size > ram_quota - session_size || rx_buf_size > ram_quota - session_size || tx_buf_size + rx_buf_size > ram_quota - session_size) { error("insufficient 'ram_quota' for session creation"); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(*md_alloc(), _timer, ram_quota - session_size, diff --git a/repos/os/src/server/nitpicker/main.cc b/repos/os/src/server/nitpicker/main.cc index 55996c890..c76905f56 100644 --- a/repos/os/src/server/nitpicker/main.cc +++ b/repos/os/src/server/nitpicker/main.cc @@ -1039,7 +1039,7 @@ class Nitpicker::Root : public Genode::Root_component if (ram_quota < required_quota) { Genode::warning("Insufficient dontated ram_quota (", ram_quota, " bytes), require ", required_quota, " bytes"); - throw Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } size_t const unused_quota = ram_quota - required_quota; diff --git a/repos/os/src/server/part_blk/component.h b/repos/os/src/server/part_blk/component.h index 99314aedc..72934c4cc 100644 --- a/repos/os/src/server/part_blk/component.h +++ b/repos/os/src/server/part_blk/component.h @@ -266,7 +266,7 @@ class Block::Root : sizeof(Session_component) + sizeof(Allocator_avl)); if (ram_quota < session_size) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); /* * Check if donated ram quota suffices for both @@ -276,7 +276,7 @@ class Block::Root : if (tx_buf_size > ram_quota - session_size) { error("insufficient 'ram_quota', got ", ram_quota, ", need ", tx_buf_size + session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } Ram_dataspace_capability ds_cap; diff --git a/repos/os/src/server/ram_fs/main.cc b/repos/os/src/server/ram_fs/main.cc index af2e7d5e3..63cecf13e 100644 --- a/repos/os/src/server/ram_fs/main.cc +++ b/repos/os/src/server/ram_fs/main.cc @@ -516,7 +516,7 @@ class File_system::Root : public Root_component if (max((size_t)4096, session_size) > ram_quota) { Genode::error("insufficient 'ram_quota', got ", ram_quota, ", " "need ", session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(tx_buf_size, _ep, _ram, _rm, _alloc, diff --git a/repos/os/src/server/terminal_log/main.cc b/repos/os/src/server/terminal_log/main.cc index 4e6b27fe2..7cc22f8a6 100644 --- a/repos/os/src/server/terminal_log/main.cc +++ b/repos/os/src/server/terminal_log/main.cc @@ -107,7 +107,7 @@ namespace Genode { /* delete ram quota by the memory needed for the session */ size_t session_size = max((size_t)4096, sizeof(Termlog_component)); if (ram_quota < session_size) - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); char label_buf[Termlog_component::LABEL_LEN]; diff --git a/repos/os/src/server/trace_fs/main.cc b/repos/os/src/server/trace_fs/main.cc index e75c886d1..2de492781 100644 --- a/repos/os/src/server/trace_fs/main.cc +++ b/repos/os/src/server/trace_fs/main.cc @@ -1010,7 +1010,7 @@ class File_system::Root : public Root_component if (max((size_t)4096, session_size) > ram_quota) { Genode::error("insufficient 'ram_quota', got ", ram_quota, ", " "need ", session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } return new (md_alloc()) Session_component(tx_buf_size, _ep, _ram, _rm, _env, _root_dir, diff --git a/repos/os/src/server/vfs/main.cc b/repos/os/src/server/vfs/main.cc index 66bcdc2b4..6e4b0d702 100644 --- a/repos/os/src/server/vfs/main.cc +++ b/repos/os/src/server/vfs/main.cc @@ -671,7 +671,7 @@ class Vfs_server::Root : if (session_size > ram_quota) { error("insufficient 'ram_quota' from '", label, "' " "got ", ram_quota, ", need ", session_size); - throw Root::Quota_exceeded(); + throw Insufficient_ram_quota(); } ram_quota -= session_size; diff --git a/repos/ports/src/app/openvpn/main.cc b/repos/ports/src/app/openvpn/main.cc index 843b2468b..ee8f4ad96 100644 --- a/repos/ports/src/app/openvpn/main.cc +++ b/repos/ports/src/app/openvpn/main.cc @@ -219,7 +219,7 @@ class Root : public Genode::Root_component ram_quota - session_size) { Genode::error("insufficient 'ram_quota', got %ld, need %ld", ram_quota, tx_buf_size + rx_buf_size + session_size); - throw Genode::Root::Quota_exceeded(); + throw Genode::Insufficient_ram_quota(); } Openvpn_component *component = new (Root::md_alloc())