diff options
author | bunnei <bunneidev@gmail.com> | 2017-11-01 00:26:11 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2017-11-01 00:26:11 +0100 |
commit | 34571f4d2e80a3194a3c4cb697dba674d11a35b4 (patch) | |
tree | b2b4b70d7a5bdea95ef5d44733eedf7e6b3b7009 /src/core/file_sys | |
parent | externals: Update dynarmic and xbyak. (diff) | |
download | yuzu-34571f4d2e80a3194a3c4cb697dba674d11a35b4.tar yuzu-34571f4d2e80a3194a3c4cb697dba674d11a35b4.tar.gz yuzu-34571f4d2e80a3194a3c4cb697dba674d11a35b4.tar.bz2 yuzu-34571f4d2e80a3194a3c4cb697dba674d11a35b4.tar.lz yuzu-34571f4d2e80a3194a3c4cb697dba674d11a35b4.tar.xz yuzu-34571f4d2e80a3194a3c4cb697dba674d11a35b4.tar.zst yuzu-34571f4d2e80a3194a3c4cb697dba674d11a35b4.zip |
Diffstat (limited to 'src/core/file_sys')
-rw-r--r-- | src/core/file_sys/errors.h | 66 | ||||
-rw-r--r-- | src/core/file_sys/ivfc_archive.cpp | 10 | ||||
-rw-r--r-- | src/core/file_sys/savedata_archive.cpp | 22 |
3 files changed, 24 insertions, 74 deletions
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index a974bc775..be3224ef8 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h @@ -34,61 +34,15 @@ enum { }; } -constexpr ResultCode ERROR_INVALID_PATH(ErrCodes::InvalidPath, ErrorModule::FS, - ErrorSummary::InvalidArgument, ErrorLevel::Usage); -constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(ErrCodes::UnsupportedOpenFlags, ErrorModule::FS, - ErrorSummary::NotSupported, ErrorLevel::Usage); -constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(ErrCodes::InvalidOpenFlags, ErrorModule::FS, - ErrorSummary::Canceled, ErrorLevel::Status); -constexpr ResultCode ERROR_INVALID_READ_FLAG(ErrCodes::InvalidReadFlag, ErrorModule::FS, - ErrorSummary::InvalidArgument, ErrorLevel::Usage); -constexpr ResultCode ERROR_FILE_NOT_FOUND(ErrCodes::FileNotFound, ErrorModule::FS, - ErrorSummary::NotFound, ErrorLevel::Status); -constexpr ResultCode ERROR_PATH_NOT_FOUND(ErrCodes::PathNotFound, ErrorModule::FS, - ErrorSummary::NotFound, ErrorLevel::Status); -constexpr ResultCode ERROR_NOT_FOUND(ErrCodes::NotFound, ErrorModule::FS, ErrorSummary::NotFound, - ErrorLevel::Status); -constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ErrCodes::UnexpectedFileOrDirectory, - ErrorModule::FS, ErrorSummary::NotSupported, - ErrorLevel::Usage); -constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC(ErrCodes::NotAFile, ErrorModule::FS, - ErrorSummary::Canceled, - ErrorLevel::Status); -constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(ErrCodes::DirectoryAlreadyExists, - ErrorModule::FS, ErrorSummary::NothingHappened, - ErrorLevel::Status); -constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(ErrCodes::FileAlreadyExists, ErrorModule::FS, - ErrorSummary::NothingHappened, ErrorLevel::Status); -constexpr ResultCode ERROR_ALREADY_EXISTS(ErrCodes::AlreadyExists, ErrorModule::FS, - ErrorSummary::NothingHappened, ErrorLevel::Status); -constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(ErrCodes::DirectoryNotEmpty, ErrorModule::FS, - ErrorSummary::Canceled, ErrorLevel::Status); -constexpr ResultCode ERROR_GAMECARD_NOT_INSERTED(ErrCodes::GameCardNotInserted, ErrorModule::FS, - ErrorSummary::NotFound, ErrorLevel::Status); -constexpr ResultCode ERROR_INCORRECT_EXEFS_READ_SIZE(ErrCodes::IncorrectExeFSReadSize, - ErrorModule::FS, ErrorSummary::NotSupported, - ErrorLevel::Usage); -constexpr ResultCode ERROR_ROMFS_NOT_FOUND(ErrCodes::RomFSNotFound, ErrorModule::FS, - ErrorSummary::NotFound, ErrorLevel::Status); -constexpr ResultCode ERROR_COMMAND_NOT_ALLOWED(ErrCodes::CommandNotAllowed, ErrorModule::FS, - ErrorSummary::WrongArgument, ErrorLevel::Permanent); -constexpr ResultCode ERROR_EXEFS_SECTION_NOT_FOUND(ErrCodes::ExeFSSectionNotFound, ErrorModule::FS, - ErrorSummary::NotFound, ErrorLevel::Status); - -/// Returned when a function is passed an invalid archive handle. -constexpr ResultCode ERR_INVALID_ARCHIVE_HANDLE(ErrCodes::ArchiveNotMounted, ErrorModule::FS, - ErrorSummary::NotFound, - ErrorLevel::Status); // 0xC8804465 -constexpr ResultCode ERR_WRITE_BEYOND_END(ErrCodes::WriteBeyondEnd, ErrorModule::FS, - ErrorSummary::InvalidArgument, ErrorLevel::Usage); - -/** - * Variant of ERROR_NOT_FOUND returned in some places in the code. Unknown if these usages are - * correct or a bug. - */ -constexpr ResultCode ERR_NOT_FOUND_INVALID_STATE(ErrCodes::NotFound, ErrorModule::FS, - ErrorSummary::InvalidState, ErrorLevel::Status); -constexpr ResultCode ERR_NOT_FORMATTED(ErrCodes::NotFormatted, ErrorModule::FS, - ErrorSummary::InvalidState, ErrorLevel::Status); +// TODO(bunnei): Replace these with correct errors for Switch OS +constexpr ResultCode ERROR_INVALID_PATH(ResultCode(-1)); +constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(ResultCode(-1)); +constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(ResultCode(-1)); +constexpr ResultCode ERROR_FILE_NOT_FOUND(ResultCode(-1)); +constexpr ResultCode ERROR_PATH_NOT_FOUND(ResultCode(-1)); +constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ResultCode(-1)); +constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(ResultCode(-1)); +constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(ResultCode(-1)); +constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(ResultCode(-1)); } // namespace FileSys diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp index 2735d2e3c..b3c3f2c6f 100644 --- a/src/core/file_sys/ivfc_archive.cpp +++ b/src/core/file_sys/ivfc_archive.cpp @@ -26,9 +26,8 @@ ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path, ResultCode IVFCArchive::DeleteFile(const Path& path) const { LOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive (%s).", GetName().c_str()); - // TODO(Subv): Verify error code - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled, - ErrorLevel::Status); + // TODO(bunnei): Use correct error code + return ResultCode(-1); } ResultCode IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const { @@ -55,9 +54,8 @@ ResultCode IVFCArchive::DeleteDirectoryRecursively(const Path& path) const { ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const { LOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive (%s).", GetName().c_str()); - // TODO: Verify error code - return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported, - ErrorLevel::Permanent); + // TODO(bunnei): Use correct error code + return ResultCode(-1); } ResultCode IVFCArchive::CreateDirectory(const Path& path) const { diff --git a/src/core/file_sys/savedata_archive.cpp b/src/core/file_sys/savedata_archive.cpp index f8f811ba0..d7b012f6e 100644 --- a/src/core/file_sys/savedata_archive.cpp +++ b/src/core/file_sys/savedata_archive.cpp @@ -128,10 +128,8 @@ ResultCode SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_pa return RESULT_SUCCESS; } - // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't - // exist or similar. Verify. - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description - ErrorSummary::NothingHappened, ErrorLevel::Status); + // TODO(bunnei): Use correct error code + return ResultCode(-1); } template <typename T> @@ -223,8 +221,9 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons } LOG_ERROR(Service_FS, "Too large file"); - return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource, - ErrorLevel::Info); + + // TODO(bunnei): Use correct error code + return ResultCode(-1); } ResultCode SaveDataArchive::CreateDirectory(const Path& path) const { @@ -260,8 +259,9 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const { } LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating %s", mount_point.c_str()); - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled, - ErrorLevel::Status); + + // TODO(bunnei): Use correct error code + return ResultCode(-1); } ResultCode SaveDataArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const { @@ -287,10 +287,8 @@ ResultCode SaveDataArchive::RenameDirectory(const Path& src_path, const Path& de return RESULT_SUCCESS; } - // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't - // exist or similar. Verify. - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description - ErrorSummary::NothingHappened, ErrorLevel::Status); + // TODO(bunnei): Use correct error code + return ResultCode(-1); } ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory( |