1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 19:05:08 +00:00

Kernel+LibC: Turn errno codes into a strongly typed enum

..and allow implicit creation of KResult and KResultOr from ErrnoCode.
This means that kernel functions that return those types can finally
do "return EINVAL;" and it will just work.

There's a handful of functions that still deal with signed integers
that should be converted to return KResults.
This commit is contained in:
Andreas Kling 2021-01-20 23:11:17 +01:00
parent e279b45aed
commit 19d3f8cab7
48 changed files with 591 additions and 506 deletions

View file

@ -143,7 +143,7 @@ InodeMetadata DevPtsFSInode::metadata() const
KResult DevPtsFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)> callback) const
{
if (identifier().index() > 1)
return KResult(-ENOTDIR);
return ENOTDIR;
callback({ ".", identifier(), 0 });
callback({ "..", identifier(), 0 });
@ -187,27 +187,27 @@ void DevPtsFSInode::flush_metadata()
KResult DevPtsFSInode::add_child(Inode&, const StringView&, mode_t)
{
return KResult(-EROFS);
return EROFS;
}
KResultOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(const String&, mode_t, dev_t, uid_t, gid_t)
{
return KResult(-EROFS);
return EROFS;
}
KResult DevPtsFSInode::remove_child(const StringView&)
{
return KResult(-EROFS);
return EROFS;
}
KResult DevPtsFSInode::chmod(mode_t)
{
return KResult(-EPERM);
return EPERM;
}
KResult DevPtsFSInode::chown(uid_t, gid_t)
{
return KResult(-EPERM);
return EPERM;
}
}