mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK+Kernel: Move KResult.h to Kernel/API for userspace access
This commit moves the KResult and KResultOr objects to Kernel/API to signify that they may now be freely used by userspace code at points where a syscall-related error result is to be expected. It also exposes KResult and KResultOr to the global namespace to make it nicer to use for userspace code.
This commit is contained in:
parent
d8de352ead
commit
566c5d1e99
Notes:
sideshowbarker
2024-07-18 04:44:10 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/566c5d1e99b Pull-request: https://github.com/SerenityOS/serenity/pull/9826
24 changed files with 28 additions and 25 deletions
|
@ -9,7 +9,7 @@
|
|||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/KResult.h>
|
||||
# include <Kernel/API/KResult.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
#include <AK/Traits.h>
|
||||
#include <AK/Types.h>
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/API/KResult.h>
|
||||
# include <Kernel/Arch/x86/Processor.h>
|
||||
# include <Kernel/Arch/x86/ScopedCritical.h>
|
||||
# include <Kernel/KResult.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
|
|
@ -173,8 +173,12 @@ private:
|
|||
|
||||
}
|
||||
|
||||
using Kernel::KResult;
|
||||
using Kernel::KResultOr;
|
||||
using Kernel::KSuccess;
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<Kernel::KResult> : Formatter<FormatString> {
|
||||
struct AK::Formatter<KResult> : Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, Kernel::KResult value)
|
||||
{
|
||||
if (value.is_error())
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Bus/USB/USBHub.h>
|
||||
#include <Kernel/Bus/USB/USBTransfer.h>
|
||||
#include <Kernel/KResult.h>
|
||||
|
||||
namespace Kernel::USB {
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/RefCounted.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Bus/USB/USBDevice.h>
|
||||
#include <Kernel/Bus/USB/USBTransfer.h>
|
||||
#include <Kernel/KResult.h>
|
||||
|
||||
namespace Kernel::USB {
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include <AK/RefPtr.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/API/KeyCode.h>
|
||||
#include <Kernel/API/MousePacket.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Locking/Spinlock.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <LibKeyboard/CharacterMap.h>
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/Heap/SlabAllocator.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/KString.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <Kernel/UserOrKernelBuffer.h>
|
||||
#include <Kernel/VirtualAddress.h>
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/FileSystem/InodeIdentifier.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Locking/Mutex.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <Kernel/UserOrKernelBuffer.h>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include "ISO9660FileSystem.h"
|
||||
#include "Kernel/FileSystem/BlockBasedFileSystem.h"
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/HashFunctions.h>
|
||||
|
@ -15,9 +14,9 @@
|
|||
#include <AK/StringHash.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/FileSystem/BlockBasedFileSystem.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KBuffer.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <Kernel/UserOrKernelBuffer.h>
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
#include <AK/RecursionDecision.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/FileSystem/BlockBasedFileSystem.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/KBuffer.h>
|
||||
#include <Kernel/KResult.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
#include <AK/IntrusiveList.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/FileSystem/FIFO.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/InodeIdentifier.h>
|
||||
#include <Kernel/FileSystem/InodeMetadata.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Library/ListedRefCounted.h>
|
||||
#include <Kernel/Locking/Mutex.h>
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Span.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/FileSystem/InodeIdentifier.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#include <AK/RefPtr.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KResult.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
#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>
|
||||
#include <Kernel/FileSystem/Mount.h>
|
||||
#include <Kernel/FileSystem/UnveilNode.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Locking/MutexProtected.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/VirtualAddress.h>
|
||||
|
||||
namespace Kernel::Memory {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Time.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Locking/Mutex.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include <AK/SinglyLinkedList.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Locking/MutexProtected.h>
|
||||
#include <Kernel/Net/IPv4Socket.h>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Locking/MutexProtected.h>
|
||||
#include <Kernel/Net/IPv4Socket.h>
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/KBuffer.h>
|
||||
#include <Kernel/KResult.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Arch/x86/CPU.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/KBufferBuilder.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/UserOrKernelBuffer.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/Forward.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Userspace.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/KString.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
#include <AK/Vector.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Arch/x86/RegisterState.h>
|
||||
#include <Kernel/Arch/x86/SafeMem.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/FileSystem/InodeIdentifier.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/KString.h>
|
||||
#include <Kernel/Library/ListedRefCounted.h>
|
||||
#include <Kernel/Locking/LockLocation.h>
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#include <AK/RefPtr.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/API/TimePage.h>
|
||||
#include <Kernel/Arch/x86/RegisterState.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
|
Loading…
Reference in a new issue