From 82620f95a3aa8476240c16176dd112efd6e98d75 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 13 Mar 2022 01:51:42 -0800 Subject: [PATCH] fs: revise allocation-fail result names --- .../common/fs_dbm_rom_key_value_storage.hpp | 2 +- .../include/stratosphere/fs/fs_path.hpp | 4 +- .../fs/fs_read_only_filesystem.hpp | 2 +- .../stratosphere/fs/fs_remote_filesystem.hpp | 4 +- .../fssrv/impl/fssrv_external_key_manager.hpp | 2 +- ...rv_impl_program_index_map_info_manager.hpp | 2 +- .../impl/fssystem_block_cache_manager.hpp | 2 +- .../source/fs/fs_application.cpp | 2 +- .../libstratosphere/source/fs/fs_bis.cpp | 6 +- .../libstratosphere/source/fs/fs_code.cpp | 14 +- .../libstratosphere/source/fs/fs_content.cpp | 2 +- .../source/fs/fs_content_storage.cpp | 4 +- .../libstratosphere/source/fs/fs_data.cpp | 4 +- .../source/fs/fs_device_save_data.cpp | 2 +- .../source/fs/fs_game_card.cpp | 4 +- .../libstratosphere/source/fs/fs_host.cpp | 8 +- .../source/fs/fs_image_directory.cpp | 2 +- .../source/fs/fs_romfs_filesystem.cpp | 14 +- .../libstratosphere/source/fs/fs_sd_card.cpp | 10 +- .../source/fs/fs_system_save_data.cpp | 2 +- .../source/fs/fsa/fs_filesystem_accessor.cpp | 4 +- .../source/fs/fsa/fs_registrar.cpp | 6 +- .../source/fs/fsa/fs_user_filesystem.cpp | 2 +- .../fs_file_system_service_object_adapter.hpp | 4 +- .../fssrv_local_file_system_creator.cpp | 2 +- .../fssrv_partition_file_system_creator.cpp | 2 +- .../fssrv_rom_file_system_creator.cpp | 2 +- .../fssrv_storage_on_nca_creator.cpp | 2 +- ...fssrv_subdirectory_file_system_creator.cpp | 2 +- .../fssrv/fssrv_file_system_proxy_impl.cpp | 2 +- .../fssrv_filesystem_interface_adapter.cpp | 12 +- .../impl/fssrv_program_registry_manager.cpp | 4 +- .../fssystem_file_system_buddy_heap.cpp | 2 +- .../fssystem_file_system_buffer_manager.cpp | 2 +- ...ystem_aes_ctr_counter_extended_storage.cpp | 4 +- .../fssystem_block_cache_buffered_storage.cpp | 6 +- .../fssystem/fssystem_buffered_storage.cpp | 6 +- ...fssystem_directory_savedata_filesystem.cpp | 2 +- .../fssystem_integrity_romfs_storage.cpp | 2 +- ...ssystem_integrity_verification_storage.cpp | 4 +- .../fssystem/fssystem_key_slot_cache.hpp | 2 +- .../fssystem/fssystem_local_file_system.cpp | 18 +- .../fssystem_nca_file_system_driver.cpp | 70 +++--- .../source/fssystem/fssystem_nca_reader.cpp | 4 +- .../fssystem_partition_file_system.cpp | 6 +- .../fssystem_partition_file_system_meta.cpp | 4 +- .../fssystem/fssystem_romfs_filesystem.cpp | 14 +- .../include/vapours/results/fs_results.hpp | 228 ++++++++++++------ .../source/sysupdater/sysupdater_fs_utils.cpp | 10 +- .../source/sysupdater/sysupdater_service.cpp | 2 +- 50 files changed, 304 insertions(+), 218 deletions(-) diff --git a/libraries/libstratosphere/include/stratosphere/fs/common/fs_dbm_rom_key_value_storage.hpp b/libraries/libstratosphere/include/stratosphere/fs/common/fs_dbm_rom_key_value_storage.hpp index c4b82ab77..1304420cb 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/common/fs_dbm_rom_key_value_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/common/fs_dbm_rom_key_value_storage.hpp @@ -203,7 +203,7 @@ namespace ams::fs { R_UNLESS(cur != InvalidPosition, fs::ResultDbmKeyNotFound()); u8 *buf = static_cast(::ams::fs::impl::Allocate(MaxAuxiliarySize)); - R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInDbmRomKeyValueStorage()); + R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedInDbmRomKeyValueStorage()); ON_SCOPE_EXIT { ::ams::fs::impl::Deallocate(buf, MaxAuxiliarySize); }; while (true) { diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp index a3f5a85b5..6a6ab20b0 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp @@ -434,7 +434,7 @@ namespace ams::fs { /* Allocate a new buffer. */ const size_t size = util::AlignUp(len, WriteBufferAlignmentLength); auto buf = fs::impl::MakeUnique(size); - R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Normalize into it. */ R_TRY(PathFormatter::Normalize(buf.get(), size, util::GetReference(m_write_buffer).get(), m_write_buffer_length, flags)); @@ -480,7 +480,7 @@ namespace ams::fs { /* Allocate buffer. */ const size_t size = util::AlignUp(length, WriteBufferAlignmentLength); auto buf = fs::impl::MakeUnique(size); - R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Set write buffer. */ this->SetModifiableBuffer(std::move(buf), size); diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp index 372e73a35..d549ca909 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp @@ -95,7 +95,7 @@ namespace ams::fs { R_TRY(m_base_fs->OpenFile(std::addressof(base_file), path, mode)); auto read_only_file = std::make_unique(std::move(base_file)); - R_UNLESS(read_only_file != nullptr, fs::ResultAllocationFailureInReadOnlyFileSystemA()); + R_UNLESS(read_only_file != nullptr, fs::ResultAllocationMemoryFailedInReadOnlyFileSystemA()); *out_file = std::move(read_only_file); return ResultSuccess(); diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp index e169a542d..0bf3e17fe 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp @@ -178,7 +178,7 @@ namespace ams::fs { R_TRY(fsFsOpenFile(std::addressof(m_base_fs), sf_path.str, mode, std::addressof(f))); auto file = std::make_unique(f); - R_UNLESS(file != nullptr, fs::ResultAllocationFailureInNew()); + R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedNew()); *out_file = std::move(file); return ResultSuccess(); @@ -192,7 +192,7 @@ namespace ams::fs { R_TRY(fsFsOpenDirectory(std::addressof(m_base_fs), sf_path.str, mode, std::addressof(d))); auto dir = std::make_unique(d); - R_UNLESS(dir != nullptr, fs::ResultAllocationFailureInNew()); + R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedNew()); *out_dir = std::move(dir); return ResultSuccess(); diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/impl/fssrv_external_key_manager.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/impl/fssrv_external_key_manager.hpp index 0cd54c069..a4918709b 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/impl/fssrv_external_key_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/impl/fssrv_external_key_manager.hpp @@ -69,7 +69,7 @@ namespace ams::fssrv::impl { } else { /* Make a new entry. */ auto *entry = new ExternalKeyEntry(rights_id, access_key); - R_UNLESS(entry != nullptr, fs::ResultAllocationFailure()); + R_UNLESS(entry != nullptr, fs::ResultAllocationMemoryFailed()); /* Add the entry to our list. */ m_key_list.push_back(*entry); diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/impl/fssrv_impl_program_index_map_info_manager.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/impl/fssrv_impl_program_index_map_info_manager.hpp index 3973cb23e..c428e04f9 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/impl/fssrv_impl_program_index_map_info_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/impl/fssrv_impl_program_index_map_info_manager.hpp @@ -104,7 +104,7 @@ namespace ams::fssrv::impl { for (int i = 0; i < count; ++i) { /* Allocate new entry. */ auto *entry = new ProgramIndexMapInfoEntry; - R_UNLESS(entry != nullptr, fs::ResultAllocationFailureInNew()); + R_UNLESS(entry != nullptr, fs::ResultAllocationMemoryFailedNew()); /* Copy over the info. */ entry->program_id = infos[i].program_id; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/impl/fssystem_block_cache_manager.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/impl/fssystem_block_cache_manager.hpp index cbd4f5cb2..1ac71bc30 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/impl/fssystem_block_cache_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/impl/fssystem_block_cache_manager.hpp @@ -50,7 +50,7 @@ namespace ams::fssystem::impl { if (max_entries > 0) { /* Create the entries. */ m_entries = fs::impl::MakeUnique(static_cast(max_entries)); - R_UNLESS(m_entries != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(m_entries != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Clear the entries. */ std::memset(m_entries.get(), 0, sizeof(CacheEntry) * max_entries); diff --git a/libraries/libstratosphere/source/fs/fs_application.cpp b/libraries/libstratosphere/source/fs/fs_application.cpp index ec6f0ef3c..39d99483a 100644 --- a/libraries/libstratosphere/source/fs/fs_application.cpp +++ b/libraries/libstratosphere/source/fs/fs_application.cpp @@ -39,7 +39,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInApplicationA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInApplicationA()); /* Register. */ R_RETURN(fsa::Register(name, std::move(fsa))); diff --git a/libraries/libstratosphere/source/fs/fs_bis.cpp b/libraries/libstratosphere/source/fs/fs_bis.cpp index f85d403b4..25e210867 100644 --- a/libraries/libstratosphere/source/fs/fs_bis.cpp +++ b/libraries/libstratosphere/source/fs/fs_bis.cpp @@ -66,11 +66,11 @@ namespace ams::fs { /* Allocate a new mountname generator. */ auto generator = std::make_unique(id); - R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInBisA()); + R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInBisA()); /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInBisB()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInBisB()); /* Register. */ R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator))); @@ -122,7 +122,7 @@ namespace ams::fs { /* Allocate a new storage wrapper. */ auto storage = std::make_unique(std::move(s)); - AMS_FS_R_UNLESS(storage != nullptr, fs::ResultAllocationFailureInBisC()); + AMS_FS_R_UNLESS(storage != nullptr, fs::ResultAllocationMemoryFailedInBisC()); *out = std::move(storage); R_SUCCEED(); diff --git a/libraries/libstratosphere/source/fs/fs_code.cpp b/libraries/libstratosphere/source/fs/fs_code.cpp index 36b4e70de..c70023930 100644 --- a/libraries/libstratosphere/source/fs/fs_code.cpp +++ b/libraries/libstratosphere/source/fs/fs_code.cpp @@ -83,7 +83,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInCodeA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInCodeA()); *out = std::move(fsa); R_SUCCEED(); @@ -97,7 +97,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInCodeA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInCodeA()); *out = std::move(fsa); R_SUCCEED(); @@ -135,11 +135,11 @@ namespace ams::fs { /* Create a file storage for the program's package. */ auto package_storage = std::make_shared(std::move(package_file)); - R_UNLESS(package_storage != nullptr, fs::ResultAllocationFailureInCodeA()); + R_UNLESS(package_storage != nullptr, fs::ResultAllocationMemoryFailedInCodeA()); /* Create a partition filesystem. */ auto package_fs = std::make_unique(); - R_UNLESS(package_fs != nullptr, fs::ResultAllocationFailureInCodeA()); + R_UNLESS(package_fs != nullptr, fs::ResultAllocationMemoryFailedInCodeA()); /* Initialize the partition filesystem. */ R_TRY(package_fs->Initialize(package_storage)); @@ -178,7 +178,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_shared(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInCodeA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInCodeA()); *out = std::move(fsa); R_SUCCEED(); @@ -427,7 +427,7 @@ namespace ams::fs { /* Create an AtmosphereCodeFileSystem. */ auto ams_code_fs = std::make_unique(); - R_UNLESS(ams_code_fs != nullptr, fs::ResultAllocationFailureInCodeA()); + R_UNLESS(ams_code_fs != nullptr, fs::ResultAllocationMemoryFailedInCodeA()); /* Initialize the code file system. */ R_TRY(ams_code_fs->Initialize(out, path, program_id, is_hbl, is_specific)); @@ -462,7 +462,7 @@ namespace ams::fs { /* Create a wrapper fs. */ auto wrap_fsa = std::make_unique(std::move(fsa), program_id, false); - R_UNLESS(wrap_fsa != nullptr, fs::ResultAllocationFailureInCodeA()); + R_UNLESS(wrap_fsa != nullptr, fs::ResultAllocationMemoryFailedInCodeA()); /* Register. */ R_RETURN(fsa::Register(name, std::move(wrap_fsa))); diff --git a/libraries/libstratosphere/source/fs/fs_content.cpp b/libraries/libstratosphere/source/fs/fs_content.cpp index ce6c61717..f343862c6 100644 --- a/libraries/libstratosphere/source/fs/fs_content.cpp +++ b/libraries/libstratosphere/source/fs/fs_content.cpp @@ -50,7 +50,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInContentA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInContentA()); /* Register. */ R_RETURN(fsa::Register(name, std::move(fsa))); diff --git a/libraries/libstratosphere/source/fs/fs_content_storage.cpp b/libraries/libstratosphere/source/fs/fs_content_storage.cpp index b2f580505..be89a7041 100644 --- a/libraries/libstratosphere/source/fs/fs_content_storage.cpp +++ b/libraries/libstratosphere/source/fs/fs_content_storage.cpp @@ -90,11 +90,11 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInContentStorageA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInContentStorageA()); /* Allocate a new mountname generator. */ auto generator = std::make_unique(id); - R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInContentStorageB()); + R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInContentStorageB()); /* Register. */ R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator))); diff --git a/libraries/libstratosphere/source/fs/fs_data.cpp b/libraries/libstratosphere/source/fs/fs_data.cpp index 7cec067fa..17f7be663 100644 --- a/libraries/libstratosphere/source/fs/fs_data.cpp +++ b/libraries/libstratosphere/source/fs/fs_data.cpp @@ -36,7 +36,7 @@ namespace ams::fs::impl { AMS_FS_R_TRY(OpenDataStorageByDataIdImpl(std::addressof(s), data_id, storage_id)); auto storage = std::make_unique(std::move(s)); - R_UNLESS(storage != nullptr, fs::ResultAllocationFailureInDataA()); + R_UNLESS(storage != nullptr, fs::ResultAllocationMemoryFailedInDataA()); *out = std::move(storage); return ResultSuccess(); @@ -47,7 +47,7 @@ namespace ams::fs::impl { R_TRY(OpenDataStorageByDataId(std::addressof(storage), data_id, storage_id)); auto fs = std::make_unique(); - R_UNLESS(fs != nullptr, fs::ResultAllocationFailureInDataB()); + R_UNLESS(fs != nullptr, fs::ResultAllocationMemoryFailedInDataB()); R_TRY(fs->Initialize(std::move(storage), cache_buffer, cache_size, use_cache)); return fsa::Register(name, std::move(fs), nullptr, use_data_cache, use_path_cache, false); diff --git a/libraries/libstratosphere/source/fs/fs_device_save_data.cpp b/libraries/libstratosphere/source/fs/fs_device_save_data.cpp index 92b1b8ef2..b5e23b838 100644 --- a/libraries/libstratosphere/source/fs/fs_device_save_data.cpp +++ b/libraries/libstratosphere/source/fs/fs_device_save_data.cpp @@ -35,7 +35,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInDeviceSaveDataA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInDeviceSaveDataA()); /* Register. */ return fsa::Register(name, std::move(fsa)); diff --git a/libraries/libstratosphere/source/fs/fs_game_card.cpp b/libraries/libstratosphere/source/fs/fs_game_card.cpp index 3a57c2de8..ab55e3020 100644 --- a/libraries/libstratosphere/source/fs/fs_game_card.cpp +++ b/libraries/libstratosphere/source/fs/fs_game_card.cpp @@ -81,11 +81,11 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInGameCardC()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInGameCardC()); /* Allocate a new mountname generator. */ auto generator = std::make_unique(handle, partition); - R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInGameCardD()); + R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInGameCardD()); /* Register. */ R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator))); diff --git a/libraries/libstratosphere/source/fs/fs_host.cpp b/libraries/libstratosphere/source/fs/fs_host.cpp index ee939b023..6e00e5055 100644 --- a/libraries/libstratosphere/source/fs/fs_host.cpp +++ b/libraries/libstratosphere/source/fs/fs_host.cpp @@ -76,7 +76,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInHostA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInHostA()); /* Set the output. */ *out = std::move(fsa); @@ -95,7 +95,7 @@ namespace ams::fs { /* Create a new HostCommonMountNameGenerator. */ *out = std::make_unique(path); - R_UNLESS(out->get() != nullptr, fs::ResultAllocationFailureInHostB()); + R_UNLESS(out->get() != nullptr, fs::ResultAllocationMemoryFailedInHostB()); R_SUCCEED(); } @@ -191,7 +191,7 @@ namespace ams::fs { auto register_impl = [&]() -> Result { /* Allocate a new mountname generator. */ auto generator = std::make_unique(); - R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInHostC()); + R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInHostC()); /* Register. */ R_RETURN(fsa::Register(impl::HostRootFileSystemMountName, std::move(fsa), std::move(generator))); @@ -219,7 +219,7 @@ namespace ams::fs { auto register_impl = [&]() -> Result { /* Allocate a new mountname generator. */ auto generator = std::make_unique(); - R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInHostC()); + R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInHostC()); /* Register. */ R_RETURN(fsa::Register(impl::HostRootFileSystemMountName, std::move(fsa), std::move(generator))); diff --git a/libraries/libstratosphere/source/fs/fs_image_directory.cpp b/libraries/libstratosphere/source/fs/fs_image_directory.cpp index 51c9163a3..5563f9e07 100644 --- a/libraries/libstratosphere/source/fs/fs_image_directory.cpp +++ b/libraries/libstratosphere/source/fs/fs_image_directory.cpp @@ -32,7 +32,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInImageDirectoryA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInImageDirectoryA()); /* Register. */ R_RETURN(fsa::Register(name, std::move(fsa))); diff --git a/libraries/libstratosphere/source/fs/fs_romfs_filesystem.cpp b/libraries/libstratosphere/source/fs/fs_romfs_filesystem.cpp index 5da9eb064..417fdb119 100644 --- a/libraries/libstratosphere/source/fs/fs_romfs_filesystem.cpp +++ b/libraries/libstratosphere/source/fs/fs_romfs_filesystem.cpp @@ -281,7 +281,7 @@ namespace ams::fs { constexpr size_t NameBufferSize = fs::EntryNameLengthMax + 1; char *name_buf = static_cast(::ams::fs::impl::Allocate(NameBufferSize)); - R_UNLESS(name_buf != nullptr, fs::ResultAllocationFailureInRomFsFileSystemE()); + R_UNLESS(name_buf != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemE()); ON_SCOPE_EXIT { ::ams::fs::impl::Deallocate(name_buf, NameBufferSize); }; s32 i = 0; @@ -393,10 +393,10 @@ namespace ams::fs { } /* Ensure we allocated storages successfully. */ - R_UNLESS(m_dir_bucket_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemA()); - R_UNLESS(m_dir_entry_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemA()); - R_UNLESS(m_file_bucket_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemA()); - R_UNLESS(m_file_entry_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemA()); + R_UNLESS(m_dir_bucket_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemA()); + R_UNLESS(m_dir_entry_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemA()); + R_UNLESS(m_file_bucket_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemA()); + R_UNLESS(m_file_entry_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemA()); /* Initialize the rom table. */ { @@ -505,7 +505,7 @@ namespace ams::fs { R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString())); auto file = std::make_unique(this, m_entry_size + file_info.offset.Get(), m_entry_size + file_info.offset.Get() + file_info.size.Get()); - R_UNLESS(file != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB()); + R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB()); *out_file = std::move(file); return ResultSuccess(); @@ -521,7 +521,7 @@ namespace ams::fs { } R_END_TRY_CATCH; auto dir = std::make_unique(this, find, mode); - R_UNLESS(dir != nullptr, fs::ResultAllocationFailureInRomFsFileSystemC()); + R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemC()); *out_dir = std::move(dir); return ResultSuccess(); diff --git a/libraries/libstratosphere/source/fs/fs_sd_card.cpp b/libraries/libstratosphere/source/fs/fs_sd_card.cpp index a317ccb54..7432081cc 100644 --- a/libraries/libstratosphere/source/fs/fs_sd_card.cpp +++ b/libraries/libstratosphere/source/fs/fs_sd_card.cpp @@ -58,12 +58,12 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSdCardA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSdCardA()); /* Allocate a new mountname generator. */ /* NOTE: Nintendo does not attach a generator. */ auto generator = std::make_unique(); - R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInSdCardA()); + R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInSdCardA()); /* Register. */ return fsa::Register(name, std::move(fsa), std::move(generator)); @@ -80,7 +80,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_shared(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSdCardA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSdCardA()); /* Ensure that the error report directory exists. */ constexpr fs::Path fs_path = fs::MakeConstantPath(AtmosphereErrorReportDirectory); @@ -88,7 +88,7 @@ namespace ams::fs { /* Create a subdirectory filesystem. */ auto subdir_fs = std::make_unique(std::move(fsa)); - R_UNLESS(subdir_fs != nullptr, fs::ResultAllocationFailureInSdCardA()); + R_UNLESS(subdir_fs != nullptr, fs::ResultAllocationMemoryFailedInSdCardA()); R_TRY(subdir_fs->Initialize(fs_path)); /* Register. */ @@ -104,7 +104,7 @@ namespace ams::fs { /* Create an event notifier adapter. */ auto adapter = std::make_unique(std::move(notifier)); - AMS_FS_R_UNLESS(adapter != nullptr, fs::ResultAllocationFailureInSdCardB()); + AMS_FS_R_UNLESS(adapter != nullptr, fs::ResultAllocationMemoryFailedInSdCardB()); *out = std::move(adapter); return ResultSuccess(); diff --git a/libraries/libstratosphere/source/fs/fs_system_save_data.cpp b/libraries/libstratosphere/source/fs/fs_system_save_data.cpp index 139939585..6f89b5cf9 100644 --- a/libraries/libstratosphere/source/fs/fs_system_save_data.cpp +++ b/libraries/libstratosphere/source/fs/fs_system_save_data.cpp @@ -47,7 +47,7 @@ namespace ams::fs { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSystemSaveDataA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSystemSaveDataA()); /* Register. */ return fsa::Register(name, std::move(fsa)); diff --git a/libraries/libstratosphere/source/fs/fsa/fs_filesystem_accessor.cpp b/libraries/libstratosphere/source/fs/fsa/fs_filesystem_accessor.cpp index d90d1325e..23357d660 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_filesystem_accessor.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_filesystem_accessor.cpp @@ -223,7 +223,7 @@ namespace ams::fs::impl { R_TRY(m_impl->OpenFile(std::addressof(file), normalized_path, mode)); auto accessor = new FileAccessor(std::move(file), this, mode); - R_UNLESS(accessor != nullptr, fs::ResultAllocationFailureInFileSystemAccessorA()); + R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInFileSystemAccessorA()); { std::scoped_lock lk(m_open_list_lock); @@ -251,7 +251,7 @@ namespace ams::fs::impl { R_TRY(m_impl->OpenDirectory(std::addressof(dir), normalized_path, mode)); auto accessor = new DirectoryAccessor(std::move(dir), *this); - R_UNLESS(accessor != nullptr, fs::ResultAllocationFailureInFileSystemAccessorB()); + R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInFileSystemAccessorB()); { std::scoped_lock lk(m_open_list_lock); diff --git a/libraries/libstratosphere/source/fs/fsa/fs_registrar.cpp b/libraries/libstratosphere/source/fs/fsa/fs_registrar.cpp index 36fe39201..551e9ef1b 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_registrar.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_registrar.cpp @@ -21,21 +21,21 @@ namespace ams::fs::fsa { Result Register(const char *name, std::unique_ptr &&fs) { auto accessor = std::make_unique(name, std::move(fs)); - R_UNLESS(accessor != nullptr, fs::ResultAllocationFailureInRegisterA()); + R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterA()); return impl::Register(std::move(accessor)); } Result Register(const char *name, std::unique_ptr &&fs, std::unique_ptr &&generator) { auto accessor = std::make_unique(name, std::move(fs), std::move(generator)); - R_UNLESS(accessor != nullptr, fs::ResultAllocationFailureInRegisterB()); + R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterB()); return impl::Register(std::move(accessor)); } Result Register(const char *name, std::unique_ptr &&fs, std::unique_ptr &&generator, bool use_data_cache, bool use_path_cache, bool support_multi_commit) { auto accessor = std::make_unique(name, std::move(fs), std::move(generator)); - R_UNLESS(accessor != nullptr, fs::ResultAllocationFailureInRegisterB()); + R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterB()); accessor->SetFileDataCacheAttachable(use_data_cache); accessor->SetPathBasedFileDataCacheAttachable(use_path_cache); diff --git a/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem.cpp b/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem.cpp index 6d8f21660..cec042a60 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem.cpp @@ -201,7 +201,7 @@ namespace ams::fs { AMS_FS_R_UNLESS(out != nullptr, fs::ResultNullptrArgument()); auto file_accessor = std::make_unique(std::move(file), nullptr, static_cast(mode)); - AMS_FS_R_UNLESS(file_accessor != nullptr, fs::ResultAllocationFailureInNew()); + AMS_FS_R_UNLESS(file_accessor != nullptr, fs::ResultAllocationMemoryFailedNew()); out->handle = file_accessor.release(); R_SUCCEED(); diff --git a/libraries/libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp b/libraries/libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp index befca1816..5fff3299e 100644 --- a/libraries/libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp +++ b/libraries/libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp @@ -127,7 +127,7 @@ namespace ams::fs::impl { /* Create the output fsa file. */ out_file->reset(new FileServiceObjectAdapter(std::move(file))); - R_UNLESS(out_file != nullptr, fs::ResultAllocationFailureInNew()); + R_UNLESS(out_file != nullptr, fs::ResultAllocationMemoryFailedNew()); R_SUCCEED(); } @@ -143,7 +143,7 @@ namespace ams::fs::impl { /* Create the output fsa directory. */ out_dir->reset(new DirectoryServiceObjectAdapter(std::move(dir))); - R_UNLESS(out_dir != nullptr, fs::ResultAllocationFailureInNew()); + R_UNLESS(out_dir != nullptr, fs::ResultAllocationMemoryFailedNew()); R_SUCCEED(); } diff --git a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_local_file_system_creator.cpp b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_local_file_system_creator.cpp index 18874e8b0..11584eb23 100644 --- a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_local_file_system_creator.cpp +++ b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_local_file_system_creator.cpp @@ -23,7 +23,7 @@ namespace ams::fssrv::fscreator { /* Allocate a local filesystem. */ auto local_fs = fs::AllocateShared(); - R_UNLESS(local_fs != nullptr, fs::ResultAllocationFailureInLocalFileSystemCreatorA()); + R_UNLESS(local_fs != nullptr, fs::ResultAllocationMemoryFailedInLocalFileSystemCreatorA()); /* If we're supposed to make sure the root path exists, do so. */ if (ensure_root) { diff --git a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_partition_file_system_creator.cpp b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_partition_file_system_creator.cpp index 81ba2a9b7..1c19c6986 100644 --- a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_partition_file_system_creator.cpp +++ b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_partition_file_system_creator.cpp @@ -20,7 +20,7 @@ namespace ams::fssrv::fscreator { Result PartitionFileSystemCreator::Create(std::shared_ptr *out, std::shared_ptr storage) { /* Allocate a filesystem. */ std::shared_ptr fs = fssystem::AllocateShared(); - R_UNLESS(fs != nullptr, fs::ResultAllocationFailureInPartitionFileSystemCreatorA()); + R_UNLESS(fs != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemCreatorA()); /* Initialize the filesystem. */ R_TRY(fs->Initialize(std::move(storage))); diff --git a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_rom_file_system_creator.cpp b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_rom_file_system_creator.cpp index e393df9e8..59ed7a60c 100644 --- a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_rom_file_system_creator.cpp +++ b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_rom_file_system_creator.cpp @@ -57,7 +57,7 @@ namespace ams::fssrv::fscreator { Result RomFileSystemCreator::Create(std::shared_ptr *out, std::shared_ptr storage) { /* Allocate a filesystem. */ std::shared_ptr fs = fssystem::AllocateShared(m_allocator); - R_UNLESS(fs != nullptr, fs::ResultAllocationFailureInRomFileSystemCreatorA()); + R_UNLESS(fs != nullptr, fs::ResultAllocationMemoryFailedInRomFileSystemCreatorA()); /* Initialize the filesystem. */ R_TRY(fs->Initialize(std::move(storage))); diff --git a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_storage_on_nca_creator.cpp b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_storage_on_nca_creator.cpp index a4eddb68a..926b8902e 100644 --- a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_storage_on_nca_creator.cpp +++ b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_storage_on_nca_creator.cpp @@ -50,7 +50,7 @@ namespace ams::fssrv::fscreator { Result StorageOnNcaCreator::CreateNcaReader(std::shared_ptr *out, std::shared_ptr storage) { /* Create a reader. */ std::shared_ptr reader = fssystem::AllocateShared(); - R_UNLESS(reader != nullptr, fs::ResultAllocationFailureInStorageOnNcaCreatorB()); + R_UNLESS(reader != nullptr, fs::ResultAllocationMemoryFailedInStorageOnNcaCreatorB()); /* Initialize the reader. */ R_TRY(reader->Initialize(std::move(storage), m_nca_crypto_cfg, m_nca_compression_cfg, m_hash_generator_factory_selector)); diff --git a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_subdirectory_file_system_creator.cpp b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_subdirectory_file_system_creator.cpp index 7151368c9..ee9941b58 100644 --- a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_subdirectory_file_system_creator.cpp +++ b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_subdirectory_file_system_creator.cpp @@ -26,7 +26,7 @@ namespace ams::fssrv::fscreator { /* Allocate a SubDirectoryFileSystem. */ auto sub_dir_fs = fs::AllocateShared(std::move(base_fs)); - R_UNLESS(sub_dir_fs != nullptr, fs::ResultAllocationFailureInSubDirectoryFileSystemCreatorA()); + R_UNLESS(sub_dir_fs != nullptr, fs::ResultAllocationMemoryFailedInSubDirectoryFileSystemCreatorA()); /* Initialize the new filesystem. */ R_TRY(sub_dir_fs->Initialize(path)); diff --git a/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_impl.cpp b/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_impl.cpp index a2e1e0534..0f2c8273c 100644 --- a/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_impl.cpp +++ b/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_impl.cpp @@ -186,7 +186,7 @@ namespace ams::fssrv { /* Create an interface adapter. */ auto sf_fs = impl::FileSystemObjectFactory::CreateSharedEmplaced(std::move(fs), host_path_flags, false); - R_UNLESS(sf_fs != nullptr, fs::ResultAllocationFailureInFileSystemProxyImplA()); + R_UNLESS(sf_fs != nullptr, fs::ResultAllocationMemoryFailedInFileSystemProxyImplA()); /* Set the output. */ *out = std::move(sf_fs); diff --git a/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp b/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp index 5bf4a313f..f0e6e7aa3 100644 --- a/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp +++ b/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp @@ -251,12 +251,12 @@ namespace ams::fssrv::impl { const auto target_object_id = file->GetDomainObjectId(); ams::sf::SharedPointer file_intf = FileSystemObjectFactory::CreateSharedEmplaced(std::move(file), this, m_allow_all_operations); - R_UNLESS(file_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter()); + R_UNLESS(file_intf != nullptr, fs::ResultAllocationMemoryFailedInFileSystemInterfaceAdapterA()); out.SetValue(std::move(file_intf), target_object_id); } else { ams::sf::SharedPointer file_intf = FileSystemObjectFactory::CreateSharedEmplaced(std::move(file), this, m_allow_all_operations); - R_UNLESS(file_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter()); + R_UNLESS(file_intf != nullptr, fs::ResultAllocationMemoryFailedInFileSystemInterfaceAdapterA()); out.SetValue(std::move(file_intf)); } @@ -281,12 +281,12 @@ namespace ams::fssrv::impl { const auto target_object_id = dir->GetDomainObjectId(); ams::sf::SharedPointer dir_intf = FileSystemObjectFactory::CreateSharedEmplaced(std::move(dir), this, m_allow_all_operations); - R_UNLESS(dir_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter()); + R_UNLESS(dir_intf != nullptr, fs::ResultAllocationMemoryFailedInFileSystemInterfaceAdapterA()); out.SetValue(std::move(dir_intf), target_object_id); } else { ams::sf::SharedPointer dir_intf = FileSystemObjectFactory::CreateSharedEmplaced(std::move(dir), this, m_allow_all_operations); - R_UNLESS(dir_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter()); + R_UNLESS(dir_intf != nullptr, fs::ResultAllocationMemoryFailedInFileSystemInterfaceAdapterA()); out.SetValue(std::move(dir_intf)); } @@ -358,7 +358,7 @@ namespace ams::fssrv::impl { R_TRY(fsFsOpenFile(std::addressof(m_base_fs), path.str, mode, std::addressof(f))); auto intf = FileSystemObjectFactory::CreateSharedEmplaced(f); - R_UNLESS(intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter()); + R_UNLESS(intf != nullptr, fs::ResultAllocationMemoryFailedInFileSystemInterfaceAdapterA()); out.SetValue(std::move(intf)); R_SUCCEED(); @@ -369,7 +369,7 @@ namespace ams::fssrv::impl { R_TRY(fsFsOpenDirectory(std::addressof(m_base_fs), path.str, mode, std::addressof(d))); auto intf = FileSystemObjectFactory::CreateSharedEmplaced(d); - R_UNLESS(intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter()); + R_UNLESS(intf != nullptr, fs::ResultAllocationMemoryFailedInFileSystemInterfaceAdapterA()); out.SetValue(std::move(intf)); R_SUCCEED(); diff --git a/libraries/libstratosphere/source/fssrv/impl/fssrv_program_registry_manager.cpp b/libraries/libstratosphere/source/fssrv/impl/fssrv_program_registry_manager.cpp index be44f1108..29d0d0a55 100644 --- a/libraries/libstratosphere/source/fssrv/impl/fssrv_program_registry_manager.cpp +++ b/libraries/libstratosphere/source/fssrv/impl/fssrv_program_registry_manager.cpp @@ -21,13 +21,13 @@ namespace ams::fssrv::impl { Result ProgramRegistryManager::RegisterProgram(u64 process_id, u64 program_id, u8 storage_id, const void *data, s64 data_size, const void *desc, s64 desc_size) { /* Allocate a new node. */ std::unique_ptr new_node(new ProgramInfoNode()); - R_UNLESS(new_node != nullptr, fs::ResultAllocationFailureInProgramRegistryManagerA()); + R_UNLESS(new_node != nullptr, fs::ResultAllocationMemoryFailedInProgramRegistryManagerA()); /* Create a new program info. */ { /* Allocate the new info. */ auto new_info = fssystem::AllocateShared(process_id, program_id, storage_id, data, data_size, desc, desc_size); - R_UNLESS(new_info != nullptr, fs::ResultAllocationFailureInProgramRegistryManagerA()); + R_UNLESS(new_info != nullptr, fs::ResultAllocationMemoryFailedInProgramRegistryManagerA()); /* Set the info in the node. */ new_node->program_info = std::move(new_info); diff --git a/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buddy_heap.cpp b/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buddy_heap.cpp index bf7738d84..eef9ddbf4 100644 --- a/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buddy_heap.cpp +++ b/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buddy_heap.cpp @@ -139,7 +139,7 @@ namespace ams::fssystem { } else { m_internal_free_lists.reset(new PageList[m_order_max + 1]); m_free_lists = m_internal_free_lists.get(); - R_UNLESS(m_free_lists != nullptr, fs::ResultAllocationFailureInFileSystemBuddyHeapA()); + R_UNLESS(m_free_lists != nullptr, fs::ResultAllocationMemoryFailedInFileSystemBuddyHeapA()); } /* All but the last page region should go to the max order. */ diff --git a/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buffer_manager.cpp b/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buffer_manager.cpp index 93b8683ef..9796397c7 100644 --- a/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buffer_manager.cpp +++ b/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buffer_manager.cpp @@ -29,7 +29,7 @@ namespace ams::fssystem { } /* We need to have at least one entry buffer. */ - R_UNLESS(m_internal_entry_buffer != nullptr || m_external_entry_buffer != nullptr, fs::ResultAllocationFailureInFileSystemBufferManagerA()); + R_UNLESS(m_internal_entry_buffer != nullptr || m_external_entry_buffer != nullptr, fs::ResultAllocationMemoryFailedInFileSystemBufferManagerA()); /* Set entries. */ m_entries = reinterpret_cast(m_external_entry_buffer != nullptr ? m_external_entry_buffer : m_internal_entry_buffer.get()); diff --git a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp index dede6050a..195f7b4e1 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp @@ -46,14 +46,14 @@ namespace ams::fssystem { Result AesCtrCounterExtendedStorage::CreateExternalDecryptor(std::unique_ptr *out, DecryptFunction func, s32 key_index) { std::unique_ptr decryptor = std::make_unique(func, key_index); - R_UNLESS(decryptor != nullptr, fs::ResultAllocationFailureInAesCtrCounterExtendedStorageA()); + R_UNLESS(decryptor != nullptr, fs::ResultAllocationMemoryFailedInAesCtrCounterExtendedStorageA()); *out = std::move(decryptor); return ResultSuccess(); } Result AesCtrCounterExtendedStorage::CreateSoftwareDecryptor(std::unique_ptr *out) { std::unique_ptr decryptor = std::make_unique(); - R_UNLESS(decryptor != nullptr, fs::ResultAllocationFailureInAesCtrCounterExtendedStorageA()); + R_UNLESS(decryptor != nullptr, fs::ResultAllocationMemoryFailedInAesCtrCounterExtendedStorageA()); *out = std::move(decryptor); return ResultSuccess(); } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_block_cache_buffered_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_block_cache_buffered_storage.cpp index 4df5697f1..80228cd50 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_block_cache_buffered_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_block_cache_buffered_storage.cpp @@ -149,7 +149,7 @@ namespace ams::fssystem { do { /* Do the bulk read. If we fail due to pooled buffer allocation failing, fall back to the normal read codepath. */ R_TRY_CATCH(this->BulkRead(read_offset, dst, read_size, std::addressof(head_range), std::addressof(tail_range), std::addressof(head_entry), std::addressof(tail_entry), head_cache_needed, tail_cache_needed)) { - R_CATCH(fs::ResultAllocationFailurePooledBufferNotEnoughSize) { break; } + R_CATCH(fs::ResultAllocationPooledBufferNotEnoughSize) { break; } } R_END_TRY_CATCH; /* Se successfully did a bulk read, so we're done. */ @@ -463,7 +463,7 @@ namespace ams::fssystem { if (start_offset < offset || offset + size < end_offset) { /* Allocate a work buffer. */ std::unique_ptr work = fs::impl::MakeUnique(m_verification_block_size); - R_UNLESS(work != nullptr, fs::ResultAllocationFailureInBlockCacheBufferedStorageB()); + R_UNLESS(work != nullptr, fs::ResultAllocationMemoryFailedInBlockCacheBufferedStorageB()); /* Handle data before the aligned range. */ if (start_offset < offset) { @@ -1005,7 +1005,7 @@ namespace ams::fssystem { read_buffer = reinterpret_cast(range_head->first); } else { pooled_buffer.AllocateParticularlyLarge(buffer_size, 1); - R_UNLESS(pooled_buffer.GetSize() >= buffer_size, fs::ResultAllocationFailurePooledBufferNotEnoughSize()); + R_UNLESS(pooled_buffer.GetSize() >= buffer_size, fs::ResultAllocationPooledBufferNotEnoughSize()); read_buffer = pooled_buffer.GetBuffer(); } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_buffered_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_buffered_storage.cpp index 96433aaea..51e1c5512 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_buffered_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_buffered_storage.cpp @@ -608,7 +608,7 @@ namespace ams::fssystem { /* Allocate the caches. */ m_caches.reset(new Cache[buffer_count]); - R_UNLESS(m_caches != nullptr, fs::ResultAllocationFailureInBufferedStorageA()); + R_UNLESS(m_caches != nullptr, fs::ResultAllocationMemoryFailedInBufferedStorageA()); /* Initialize the caches. */ for (auto i = 0; i < buffer_count; i++) { @@ -793,7 +793,7 @@ namespace ams::fssystem { do { /* Try to do a bulk read. */ R_TRY_CATCH(this->BulkRead(cur_offset, static_cast(buffer) + buf_offset, remaining_size, head_cache_needed, tail_cache_needed)) { - R_CATCH(fs::ResultAllocationFailurePooledBufferNotEnoughSize) { + R_CATCH(fs::ResultAllocationPooledBufferNotEnoughSize) { /* If the read fails due to insufficient pooled buffer size, */ /* then we want to fall back to the normal read path. */ break; @@ -940,7 +940,7 @@ namespace ams::fssystem { work_buffer = static_cast(buffer); } else { pooled_buffer.AllocateParticularlyLarge(static_cast(aligned_size), 1); - R_UNLESS(static_cast(pooled_buffer.GetSize()) >= aligned_size, fs::ResultAllocationFailurePooledBufferNotEnoughSize()); + R_UNLESS(static_cast(pooled_buffer.GetSize()) >= aligned_size, fs::ResultAllocationPooledBufferNotEnoughSize()); work_buffer = pooled_buffer.GetBuffer(); } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_directory_savedata_filesystem.cpp b/libraries/libstratosphere/source/fssystem/fssystem_directory_savedata_filesystem.cpp index 2c4d76691..14fc94f44 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_directory_savedata_filesystem.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_directory_savedata_filesystem.cpp @@ -271,7 +271,7 @@ namespace ams::fssystem { /* Make DirectorySaveDataFile. */ std::unique_ptr file = std::make_unique(std::move(base_file), this, mode); - R_UNLESS(file != nullptr, fs::ResultAllocationFailureInDirectorySaveDataFileSystem()); + R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInDirectorySaveDataFileSystemA()); /* Increment our open writable files, if the file is writable. */ if (mode & fs::OpenMode_Write) { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_integrity_romfs_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_integrity_romfs_storage.cpp index 63580fb4e..3010146fe 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_integrity_romfs_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_integrity_romfs_storage.cpp @@ -24,7 +24,7 @@ namespace ams::fssystem { /* Set master hash. */ m_master_hash = master_hash; m_master_hash_storage = std::make_unique(std::addressof(m_master_hash), sizeof(Hash)); - R_UNLESS(m_master_hash_storage != nullptr, fs::ResultAllocationFailureInIntegrityRomFsStorageA()); + R_UNLESS(m_master_hash_storage != nullptr, fs::ResultAllocationMemoryFailedInIntegrityRomFsStorageA()); /* Set the master hash storage. */ storage_info[0] = fs::SubStorage(m_master_hash_storage.get(), 0, sizeof(Hash)); diff --git a/libraries/libstratosphere/source/fssystem/fssystem_integrity_verification_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_integrity_verification_storage.cpp index 637138dc9..e60a108b7 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_integrity_verification_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_integrity_verification_storage.cpp @@ -283,7 +283,7 @@ namespace ams::fssystem { /* Allocate a work buffer. */ const auto buf_size = static_cast(std::min(sign_size, static_cast(1) << (m_upper_layer_verification_block_order + 2))); std::unique_ptr buf = fs::impl::MakeUnique(buf_size); - R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInIntegrityVerificationStorageA()); + R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedInIntegrityVerificationStorageA()); /* Clear the work buffer. */ std::memset(buf.get(), 0, buf_size); @@ -315,7 +315,7 @@ namespace ams::fssystem { /* Allocate a work buffer. */ std::unique_ptr buf = fs::impl::MakeUnique(sign_size); - R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInIntegrityVerificationStorageB()); + R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedInIntegrityVerificationStorageB()); /* Read the existing signature. */ R_TRY(m_hash_storage.Read(sign_offset, buf.get(), sign_size)); diff --git a/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp b/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp index d1edb9ba3..a442a0017 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp @@ -88,7 +88,7 @@ namespace ams::fssystem { for (auto it = list->begin(); it != list->end(); ++it) { if (it->Contains(key, key_size, key2)) { std::unique_ptr accessor = std::make_unique(it->GetKeySlotIndex(), std::move(lk)); - R_UNLESS(accessor != nullptr, fs::ResultAllocationFailure()); + R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailed()); *out = std::move(accessor); diff --git a/libraries/libstratosphere/source/fssystem/fssystem_local_file_system.cpp b/libraries/libstratosphere/source/fssystem/fssystem_local_file_system.cpp index 9b95f7316..256132691 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_local_file_system.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_local_file_system.cpp @@ -880,7 +880,7 @@ namespace ams::fssystem { /* Allocate our native path buffer. */ native_path = fs::impl::MakeUnique(native_len + 1); - R_UNLESS(native_path != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(native_path != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Convert path. */ const auto res = ::MultiByteToWideChar(CP_UTF8, 0, m_root_path.GetString(), -1, native_path.get(), native_len); @@ -901,7 +901,7 @@ namespace ams::fssystem { /* Tentatively assume other operating systems do the sane thing and use utf-8 strings. */ native_path = fs::impl::MakeUnique(native_len + 1); - R_UNLESS(native_path != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(native_path != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Copy in path. */ std::memcpy(native_path.get(), m_root_path.GetString(), native_len + 1); @@ -972,7 +972,7 @@ namespace ams::fssystem { /* Allocate our native path buffer. */ native_path = fs::impl::MakeUnique(native_len + min_len + 1); - R_UNLESS(native_path != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(native_path != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Convert path. */ const auto res = ::MultiByteToWideChar(CP_UTF8, 0, full_path.GetString(), -1, native_path.get(), native_len); @@ -999,7 +999,7 @@ namespace ams::fssystem { /* Allocate case sensitive buffer. */ auto case_sensitive_buffer_size = sizeof(NativeCharacterType) * (m_native_path_length + native_len + 1 + fs::EntryNameLengthMax); NativePathBuffer case_sensitive_path_buffer = fs::impl::MakeUnique(case_sensitive_buffer_size / sizeof(NativeCharacterType)); - R_UNLESS(case_sensitive_path_buffer != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(case_sensitive_path_buffer != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Get root path. */ const NativeCharacterType *root_path = m_native_path_buffer.get() != nullptr ? m_native_path_buffer.get() : L""; @@ -1022,7 +1022,7 @@ namespace ams::fssystem { /* Tentatively assume other operating systems do the sane thing and use utf-8 strings. */ native_path = fs::impl::MakeUnique(native_len + min_len + 1); - R_UNLESS(native_path != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(native_path != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Copy in path. */ std::memcpy(native_path.get(), full_path.GetString(), native_len + 1); @@ -1075,7 +1075,7 @@ namespace ams::fssystem { /* Allocate a new path buffer. */ NativePathBuffer cur_path_buf = fs::impl::MakeUnique(path_len + MAX_PATH); - R_UNLESS(cur_path_buf.get() != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(cur_path_buf.get() != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Copy the path into the temporary buffer. */ ::wcscpy(cur_path_buf.get(), path); @@ -1143,7 +1143,7 @@ namespace ams::fssystem { /* Allocate a temporary buffer. */ NativePathBuffer cur_path_buf = fs::impl::MakeUnique(path_len + PATH_MAX); - R_UNLESS(cur_path_buf.get() != nullptr, fs::ResultAllocationFailureInMakeUnique()); + R_UNLESS(cur_path_buf.get() != nullptr, fs::ResultAllocationMemoryFailedMakeUnique()); /* Copy the path into the temporary buffer. */ std::memcpy(cur_path_buf.get(), path, path_len); @@ -1561,7 +1561,7 @@ namespace ams::fssystem { /* Create a new local file. */ auto file = std::make_unique(file_handle, mode); - R_UNLESS(file != nullptr, fs::ResultAllocationFailureInLocalFileSystemA()); + R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInLocalFileSystemA()); /* Set the output file. */ *out_file = std::move(file); @@ -1629,7 +1629,7 @@ namespace ams::fssystem { /* Create a new local directory. */ auto dir = std::make_unique(dir_handle, search_handle, mode, std::move(native_path)); - R_UNLESS(dir != nullptr, fs::ResultAllocationFailureInLocalFileSystemB()); + R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInLocalFileSystemB()); /* Set the output directory. */ *out_dir = std::move(dir); diff --git a/libraries/libstratosphere/source/fssystem/fssystem_nca_file_system_driver.cpp b/libraries/libstratosphere/source/fssystem/fssystem_nca_file_system_driver.cpp index 5feb3dba9..85142c933 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_nca_file_system_driver.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_nca_file_system_driver.cpp @@ -312,7 +312,7 @@ namespace ams::fssystem { } else { /* Otherwise, allocate a default splitter. */ *out_splitter = fssystem::AllocateShared(); - R_UNLESS(*out_splitter != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(*out_splitter != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); } return ResultSuccess(); @@ -430,7 +430,7 @@ namespace ams::fssystem { } else { /* Allocate a dummy memory storage as original storage. */ original_indirectable_storage = fssystem::AllocateShared(nullptr, 0); - R_UNLESS(original_indirectable_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(original_indirectable_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); } /* Create the indirect storage. */ @@ -517,7 +517,7 @@ namespace ams::fssystem { Result NcaFileSystemDriver::CreateBodySubStorage(std::shared_ptr *out, s64 offset, s64 size) { /* Create the body storage. */ auto body_storage = fssystem::AllocateShared(m_reader->GetSharedBodyStorage(), m_reader); - R_UNLESS(body_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(body_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Get the body storage size. */ s64 body_size = 0; @@ -528,7 +528,7 @@ namespace ams::fssystem { /* Create substorage. */ auto body_substorage = fssystem::AllocateShared(std::move(body_storage), offset, size); - R_UNLESS(body_substorage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(body_substorage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Set the output storage. */ *out = std::move(body_substorage); @@ -550,7 +550,7 @@ namespace ams::fssystem { /* Create buffered storage. */ auto buffered_storage = fssystem::AllocateShared(); - R_UNLESS(buffered_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(buffered_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the buffered storage. */ R_TRY(buffered_storage->Initialize(fs::SubStorage(std::move(base_storage), 0, base_size), m_buffer_manager, AesCtrStorageCacheBlockSize, AesCtrStorageCacheCount)); @@ -576,20 +576,20 @@ namespace ams::fssystem { std::shared_ptr aes_ctr_storage; if (m_reader->HasExternalDecryptionKey()) { aes_ctr_storage = fssystem::AllocateShared(std::move(base_storage), m_reader->GetExternalDecryptionKey(), AesCtrStorageExternal::KeySize, iv, AesCtrStorageExternal::IvSize, m_reader->GetExternalDecryptAesCtrFunctionForExternalKey(), -1); - R_UNLESS(aes_ctr_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(aes_ctr_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); } else { /* Create software decryption storage. */ auto sw_storage = fssystem::AllocateShared(base_storage, m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesCtr), AesCtrStorageBySharedPointer::KeySize, iv, AesCtrStorageBySharedPointer::IvSize); - R_UNLESS(sw_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(sw_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* If we have a hardware key and should use it, make the hardware decryption storage. */ if (m_reader->HasInternalDecryptionKeyForAesHw() && !m_reader->IsSoftwareAesPrioritized()) { auto hw_storage = fssystem::AllocateShared(base_storage, m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesCtrHw), AesCtrStorageExternal::KeySize, iv, AesCtrStorageExternal::IvSize, m_reader->GetExternalDecryptAesCtrFunction(), GetKeyTypeValue(m_reader->GetKeyIndex(), m_reader->GetKeyGeneration())); - R_UNLESS(hw_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(hw_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Create the selection storage. */ auto switch_storage = fssystem::AllocateShared>(std::move(hw_storage), std::move(sw_storage), IsUsingHwAesCtrForSpeedEmulation); - R_UNLESS(switch_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(switch_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Use the selection storage. */ aes_ctr_storage = std::move(switch_storage); @@ -601,7 +601,7 @@ namespace ams::fssystem { /* Create alignment matching storage. */ auto aligned_storage = fssystem::AllocateShared>(std::move(aes_ctr_storage)); - R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Set the out storage. */ *out = std::move(aligned_storage); @@ -621,11 +621,11 @@ namespace ams::fssystem { const auto * const key1 = m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesXts1); const auto * const key2 = m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesXts2); auto xts_storage = fssystem::AllocateShared(std::move(base_storage), key1, key2, AesXtsStorageBySharedPointer::KeySize, iv, AesXtsStorageBySharedPointer::IvSize, NcaHeader::XtsBlockSize); - R_UNLESS(xts_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(xts_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Create alignment matching storage. */ auto aligned_storage = fssystem::AllocateShared>(std::move(xts_storage)); - R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Set the out storage. */ *out = std::move(aligned_storage); @@ -648,7 +648,7 @@ namespace ams::fssystem { /* Create the encrypted storage. */ auto enc_storage = fssystem::AllocateShared(std::move(base_storage), meta_offset, meta_size); - R_UNLESS(enc_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(enc_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Create the decrypted storage. */ std::shared_ptr decrypted_storage; @@ -656,7 +656,7 @@ namespace ams::fssystem { /* Create meta storage. */ auto meta_storage = fssystem::AllocateShared(); - R_UNLESS(meta_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(meta_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the meta storage. */ R_TRY(meta_storage->Initialize(fs::SubStorage(std::move(decrypted_storage), 0, meta_size), m_buffer_manager, SparseTableCacheBlockSize, SparseTableCacheCount)); @@ -685,7 +685,7 @@ namespace ams::fssystem { /* Create the sparse storage. */ auto sparse_storage = fssystem::AllocateShared(); - R_UNLESS(sparse_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(sparse_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Sanity check that we can be doing this. */ AMS_ASSERT(header.entry_count != 0); @@ -742,7 +742,7 @@ namespace ams::fssystem { } else { /* If there are no entries, there's nothing to actually do. */ sparse_storage = fssystem::AllocateShared(); - R_UNLESS(sparse_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(sparse_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); sparse_storage->Initialize(fs_size); } @@ -782,7 +782,7 @@ namespace ams::fssystem { /* Create the encrypted storage. */ auto enc_storage = fssystem::AllocateShared(std::move(base_storage), meta_offset, meta_size); - R_UNLESS(enc_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(enc_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Create the decrypted storage. */ std::shared_ptr decrypted_storage; @@ -790,7 +790,7 @@ namespace ams::fssystem { /* Create meta storage. */ auto meta_storage = fssystem::AllocateShared(); - R_UNLESS(meta_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(meta_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the meta storage. */ R_TRY(meta_storage->Initialize(fs::SubStorage(std::move(decrypted_storage), 0, meta_size), m_buffer_manager, AesCtrExTableCacheBlockSize, AesCtrExTableCacheCount)); @@ -798,7 +798,7 @@ namespace ams::fssystem { /* Create an alignment-matching storage. */ using AlignedStorage = AlignmentMatchingStorage; auto aligned_storage = fssystem::AllocateShared(std::move(meta_storage)); - R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Set the output. */ *out = std::move(aligned_storage); @@ -843,7 +843,7 @@ namespace ams::fssystem { /* Create the aes ctr ex storage. */ auto impl_storage = fssystem::AllocateShared(); - R_UNLESS(impl_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(impl_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the aes ctr ex storage. */ R_TRY(impl_storage->Initialize(m_allocator, m_reader->GetExternalDecryptionKey(), AesCtrStorageBySharedPointer::KeySize, secure_value, counter_offset, data_storage, node_storage, entry_storage, entry_count, std::move(decryptor))); @@ -862,7 +862,7 @@ namespace ams::fssystem { /* Make the software storage. */ auto sw_storage = fssystem::AllocateShared(); - R_UNLESS(sw_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(sw_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the software storage. */ R_TRY(sw_storage->Initialize(m_allocator, m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesCtr), AesCtrStorageBySharedPointer::KeySize, secure_value, counter_offset, data_storage, node_storage, entry_storage, entry_count, std::move(sw_decryptor))); @@ -880,14 +880,14 @@ namespace ams::fssystem { /* Create the hardware storage. */ auto hw_storage = fssystem::AllocateShared(); - R_UNLESS(hw_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(hw_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the hardware storage. */ R_TRY(hw_storage->Initialize(m_allocator, m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesCtrHw), AesCtrStorageBySharedPointer::KeySize, secure_value, counter_offset, data_storage, node_storage, entry_storage, entry_count, std::move(hw_decryptor))); /* Create the selection storage. */ auto switch_storage = fssystem::AllocateShared>(std::move(hw_storage), std::move(sw_storage), IsUsingHwAesCtrForSpeedEmulation); - R_UNLESS(switch_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(switch_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Set the implementation storage. */ aes_ctr_ex_storage = std::move(switch_storage); @@ -900,7 +900,7 @@ namespace ams::fssystem { /* Create an alignment-matching storage. */ using AlignedStorage = AlignmentMatchingStorage; auto aligned_storage = fssystem::AllocateShared(std::move(aes_ctr_ex_storage)); - R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Set the output. */ *out = std::move(aligned_storage); @@ -922,7 +922,7 @@ namespace ams::fssystem { /* Allocate the meta storage. */ auto meta_storage = fssystem::AllocateShared(); - R_UNLESS(meta_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(meta_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the meta storage. */ R_TRY(meta_storage->Initialize(fs::SubStorage(base_storage, patch_info.indirect_offset, patch_info.indirect_size), m_buffer_manager, IndirectTableCacheBlockSize, IndirectTableCacheCount)); @@ -955,7 +955,7 @@ namespace ams::fssystem { /* Create the indirect data storage. */ auto indirect_data_storage = fssystem::AllocateShared(); - R_UNLESS(indirect_data_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(indirect_data_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the indirect data storage. */ R_TRY(indirect_data_storage->Initialize(fs::SubStorage(base_storage, 0, indirect_data_size), m_buffer_manager, IndirectDataCacheBlockSize, IndirectDataCacheCount)); @@ -965,7 +965,7 @@ namespace ams::fssystem { /* Create the indirect storage. */ auto indirect_storage = fssystem::AllocateShared(); - R_UNLESS(indirect_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(indirect_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the indirect storage. */ R_TRY(indirect_storage->Initialize(m_allocator, fs::SubStorage(meta_storage, 0, node_size), fs::SubStorage(meta_storage, node_size, entry_size), header.entry_count)); @@ -1014,8 +1014,8 @@ namespace ams::fssystem { /* Make a buffer holder storage. */ auto buffer_hold_storage = fssystem::AllocateShared(std::move(base_storage), m_allocator, total_buffer_size); - R_UNLESS(buffer_hold_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); - R_UNLESS(buffer_hold_storage->IsValid(), fs::ResultAllocationFailureInNcaFileSystemDriverI()); + R_UNLESS(buffer_hold_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); + R_UNLESS(buffer_hold_storage->IsValid(), fs::ResultAllocationMemoryFailedInNcaFileSystemDriverI()); /* Get storage size. */ s64 base_size; @@ -1030,7 +1030,7 @@ namespace ams::fssystem { /* Make the verification storage. */ auto verification_storage = fssystem::AllocateShared(); - R_UNLESS(verification_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(verification_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Make layer storages. */ fs::SubStorage layer_storages[VerificationStorage::LayerCount] = { @@ -1044,11 +1044,11 @@ namespace ams::fssystem { /* Make the cache storage. */ auto cache_storage = fssystem::AllocateShared(std::move(verification_storage), hash_data.hash_block_size, static_cast(buffer_hold_storage->GetBuffer()) + hash_buffer_size, cache_buffer_size, CacheBlockCount); - R_UNLESS(cache_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(cache_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Make the aligned storage. */ auto aligned_storage = fssystem::AllocateShared(std::move(cache_storage), hash_data.hash_block_size); - R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Set the output. */ *out = std::move(aligned_storage); @@ -1091,7 +1091,7 @@ namespace ams::fssystem { /* Make the integrity romfs storage. */ auto integrity_storage = fssystem::AllocateShared(); - R_UNLESS(integrity_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(integrity_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the integrity storage. */ R_TRY(integrity_storage->Initialize(level_hash_info, meta_info.master_hash, storage_info, m_buffer_manager, m_hash_generator_factory_selector->GetFactory())); @@ -1126,14 +1126,14 @@ namespace ams::fssystem { /* If we should, set the output meta storage. */ if (out_meta != nullptr) { auto meta_storage = fssystem::AllocateShared(base_storage, table_offset, table_size); - R_UNLESS(meta_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(meta_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); *out_meta = std::move(meta_storage); } /* Allocate the compressed storage. */ auto compressed_storage = fssystem::AllocateShared(); - R_UNLESS(compressed_storage != nullptr, fs::ResultAllocationFailureInAllocateShared()); + R_UNLESS(compressed_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared()); /* Initialize the compressed storage. */ R_TRY(compressed_storage->Initialize(allocator, buffer_manager, fs::SubStorage(base_storage, 0, table_offset), fs::SubStorage(base_storage, table_offset, node_size), fs::SubStorage(base_storage, table_offset + node_size, entry_size), header.entry_count, 64_KB, 640_KB, get_decompressor, 16_KB, 16_KB, 32)); diff --git a/libraries/libstratosphere/source/fssystem/fssystem_nca_reader.cpp b/libraries/libstratosphere/source/fssystem/fssystem_nca_reader.cpp index 5bff40cea..60fd98c82 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_nca_reader.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_nca_reader.cpp @@ -65,7 +65,7 @@ namespace ams::fssystem { /* Create the header storage. */ const u8 header_iv[AesXtsStorageForNcaHeader::IvSize] = {}; std::unique_ptr work_header_storage = std::make_unique(base_storage, header_decryption_keys[0], header_decryption_keys[1], AesXtsStorageForNcaHeader::KeySize, header_iv, AesXtsStorageForNcaHeader::IvSize, NcaHeader::XtsBlockSize); - R_UNLESS(work_header_storage != nullptr, fs::ResultAllocationFailureInNcaReaderA()); + R_UNLESS(work_header_storage != nullptr, fs::ResultAllocationMemoryFailedInNcaReaderA()); /* Read the header. */ R_TRY(work_header_storage->Read(0, std::addressof(m_header), sizeof(m_header))); @@ -83,7 +83,7 @@ namespace ams::fssystem { s64 base_storage_size; R_TRY(base_storage->GetSize(std::addressof(base_storage_size))); work_header_storage.reset(new fs::SubStorage(base_storage, 0, base_storage_size)); - R_UNLESS(work_header_storage != nullptr, fs::ResultAllocationFailureInNcaReaderA()); + R_UNLESS(work_header_storage != nullptr, fs::ResultAllocationMemoryFailedInNcaReaderA()); /* Set encryption type as plaintext. */ m_header_encryption_type = NcaHeader::EncryptionType::None; diff --git a/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system.cpp b/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system.cpp index d13c02a37..46e83f49f 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system.cpp @@ -286,7 +286,7 @@ namespace ams::fssystem { /* Allocate meta data. */ m_unique_meta_data = std::make_unique(); - R_UNLESS(m_unique_meta_data != nullptr, fs::ResultAllocationFailureInPartitionFileSystemA()); + R_UNLESS(m_unique_meta_data != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemA()); /* Initialize meta data. */ R_TRY(m_unique_meta_data->Initialize(base_storage, allocator)); @@ -382,7 +382,7 @@ namespace ams::fssystem { /* Create and output the file directory. */ std::unique_ptr file = std::make_unique(this, m_meta_data->GetEntry(entry_index), mode); - R_UNLESS(file != nullptr, fs::ResultAllocationFailureInPartitionFileSystemB()); + R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemB()); *out_file = std::move(file); R_SUCCEED(); } @@ -395,7 +395,7 @@ namespace ams::fssystem { /* Create and output the partition directory. */ std::unique_ptr directory = std::make_unique(this, mode); - R_UNLESS(directory != nullptr, fs::ResultAllocationFailureInPartitionFileSystemC()); + R_UNLESS(directory != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemC()); *out_dir = std::move(directory); R_SUCCEED(); } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp b/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp index 17bfd2274..52f81f9d4 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp @@ -44,7 +44,7 @@ namespace ams::fssystem { this->DeallocateBuffer(); m_allocator = allocator; m_buffer = static_cast(m_allocator->Allocate(m_meta_data_size)); - R_UNLESS(m_buffer != nullptr, fs::ResultAllocationFailureInPartitionFileSystemMetaA()); + R_UNLESS(m_buffer != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemMetaA()); /* Perform regular initialization. */ return this->Initialize(storage, m_buffer, m_meta_data_size); @@ -175,7 +175,7 @@ namespace ams::fssystem { /* Set allocator and allocate buffer. */ m_allocator = allocator; m_buffer = static_cast(m_allocator->Allocate(m_meta_data_size)); - R_UNLESS(m_buffer != nullptr, fs::ResultAllocationFailureInPartitionFileSystemMetaB()); + R_UNLESS(m_buffer != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemMetaB()); /* Read metadata. */ R_TRY(base_storage->Read(0, m_buffer, m_meta_data_size)); diff --git a/libraries/libstratosphere/source/fssystem/fssystem_romfs_filesystem.cpp b/libraries/libstratosphere/source/fssystem/fssystem_romfs_filesystem.cpp index f54ead8d1..061e518f9 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_romfs_filesystem.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_romfs_filesystem.cpp @@ -233,7 +233,7 @@ namespace ams::fssystem { /* Set up our storages. */ if (use_cache) { const size_t needed_size = CalculateRequiredWorkingMemorySize(header); - R_UNLESS(work_size >= needed_size, fs::ResultAllocationFailureInRomFsFileSystemA()); + R_UNLESS(work_size >= needed_size, fs::ResultAllocationMemoryFailedInRomFsFileSystemA()); u8 *buf = static_cast(work); auto dir_bucket_buf = buf; buf += header.directory_bucket_size; @@ -258,10 +258,10 @@ namespace ams::fssystem { } /* Ensure we allocated storages successfully. */ - R_UNLESS(m_dir_bucket_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB()); - R_UNLESS(m_dir_entry_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB()); - R_UNLESS(m_file_bucket_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB()); - R_UNLESS(m_file_entry_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB()); + R_UNLESS(m_dir_bucket_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB()); + R_UNLESS(m_dir_entry_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB()); + R_UNLESS(m_file_bucket_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB()); + R_UNLESS(m_file_entry_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB()); /* Initialize the rom table. */ R_TRY(m_rom_file_table.Initialize(fs::SubStorage(m_dir_bucket_storage.get(), 0, static_cast(header.directory_bucket_size)), @@ -369,7 +369,7 @@ namespace ams::fssystem { R_TRY(this->GetFileInfo(std::addressof(file_info), path)); auto file = std::make_unique(this, m_entry_size + file_info.offset.Get(), m_entry_size + file_info.offset.Get() + file_info.size.Get()); - R_UNLESS(file != nullptr, fs::ResultAllocationFailureInRomFsFileSystemC()); + R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemC()); *out_file = std::move(file); R_SUCCEED(); @@ -388,7 +388,7 @@ namespace ams::fssystem { }, AMS_CURRENT_FUNCTION_NAME)); auto dir = std::make_unique(this, find, mode); - R_UNLESS(dir != nullptr, fs::ResultAllocationFailureInRomFsFileSystemD()); + R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemD()); *out_dir = std::move(dir); R_SUCCEED(); diff --git a/libraries/libvapours/include/vapours/results/fs_results.hpp b/libraries/libvapours/include/vapours/results/fs_results.hpp index b1f04a4a7..287292fd7 100644 --- a/libraries/libvapours/include/vapours/results/fs_results.hpp +++ b/libraries/libvapours/include/vapours/results/fs_results.hpp @@ -55,77 +55,163 @@ namespace ams::fs { R_DEFINE_ERROR_RESULT(SystemPartitionNotReady, 3100); - R_DEFINE_ERROR_RANGE(AllocationFailure, 3200, 3499); - R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemAccessorA, 3211); - R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemAccessorB, 3212); - R_DEFINE_ERROR_RESULT(AllocationFailureInApplicationA, 3213); - R_DEFINE_ERROR_RESULT(AllocationFailureInBisA, 3215); - R_DEFINE_ERROR_RESULT(AllocationFailureInBisB, 3216); - R_DEFINE_ERROR_RESULT(AllocationFailureInBisC, 3217); - R_DEFINE_ERROR_RESULT(AllocationFailureInCodeA, 3218); - R_DEFINE_ERROR_RESULT(AllocationFailureInContentA, 3219); - R_DEFINE_ERROR_RESULT(AllocationFailureInContentStorageA, 3220); - R_DEFINE_ERROR_RESULT(AllocationFailureInContentStorageB, 3221); - R_DEFINE_ERROR_RESULT(AllocationFailureInDataA, 3222); - R_DEFINE_ERROR_RESULT(AllocationFailureInDataB, 3223); - R_DEFINE_ERROR_RESULT(AllocationFailureInDeviceSaveDataA, 3224); - R_DEFINE_ERROR_RESULT(AllocationFailureInGameCardA, 3225); - R_DEFINE_ERROR_RESULT(AllocationFailureInGameCardB, 3226); - R_DEFINE_ERROR_RESULT(AllocationFailureInGameCardC, 3227); - R_DEFINE_ERROR_RESULT(AllocationFailureInGameCardD, 3228); - R_DEFINE_ERROR_RESULT(AllocationFailureInHostA, 3229); - R_DEFINE_ERROR_RESULT(AllocationFailureInHostB, 3230); - R_DEFINE_ERROR_RESULT(AllocationFailureInHostC, 3231); - R_DEFINE_ERROR_RESULT(AllocationFailureInImageDirectoryA, 3232); - R_DEFINE_ERROR_RESULT(AllocationFailureInSdCardA, 3244); - R_DEFINE_ERROR_RESULT(AllocationFailureInSdCardB, 3245); - R_DEFINE_ERROR_RESULT(AllocationFailureInSystemSaveDataA, 3246); - R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemA, 3247); - R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemB, 3248); - R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemC, 3249); - R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemProxyCoreImplD, 3256); - R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemProxyCoreImplE, 3257); - R_DEFINE_ERROR_RESULT(AllocationFailureInProgramRegistryManagerA, 3258); - R_DEFINE_ERROR_RESULT(AllocationFailureInLocalFileSystemCreatorA, 3279); - R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemCreatorA, 3280); - R_DEFINE_ERROR_RESULT(AllocationFailureInRomFileSystemCreatorA, 3281); - R_DEFINE_ERROR_RESULT(AllocationFailureInStorageOnNcaCreatorA, 3288); - R_DEFINE_ERROR_RESULT(AllocationFailureInStorageOnNcaCreatorB, 3289); - R_DEFINE_ERROR_RESULT(AllocationFailureInSubDirectoryFileSystemCreatorA, 3290); - R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemBuddyHeapA, 3294); - R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemBufferManagerA, 3295); - R_DEFINE_ERROR_RESULT(AllocationFailureInBlockCacheBufferedStorageA, 3296); - R_DEFINE_ERROR_RESULT(AllocationFailureInBlockCacheBufferedStorageB, 3297); - R_DEFINE_ERROR_RESULT(AllocationFailureInIntegrityVerificationStorageA, 3304); - R_DEFINE_ERROR_RESULT(AllocationFailureInIntegrityVerificationStorageB, 3305); - R_DEFINE_ERROR_RESULT(AllocationFailureInDirectorySaveDataFileSystem, 3321); - R_DEFINE_ERROR_RESULT(AllocationFailureInLocalFileSystemA, 3322); - R_DEFINE_ERROR_RESULT(AllocationFailureInLocalFileSystemB, 3323); - R_DEFINE_ERROR_RESULT(AllocationFailureInNcaFileSystemDriverI, 3341); - R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemA, 3347); - R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemB, 3348); - R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemC, 3349); - R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemMetaA, 3350); - R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemMetaB, 3351); - R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemD, 3352); - R_DEFINE_ERROR_RESULT(AllocationFailureInSubDirectoryFileSystem, 3355); - R_DEFINE_ERROR_RESULT(AllocationFailureInNcaReaderA, 3363); - R_DEFINE_ERROR_RESULT(AllocationFailureInRegisterA, 3365); - R_DEFINE_ERROR_RESULT(AllocationFailureInRegisterB, 3366); - R_DEFINE_ERROR_RESULT(AllocationFailureInPathNormalizer, 3367); - R_DEFINE_ERROR_RESULT(AllocationFailureInDbmRomKeyValueStorage, 3375); - R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemE, 3377); - R_DEFINE_ERROR_RESULT(AllocationFailureInReadOnlyFileSystemA, 3386); - R_DEFINE_ERROR_RESULT(AllocationFailureInAesCtrCounterExtendedStorageA, 3399); - R_DEFINE_ERROR_RESULT(AllocationFailureInAesCtrCounterExtendedStorageB, 3400); - R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemInterfaceAdapter, 3407); - R_DEFINE_ERROR_RESULT(AllocationFailureInBufferedStorageA, 3411); - R_DEFINE_ERROR_RESULT(AllocationFailureInIntegrityRomFsStorageA, 3412); - R_DEFINE_ERROR_RESULT(AllocationFailureInNew, 3420); - R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemProxyImplA, 3421); - R_DEFINE_ERROR_RESULT(AllocationFailureInMakeUnique, 3422); - R_DEFINE_ERROR_RESULT(AllocationFailureInAllocateShared, 3423); - R_DEFINE_ERROR_RESULT(AllocationFailurePooledBufferNotEnoughSize, 3424); + R_DEFINE_ERROR_RANGE(AllocationMemoryFailed, 3200, 3499); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemA, 3201); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemC, 3203); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemD, 3204); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemE, 3205); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemF, 3206); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemH, 3208); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemAccessorA, 3211); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemAccessorB, 3212); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInApplicationA, 3213); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBcatSaveDataA, 3214); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBisA, 3215); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBisB, 3216); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBisC, 3217); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInCodeA, 3218); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInContentA, 3219); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInContentStorageA, 3220); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInContentStorageB, 3221); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDataA, 3222); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDataB, 3223); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDeviceSaveDataA, 3224); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardA, 3225); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardB, 3226); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardC, 3227); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardD, 3228); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInHostA, 3229); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInHostB, 3230); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInHostC, 3231); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInImageDirectoryA, 3232); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInLogoA, 3233); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomA, 3234); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomB, 3235); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomC, 3236); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomD, 3237); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomE, 3238); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomF, 3239); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataManagementA, 3242); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataThumbnailA, 3243); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdCardA, 3244); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdCardB, 3245); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSystemSaveDataA, 3246); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFsFileSystemA, 3247); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFsFileSystemB, 3248); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFsFileSystemC, 3249); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGuidPartitionTableA, 3251); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDeviceDetectionEventManagerA, 3252); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemServiceImplA, 3253); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemProxyCoreImplB, 3254); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdCardProxyFileSystemCreatorA, 3255); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInNcaFileSystemServiceImplA, 3256); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInNcaFileSystemServiceImplB, 3257); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInProgramRegistryManagerA, 3258); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdmmcStorageServiceA, 3259); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBuiltInStorageCreatorA, 3260); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBuiltInStorageCreatorB, 3261); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBuiltInStorageCreatorC, 3262); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedFatFileSystemWithBufferA, 3264); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemCreatorA, 3265); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemCreatorB, 3266); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorA, 3267); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorB, 3268); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorC, 3269); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorD, 3270); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorE, 3271); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorF, 3272); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerA, 3273); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerB, 3274); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerC, 3275); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerD, 3276); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerE, 3277); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerF, 3278); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInLocalFileSystemCreatorA, 3279); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInPartitionFileSystemCreatorA, 3280); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFileSystemCreatorA, 3281); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemCreatorA, 3282); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemCreatorB, 3283); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemCreatorC, 3284); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemCreatorD, 3285); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemCreatorE, 3286); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInStorageOnNcaCreatorA, 3288); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInStorageOnNcaCreatorB, 3289); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSubDirectoryFileSystemCreatorA, 3290); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInTargetManagerFileSystemCreatorA, 3291); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataIndexerA, 3292); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataIndexerB, 3293); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemBuddyHeapA, 3294); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemBufferManagerA, 3295); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBlockCacheBufferedStorageA, 3296); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBlockCacheBufferedStorageB, 3297); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDuplexStorageA, 3298); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInIntegrityVerificationStorageA, 3304); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInIntegrityVerificationStorageB, 3305); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInJournalStorageA, 3306); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInJournalStorageB, 3307); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemCoreA, 3310); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemCoreB, 3311); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileA, 3312); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileB, 3313); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileC, 3314); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileD, 3315); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileSystemA, 3316); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInConcatenationFileSystemA, 3319); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInConcatenationFileSystemB, 3320); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDirectorySaveDataFileSystemA, 3321); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInLocalFileSystemA, 3322); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInLocalFileSystemB, 3323); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInNcaFileSystemDriverI, 3341); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInPartitionFileSystemA, 3347); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInPartitionFileSystemB, 3348); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInPartitionFileSystemC, 3349); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInPartitionFileSystemMetaA, 3350); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInPartitionFileSystemMetaB, 3351); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFsFileSystemD, 3352); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSubdirectoryFileSystemA, 3355); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInTmFileSystemA, 3356); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInTmFileSystemB, 3357); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInProxyFileSystemA, 3359); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInProxyFileSystemB, 3360); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataExtraDataAccessorCacheManagerA, 3362); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInNcaReaderA, 3363); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRegisterA, 3365); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRegisterB, 3366); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInPathNormalizer, 3367); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDbmRomKeyValueStorage, 3375); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDbmHierarchicalRomFileTable, 3376); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFsFileSystemE, 3377); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInISaveFileSystemA, 3378); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInISaveFileSystemB, 3379); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomOnFileA, 3380); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomOnFileB, 3381); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomOnFileC, 3382); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileE, 3383); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileF, 3384); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileG, 3385); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInReadOnlyFileSystemA, 3386); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInEncryptedFileSystemCreatorA, 3394); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesCtrCounterExtendedStorageA, 3399); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesCtrCounterExtendedStorageB, 3400); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdmmcStorageServiceB, 3406); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemInterfaceAdapterA, 3407); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorG, 3408); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorH, 3409); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInAesXtsFileSystemB, 3410); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBufferedStorageA, 3411); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInIntegrityRomFsStorageA, 3412); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemServiceImplB, 3416); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedNew, 3420); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemProxyImplA, 3421); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedMakeUnique, 3422); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedAllocateShared, 3423); + R_DEFINE_ERROR_RESULT(AllocationPooledBufferNotEnoughSize, 3424); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInWriteThroughCacheStorageA, 3428); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataTransferManagerA, 3429); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataTransferManagerB, 3430); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInHtcFileSystemA, 3431); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInHtcFileSystemB, 3432); + R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerG, 3433); R_DEFINE_ERROR_RANGE(Internal, 3000, 7999); R_DEFINE_ERROR_RANGE(MmcAccessFailed, 3500, 3999); diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp index c8ac7951f..722c895ee 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp @@ -69,7 +69,7 @@ namespace ams::mitm::sysupdater { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_shared(fs); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSdCardA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSdCardA()); /* Set the output fs. */ *out = std::move(fsa); @@ -83,7 +83,7 @@ namespace ams::mitm::sysupdater { /* Allocate a new filesystem wrapper. */ auto fsa = std::make_shared(fs); - R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInContentStorageA()); + R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInContentStorageA()); /* Set the output fs. */ *out = std::move(fsa); @@ -123,7 +123,7 @@ namespace ams::mitm::sysupdater { /* Open the file storage. */ std::shared_ptr file_storage = fssystem::AllocateShared(); - R_UNLESS(file_storage != nullptr, fs::ResultAllocationFailureInFileSystemProxyCoreImplD()); + R_UNLESS(file_storage != nullptr, fs::ResultAllocationMemoryFailedInFileSystemProxyCoreImplD()); R_TRY(file_storage->Initialize(std::move(base_fs), nsp_path, ams::fs::OpenMode_Read)); /* Create a partition fs. */ @@ -138,7 +138,7 @@ namespace ams::mitm::sysupdater { Result ParseNca(const char **path, std::shared_ptr *out, std::shared_ptr base_fs) { /* Open the file storage. */ std::shared_ptr file_storage = fssystem::AllocateShared(); - R_UNLESS(file_storage != nullptr, fs::ResultAllocationFailureInFileSystemProxyCoreImplE()); + R_UNLESS(file_storage != nullptr, fs::ResultAllocationMemoryFailedInFileSystemProxyCoreImplE()); /* Get the nca path. */ ams::fs::Path nca_path; @@ -245,7 +245,7 @@ namespace ams::mitm::sysupdater { /* Create a holder for the fs. */ std::unique_ptr unique_fs = std::make_unique(std::move(fs)); - R_UNLESS(unique_fs != nullptr, fs::ResultAllocationFailureInNew()); + R_UNLESS(unique_fs != nullptr, fs::ResultAllocationMemoryFailedNew()); /* Register the fs. */ return ams::fs::fsa::Register(mount_name, std::move(unique_fs)); diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp index 496cf5550..0893a1ada 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp @@ -147,7 +147,7 @@ namespace ams::mitm::sysupdater { data_buffer_size /= 2; } while (data_buffer_size >= 16_KB); - R_UNLESS(data_buffer != nullptr, fs::ResultAllocationFailureInNew()); + R_UNLESS(data_buffer != nullptr, fs::ResultAllocationMemoryFailedNew()); ON_SCOPE_EXIT { std::free(data_buffer); };