diff options
| author | 2018-11-15 23:27:29 -0500 | |
|---|---|---|
| committer | 2018-11-16 00:13:50 -0500 | |
| commit | b725d1fdf7641661161815466a14ed7e8e26ce67 (patch) | |
| tree | f7db94a9c706a192288879fc2566b70298a7605f /src | |
| parent | Fixed priority switching edge case for handheld (#1675) (diff) | |
| download | yuzu-b725d1fdf7641661161815466a14ed7e8e26ce67.tar.gz yuzu-b725d1fdf7641661161815466a14ed7e8e26ce67.tar.xz yuzu-b725d1fdf7641661161815466a14ed7e8e26ce67.zip | |
file_sys/errors: Extract FS-related error codes to file_sys/errors.h
Keeps filesystem-related error codes in one spot.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/errors.h | 9 | ||||
| -rw-r--r-- | src/core/hle/result.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 16 |
4 files changed, 19 insertions, 14 deletions
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index fea0593c7..043fccf42 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h | |||
| @@ -11,9 +11,11 @@ namespace FileSys { | |||
| 11 | namespace ErrCodes { | 11 | namespace ErrCodes { |
| 12 | enum { | 12 | enum { |
| 13 | NotFound = 1, | 13 | NotFound = 1, |
| 14 | TitleNotFound = 1002, | 14 | EntityNotFound = 1002, |
| 15 | SdCardNotFound = 2001, | 15 | SdCardNotFound = 2001, |
| 16 | RomFSNotFound = 2520, | 16 | RomFSNotFound = 2520, |
| 17 | InvalidOffset = 6061, | ||
| 18 | InvalidSize = 6062, | ||
| 17 | }; | 19 | }; |
| 18 | } | 20 | } |
| 19 | 21 | ||
| @@ -29,4 +31,9 @@ constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(-1); | |||
| 29 | constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(-1); | 31 | constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(-1); |
| 30 | constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(-1); | 32 | constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(-1); |
| 31 | 33 | ||
| 34 | constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, ErrCodes::EntityNotFound}; | ||
| 35 | constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, ErrCodes::SdCardNotFound}; | ||
| 36 | constexpr ResultCode ERROR_INVALID_OFFSET{ErrorModule::FS, ErrCodes::InvalidOffset}; | ||
| 37 | constexpr ResultCode ERROR_INVALID_SIZE{ErrorModule::FS, ErrCodes::InvalidSize}; | ||
| 38 | |||
| 32 | } // namespace FileSys | 39 | } // namespace FileSys |
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index c6b18cfba..bfb77cc31 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h | |||
| @@ -19,8 +19,6 @@ | |||
| 19 | enum class ErrorDescription : u32 { | 19 | enum class ErrorDescription : u32 { |
| 20 | Success = 0, | 20 | Success = 0, |
| 21 | RemoteProcessDead = 301, | 21 | RemoteProcessDead = 301, |
| 22 | InvalidOffset = 6061, | ||
| 23 | InvalidLength = 6062, | ||
| 24 | }; | 22 | }; |
| 25 | 23 | ||
| 26 | /** | 24 | /** |
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index a92cf7815..554474cf6 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -303,7 +303,7 @@ ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space, | |||
| 303 | static_cast<u8>(space), save_struct.DebugInfo()); | 303 | static_cast<u8>(space), save_struct.DebugInfo()); |
| 304 | 304 | ||
| 305 | if (save_data_factory == nullptr) { | 305 | if (save_data_factory == nullptr) { |
| 306 | return ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound); | 306 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | return save_data_factory->Open(space, save_struct); | 309 | return save_data_factory->Open(space, save_struct); |
| @@ -313,7 +313,7 @@ ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space) | |||
| 313 | LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", static_cast<u8>(space)); | 313 | LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", static_cast<u8>(space)); |
| 314 | 314 | ||
| 315 | if (save_data_factory == nullptr) { | 315 | if (save_data_factory == nullptr) { |
| 316 | return ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound); | 316 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | return MakeResult(save_data_factory->GetSaveDataSpaceDirectory(space)); | 319 | return MakeResult(save_data_factory->GetSaveDataSpaceDirectory(space)); |
| @@ -323,7 +323,7 @@ ResultVal<FileSys::VirtualDir> OpenSDMC() { | |||
| 323 | LOG_TRACE(Service_FS, "Opening SDMC"); | 323 | LOG_TRACE(Service_FS, "Opening SDMC"); |
| 324 | 324 | ||
| 325 | if (sdmc_factory == nullptr) { | 325 | if (sdmc_factory == nullptr) { |
| 326 | return ResultCode(ErrorModule::FS, FileSys::ErrCodes::SdCardNotFound); | 326 | return FileSys::ERROR_SD_CARD_NOT_FOUND; |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | return sdmc_factory->Open(); | 329 | return sdmc_factory->Open(); |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index b9a1d5105..038dc80b1 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -63,12 +63,12 @@ private: | |||
| 63 | // Error checking | 63 | // Error checking |
| 64 | if (length < 0) { | 64 | if (length < 0) { |
| 65 | IPC::ResponseBuilder rb{ctx, 2}; | 65 | IPC::ResponseBuilder rb{ctx, 2}; |
| 66 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength)); | 66 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 67 | return; | 67 | return; |
| 68 | } | 68 | } |
| 69 | if (offset < 0) { | 69 | if (offset < 0) { |
| 70 | IPC::ResponseBuilder rb{ctx, 2}; | 70 | IPC::ResponseBuilder rb{ctx, 2}; |
| 71 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset)); | 71 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| @@ -108,12 +108,12 @@ private: | |||
| 108 | // Error checking | 108 | // Error checking |
| 109 | if (length < 0) { | 109 | if (length < 0) { |
| 110 | IPC::ResponseBuilder rb{ctx, 2}; | 110 | IPC::ResponseBuilder rb{ctx, 2}; |
| 111 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength)); | 111 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 112 | return; | 112 | return; |
| 113 | } | 113 | } |
| 114 | if (offset < 0) { | 114 | if (offset < 0) { |
| 115 | IPC::ResponseBuilder rb{ctx, 2}; | 115 | IPC::ResponseBuilder rb{ctx, 2}; |
| 116 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset)); | 116 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 117 | return; | 117 | return; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| @@ -139,12 +139,12 @@ private: | |||
| 139 | // Error checking | 139 | // Error checking |
| 140 | if (length < 0) { | 140 | if (length < 0) { |
| 141 | IPC::ResponseBuilder rb{ctx, 2}; | 141 | IPC::ResponseBuilder rb{ctx, 2}; |
| 142 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength)); | 142 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 143 | return; | 143 | return; |
| 144 | } | 144 | } |
| 145 | if (offset < 0) { | 145 | if (offset < 0) { |
| 146 | IPC::ResponseBuilder rb{ctx, 2}; | 146 | IPC::ResponseBuilder rb{ctx, 2}; |
| 147 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset)); | 147 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 148 | return; | 148 | return; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| @@ -744,7 +744,7 @@ void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { | |||
| 744 | 744 | ||
| 745 | if (dir.Failed()) { | 745 | if (dir.Failed()) { |
| 746 | IPC::ResponseBuilder rb{ctx, 2, 0, 0}; | 746 | IPC::ResponseBuilder rb{ctx, 2, 0, 0}; |
| 747 | rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound)); | 747 | rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); |
| 748 | return; | 748 | return; |
| 749 | } | 749 | } |
| 750 | 750 | ||
| @@ -836,7 +836,7 @@ void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) { | |||
| 836 | static_cast<u8>(storage_id), title_id); | 836 | static_cast<u8>(storage_id), title_id); |
| 837 | 837 | ||
| 838 | IPC::ResponseBuilder rb{ctx, 2}; | 838 | IPC::ResponseBuilder rb{ctx, 2}; |
| 839 | rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound)); | 839 | rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); |
| 840 | } | 840 | } |
| 841 | 841 | ||
| 842 | } // namespace Service::FileSystem | 842 | } // namespace Service::FileSystem |