From d21b2164e9bf431a5f6d6a45576cc788646e6489 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 16 Nov 2018 14:24:27 -0500 Subject: kernel/errors: Clean up error codes Similar to PR 1706, which cleans up the error codes for the filesystem code, but done for the kernel error codes. This removes the ErrCodes namespace and specifies the errors directly. This also fixes up any straggling lines of code that weren't using the named error codes where applicable. --- src/core/hle/kernel/errors.h | 74 +++++++++++++------------------------------- 1 file changed, 22 insertions(+), 52 deletions(-) (limited to 'src/core/hle/kernel/errors.h') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index ee698c8a7..8b58d701d 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -8,58 +8,28 @@ namespace Kernel { -namespace ErrCodes { -enum { - // Confirmed Switch OS error codes - MaxConnectionsReached = 7, - InvalidSize = 101, - InvalidAddress = 102, - HandleTableFull = 105, - InvalidMemoryState = 106, - InvalidMemoryPermissions = 108, - InvalidMemoryRange = 110, - InvalidThreadPriority = 112, - InvalidProcessorId = 113, - InvalidHandle = 114, - InvalidPointer = 115, - InvalidCombination = 116, - Timeout = 117, - SynchronizationCanceled = 118, - TooLarge = 119, - InvalidEnumValue = 120, - NoSuchEntry = 121, - AlreadyRegistered = 122, - SessionClosed = 123, - InvalidState = 125, - ResourceLimitExceeded = 132, -}; -} +// Confirmed Switch kernel error codes -// WARNING: The kernel is quite inconsistent in it's usage of errors code. Make sure to always -// double check that the code matches before re-using the constant. - -constexpr ResultCode ERR_HANDLE_TABLE_FULL(ErrorModule::Kernel, ErrCodes::HandleTableFull); -constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(ErrorModule::Kernel, ErrCodes::SessionClosed); -constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrorModule::Kernel, ErrCodes::TooLarge); -constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(ErrorModule::Kernel, - ErrCodes::MaxConnectionsReached); -constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorModule::Kernel, ErrCodes::InvalidEnumValue); -constexpr ResultCode ERR_INVALID_COMBINATION_KERNEL(ErrorModule::Kernel, - ErrCodes::InvalidCombination); -constexpr ResultCode ERR_INVALID_ADDRESS(ErrorModule::Kernel, ErrCodes::InvalidAddress); -constexpr ResultCode ERR_INVALID_ADDRESS_STATE(ErrorModule::Kernel, ErrCodes::InvalidMemoryState); -constexpr ResultCode ERR_INVALID_MEMORY_PERMISSIONS(ErrorModule::Kernel, - ErrCodes::InvalidMemoryPermissions); -constexpr ResultCode ERR_INVALID_MEMORY_RANGE(ErrorModule::Kernel, ErrCodes::InvalidMemoryRange); -constexpr ResultCode ERR_INVALID_HANDLE(ErrorModule::Kernel, ErrCodes::InvalidHandle); -constexpr ResultCode ERR_INVALID_PROCESSOR_ID(ErrorModule::Kernel, ErrCodes::InvalidProcessorId); -constexpr ResultCode ERR_INVALID_SIZE(ErrorModule::Kernel, ErrCodes::InvalidSize); -constexpr ResultCode ERR_ALREADY_REGISTERED(ErrorModule::Kernel, ErrCodes::AlreadyRegistered); -constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidState); -constexpr ResultCode ERR_INVALID_THREAD_PRIORITY(ErrorModule::Kernel, - ErrCodes::InvalidThreadPriority); -constexpr ResultCode ERR_INVALID_POINTER(ErrorModule::Kernel, ErrCodes::InvalidPointer); -constexpr ResultCode ERR_NOT_FOUND(ErrorModule::Kernel, ErrCodes::NoSuchEntry); -constexpr ResultCode RESULT_TIMEOUT(ErrorModule::Kernel, ErrCodes::Timeout); +constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED{ErrorModule::Kernel, 7}; +constexpr ResultCode ERR_INVALID_SIZE{ErrorModule::Kernel, 101}; +constexpr ResultCode ERR_INVALID_ADDRESS{ErrorModule::Kernel, 102}; +constexpr ResultCode ERR_HANDLE_TABLE_FULL{ErrorModule::Kernel, 105}; +constexpr ResultCode ERR_INVALID_ADDRESS_STATE{ErrorModule::Kernel, 106}; +constexpr ResultCode ERR_INVALID_MEMORY_PERMISSIONS{ErrorModule::Kernel, 108}; +constexpr ResultCode ERR_INVALID_MEMORY_RANGE{ErrorModule::Kernel, 110}; +constexpr ResultCode ERR_INVALID_PROCESSOR_ID{ErrorModule::Kernel, 113}; +constexpr ResultCode ERR_INVALID_THREAD_PRIORITY{ErrorModule::Kernel, 112}; +constexpr ResultCode ERR_INVALID_HANDLE{ErrorModule::Kernel, 114}; +constexpr ResultCode ERR_INVALID_POINTER{ErrorModule::Kernel, 115}; +constexpr ResultCode ERR_INVALID_COMBINATION{ErrorModule::Kernel, 116}; +constexpr ResultCode RESULT_TIMEOUT{ErrorModule::Kernel, 117}; +constexpr ResultCode ERR_SYNCHRONIZATION_CANCELED{ErrorModule::Kernel, 118}; +constexpr ResultCode ERR_OUT_OF_RANGE{ErrorModule::Kernel, 119}; +constexpr ResultCode ERR_INVALID_ENUM_VALUE{ErrorModule::Kernel, 120}; +constexpr ResultCode ERR_NOT_FOUND{ErrorModule::Kernel, 121}; +constexpr ResultCode ERR_ALREADY_REGISTERED{ErrorModule::Kernel, 122}; +constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE{ErrorModule::Kernel, 123}; +constexpr ResultCode ERR_INVALID_STATE{ErrorModule::Kernel, 125}; +constexpr ResultCode ERR_RESOURCE_LIMIT_EXCEEDED{ErrorModule::Kernel, 132}; } // namespace Kernel -- cgit v1.2.3