mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 15:18:20 +00:00
Streamline exception types
This patch reduces the number of exception types by facilitating globally defined exceptions for common usage patterns shared by most services. In particular, RPC functions that demand a session-resource upgrade not longer reflect this condition via a session-specific exception but via the 'Out_of_ram' or 'Out_of_caps' types. Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable', 'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args', 'Service::Unavailable', and 'Local_service::Factory::Denied' types have been replaced by the single 'Service_denied' exception type defined in 'session/session.h'. This consolidation eases the error handling (there are fewer exceptions to handle), alleviates the need to convert exceptions along the session-creation call chain, and avoids possible aliasing problems (catching the wrong type with the same name but living in a different scope).
This commit is contained in:
committed by
Christian Helmuth
parent
1f4f119b1e
commit
4d442bca30
@ -369,8 +369,9 @@ class Vfs::Fs_file_system : public File_system
|
||||
Fs_handle_guard node_guard(*this, _fs, node, _handle_space);
|
||||
status = _fs.status(node);
|
||||
}
|
||||
catch (::File_system::Lookup_failed) { return STAT_ERR_NO_ENTRY; }
|
||||
catch (::File_system::Out_of_metadata) { return STAT_ERR_NO_PERM; }
|
||||
catch (::File_system::Lookup_failed) { return STAT_ERR_NO_ENTRY; }
|
||||
catch (Genode::Out_of_ram) { return STAT_ERR_NO_PERM; }
|
||||
catch (Genode::Out_of_caps) { return STAT_ERR_NO_PERM; }
|
||||
|
||||
out = Stat();
|
||||
|
||||
@ -532,7 +533,8 @@ class Vfs::Fs_file_system : public File_system
|
||||
catch (::File_system::Lookup_failed) { return MKDIR_ERR_NO_ENTRY; }
|
||||
catch (::File_system::Name_too_long) { return MKDIR_ERR_NAME_TOO_LONG; }
|
||||
catch (::File_system::No_space) { return MKDIR_ERR_NO_SPACE; }
|
||||
catch (::File_system::Out_of_metadata) { return MKDIR_ERR_NO_ENTRY; }
|
||||
catch (::File_system::Out_of_ram) { return MKDIR_ERR_NO_ENTRY; }
|
||||
catch (::File_system::Out_of_caps) { return MKDIR_ERR_NO_ENTRY; }
|
||||
|
||||
return MKDIR_OK;
|
||||
}
|
||||
@ -570,7 +572,8 @@ class Vfs::Fs_file_system : public File_system
|
||||
catch (::File_system::Lookup_failed) { return SYMLINK_ERR_NO_ENTRY; }
|
||||
catch (::File_system::Permission_denied) { return SYMLINK_ERR_NO_PERM; }
|
||||
catch (::File_system::No_space) { return SYMLINK_ERR_NO_SPACE; }
|
||||
catch (::File_system::Out_of_metadata) { return SYMLINK_ERR_NO_ENTRY; }
|
||||
catch (::File_system::Out_of_ram) { return SYMLINK_ERR_NO_ENTRY; }
|
||||
catch (::File_system::Out_of_caps) { return SYMLINK_ERR_NO_ENTRY; }
|
||||
|
||||
return SYMLINK_OK;
|
||||
}
|
||||
@ -653,7 +656,8 @@ class Vfs::Fs_file_system : public File_system
|
||||
catch (::File_system::Invalid_name) { return OPEN_ERR_NAME_TOO_LONG; }
|
||||
catch (::File_system::Name_too_long) { return OPEN_ERR_NAME_TOO_LONG; }
|
||||
catch (::File_system::No_space) { return OPEN_ERR_NO_SPACE; }
|
||||
catch (::File_system::Out_of_metadata) { return OPEN_ERR_NO_PERM; }
|
||||
catch (::File_system::Out_of_ram) { return OPEN_ERR_NO_PERM; }
|
||||
catch (::File_system::Out_of_caps) { return OPEN_ERR_NO_PERM; }
|
||||
|
||||
return OPEN_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user