mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00
Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
This commit is contained in:
parent
7ee10c6926
commit
79fa9765ca
262 changed files with 2415 additions and 2600 deletions
|
@ -7,13 +7,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Error.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/InodeIdentifier.h>
|
||||
#include <Kernel/FileSystem/InodeMetadata.h>
|
||||
|
@ -42,29 +42,29 @@ public:
|
|||
VirtualFileSystem();
|
||||
~VirtualFileSystem();
|
||||
|
||||
KResult mount_root(FileSystem&);
|
||||
KResult mount(FileSystem&, Custody& mount_point, int flags);
|
||||
KResult bind_mount(Custody& source, Custody& mount_point, int flags);
|
||||
KResult remount(Custody& mount_point, int new_flags);
|
||||
KResult unmount(Inode& guest_inode);
|
||||
ErrorOr<void> mount_root(FileSystem&);
|
||||
ErrorOr<void> mount(FileSystem&, Custody& mount_point, int flags);
|
||||
ErrorOr<void> bind_mount(Custody& source, Custody& mount_point, int flags);
|
||||
ErrorOr<void> remount(Custody& mount_point, int new_flags);
|
||||
ErrorOr<void> unmount(Inode& guest_inode);
|
||||
|
||||
KResultOr<NonnullRefPtr<OpenFileDescription>> open(StringView path, int options, mode_t mode, Custody& base, Optional<UidAndGid> = {});
|
||||
KResultOr<NonnullRefPtr<OpenFileDescription>> create(StringView path, int options, mode_t mode, Custody& parent_custody, Optional<UidAndGid> = {});
|
||||
KResult mkdir(StringView path, mode_t mode, Custody& base);
|
||||
KResult link(StringView old_path, StringView new_path, Custody& base);
|
||||
KResult unlink(StringView path, Custody& base);
|
||||
KResult symlink(StringView target, StringView linkpath, Custody& base);
|
||||
KResult rmdir(StringView path, Custody& base);
|
||||
KResult chmod(StringView path, mode_t, Custody& base);
|
||||
KResult chmod(Custody&, mode_t);
|
||||
KResult chown(StringView path, UserID, GroupID, Custody& base);
|
||||
KResult chown(Custody&, UserID, GroupID);
|
||||
KResult access(StringView path, int mode, Custody& base);
|
||||
KResultOr<InodeMetadata> lookup_metadata(StringView path, Custody& base, int options = 0);
|
||||
KResult utime(StringView path, Custody& base, time_t atime, time_t mtime);
|
||||
KResult rename(StringView oldpath, StringView newpath, Custody& base);
|
||||
KResult mknod(StringView path, mode_t, dev_t, Custody& base);
|
||||
KResultOr<NonnullRefPtr<Custody>> open_directory(StringView path, Custody& base);
|
||||
ErrorOr<NonnullRefPtr<OpenFileDescription>> open(StringView path, int options, mode_t mode, Custody& base, Optional<UidAndGid> = {});
|
||||
ErrorOr<NonnullRefPtr<OpenFileDescription>> create(StringView path, int options, mode_t mode, Custody& parent_custody, Optional<UidAndGid> = {});
|
||||
ErrorOr<void> mkdir(StringView path, mode_t mode, Custody& base);
|
||||
ErrorOr<void> link(StringView old_path, StringView new_path, Custody& base);
|
||||
ErrorOr<void> unlink(StringView path, Custody& base);
|
||||
ErrorOr<void> symlink(StringView target, StringView linkpath, Custody& base);
|
||||
ErrorOr<void> rmdir(StringView path, Custody& base);
|
||||
ErrorOr<void> chmod(StringView path, mode_t, Custody& base);
|
||||
ErrorOr<void> chmod(Custody&, mode_t);
|
||||
ErrorOr<void> chown(StringView path, UserID, GroupID, Custody& base);
|
||||
ErrorOr<void> chown(Custody&, UserID, GroupID);
|
||||
ErrorOr<void> access(StringView path, int mode, Custody& base);
|
||||
ErrorOr<InodeMetadata> lookup_metadata(StringView path, Custody& base, int options = 0);
|
||||
ErrorOr<void> utime(StringView path, Custody& base, time_t atime, time_t mtime);
|
||||
ErrorOr<void> rename(StringView oldpath, StringView newpath, Custody& base);
|
||||
ErrorOr<void> mknod(StringView path, mode_t, dev_t, Custody& base);
|
||||
ErrorOr<NonnullRefPtr<Custody>> open_directory(StringView path, Custody& base);
|
||||
|
||||
void for_each_mount(Function<IterationDecision(const Mount&)>) const;
|
||||
|
||||
|
@ -73,19 +73,19 @@ public:
|
|||
static void sync();
|
||||
|
||||
Custody& root_custody();
|
||||
KResultOr<NonnullRefPtr<Custody>> resolve_path(StringView path, Custody& base, RefPtr<Custody>* out_parent = nullptr, int options = 0, int symlink_recursion_level = 0);
|
||||
KResultOr<NonnullRefPtr<Custody>> resolve_path_without_veil(StringView path, Custody& base, RefPtr<Custody>* out_parent = nullptr, int options = 0, int symlink_recursion_level = 0);
|
||||
ErrorOr<NonnullRefPtr<Custody>> resolve_path(StringView path, Custody& base, RefPtr<Custody>* out_parent = nullptr, int options = 0, int symlink_recursion_level = 0);
|
||||
ErrorOr<NonnullRefPtr<Custody>> resolve_path_without_veil(StringView path, Custody& base, RefPtr<Custody>* out_parent = nullptr, int options = 0, int symlink_recursion_level = 0);
|
||||
|
||||
private:
|
||||
friend class OpenFileDescription;
|
||||
|
||||
UnveilNode const& find_matching_unveiled_path(StringView path);
|
||||
KResult validate_path_against_process_veil(Custody const& path, int options);
|
||||
KResult validate_path_against_process_veil(StringView path, int options);
|
||||
ErrorOr<void> validate_path_against_process_veil(Custody const& path, int options);
|
||||
ErrorOr<void> validate_path_against_process_veil(StringView path, int options);
|
||||
|
||||
bool is_vfs_root(InodeIdentifier) const;
|
||||
|
||||
KResult traverse_directory_inode(Inode&, Function<bool(FileSystem::DirectoryEntryView const&)>);
|
||||
ErrorOr<void> traverse_directory_inode(Inode&, Function<bool(FileSystem::DirectoryEntryView const&)>);
|
||||
|
||||
Mount* find_mount_for_host(InodeIdentifier);
|
||||
Mount* find_mount_for_guest(InodeIdentifier);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue