mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
fs: revise allocation-fail result names
This commit is contained in:
parent
11e4bed199
commit
e13b81aa9e
50 changed files with 304 additions and 218 deletions
|
@ -203,7 +203,7 @@ namespace ams::fs {
|
||||||
R_UNLESS(cur != InvalidPosition, fs::ResultDbmKeyNotFound());
|
R_UNLESS(cur != InvalidPosition, fs::ResultDbmKeyNotFound());
|
||||||
|
|
||||||
u8 *buf = static_cast<u8 *>(::ams::fs::impl::Allocate(MaxAuxiliarySize));
|
u8 *buf = static_cast<u8 *>(::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); };
|
ON_SCOPE_EXIT { ::ams::fs::impl::Deallocate(buf, MaxAuxiliarySize); };
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
@ -434,7 +434,7 @@ namespace ams::fs {
|
||||||
/* Allocate a new buffer. */
|
/* Allocate a new buffer. */
|
||||||
const size_t size = util::AlignUp(len, WriteBufferAlignmentLength);
|
const size_t size = util::AlignUp(len, WriteBufferAlignmentLength);
|
||||||
auto buf = fs::impl::MakeUnique<char[]>(size);
|
auto buf = fs::impl::MakeUnique<char[]>(size);
|
||||||
R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInMakeUnique());
|
R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedMakeUnique());
|
||||||
|
|
||||||
/* Normalize into it. */
|
/* Normalize into it. */
|
||||||
R_TRY(PathFormatter::Normalize(buf.get(), size, util::GetReference(m_write_buffer).get(), m_write_buffer_length, flags));
|
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. */
|
/* Allocate buffer. */
|
||||||
const size_t size = util::AlignUp(length, WriteBufferAlignmentLength);
|
const size_t size = util::AlignUp(length, WriteBufferAlignmentLength);
|
||||||
auto buf = fs::impl::MakeUnique<char[]>(size);
|
auto buf = fs::impl::MakeUnique<char[]>(size);
|
||||||
R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInMakeUnique());
|
R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedMakeUnique());
|
||||||
|
|
||||||
/* Set write buffer. */
|
/* Set write buffer. */
|
||||||
this->SetModifiableBuffer(std::move(buf), size);
|
this->SetModifiableBuffer(std::move(buf), size);
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace ams::fs {
|
||||||
R_TRY(m_base_fs->OpenFile(std::addressof(base_file), path, mode));
|
R_TRY(m_base_fs->OpenFile(std::addressof(base_file), path, mode));
|
||||||
|
|
||||||
auto read_only_file = std::make_unique<ReadOnlyFile>(std::move(base_file));
|
auto read_only_file = std::make_unique<ReadOnlyFile>(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);
|
*out_file = std::move(read_only_file);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
|
|
@ -178,7 +178,7 @@ namespace ams::fs {
|
||||||
R_TRY(fsFsOpenFile(std::addressof(m_base_fs), sf_path.str, mode, std::addressof(f)));
|
R_TRY(fsFsOpenFile(std::addressof(m_base_fs), sf_path.str, mode, std::addressof(f)));
|
||||||
|
|
||||||
auto file = std::make_unique<RemoteFile>(f);
|
auto file = std::make_unique<RemoteFile>(f);
|
||||||
R_UNLESS(file != nullptr, fs::ResultAllocationFailureInNew());
|
R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedNew());
|
||||||
|
|
||||||
*out_file = std::move(file);
|
*out_file = std::move(file);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
@ -192,7 +192,7 @@ namespace ams::fs {
|
||||||
R_TRY(fsFsOpenDirectory(std::addressof(m_base_fs), sf_path.str, mode, std::addressof(d)));
|
R_TRY(fsFsOpenDirectory(std::addressof(m_base_fs), sf_path.str, mode, std::addressof(d)));
|
||||||
|
|
||||||
auto dir = std::make_unique<RemoteDirectory>(d);
|
auto dir = std::make_unique<RemoteDirectory>(d);
|
||||||
R_UNLESS(dir != nullptr, fs::ResultAllocationFailureInNew());
|
R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedNew());
|
||||||
|
|
||||||
*out_dir = std::move(dir);
|
*out_dir = std::move(dir);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace ams::fssrv::impl {
|
||||||
} else {
|
} else {
|
||||||
/* Make a new entry. */
|
/* Make a new entry. */
|
||||||
auto *entry = new ExternalKeyEntry(rights_id, access_key);
|
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. */
|
/* Add the entry to our list. */
|
||||||
m_key_list.push_back(*entry);
|
m_key_list.push_back(*entry);
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace ams::fssrv::impl {
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
/* Allocate new entry. */
|
/* Allocate new entry. */
|
||||||
auto *entry = new ProgramIndexMapInfoEntry;
|
auto *entry = new ProgramIndexMapInfoEntry;
|
||||||
R_UNLESS(entry != nullptr, fs::ResultAllocationFailureInNew());
|
R_UNLESS(entry != nullptr, fs::ResultAllocationMemoryFailedNew());
|
||||||
|
|
||||||
/* Copy over the info. */
|
/* Copy over the info. */
|
||||||
entry->program_id = infos[i].program_id;
|
entry->program_id = infos[i].program_id;
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace ams::fssystem::impl {
|
||||||
if (max_entries > 0) {
|
if (max_entries > 0) {
|
||||||
/* Create the entries. */
|
/* Create the entries. */
|
||||||
m_entries = fs::impl::MakeUnique<CacheEntry[]>(static_cast<size_t>(max_entries));
|
m_entries = fs::impl::MakeUnique<CacheEntry[]>(static_cast<size_t>(max_entries));
|
||||||
R_UNLESS(m_entries != nullptr, fs::ResultAllocationFailureInMakeUnique());
|
R_UNLESS(m_entries != nullptr, fs::ResultAllocationMemoryFailedMakeUnique());
|
||||||
|
|
||||||
/* Clear the entries. */
|
/* Clear the entries. */
|
||||||
std::memset(m_entries.get(), 0, sizeof(CacheEntry) * max_entries);
|
std::memset(m_entries.get(), 0, sizeof(CacheEntry) * max_entries);
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInApplicationA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInApplicationA());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(name, std::move(fsa)));
|
R_RETURN(fsa::Register(name, std::move(fsa)));
|
||||||
|
|
|
@ -66,11 +66,11 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new mountname generator. */
|
/* Allocate a new mountname generator. */
|
||||||
auto generator = std::make_unique<BisCommonMountNameGenerator>(id);
|
auto generator = std::make_unique<BisCommonMountNameGenerator>(id);
|
||||||
R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInBisA());
|
R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInBisA());
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInBisB());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInBisB());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator)));
|
R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator)));
|
||||||
|
@ -122,7 +122,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new storage wrapper. */
|
/* Allocate a new storage wrapper. */
|
||||||
auto storage = std::make_unique<impl::StorageServiceObjectAdapter>(std::move(s));
|
auto storage = std::make_unique<impl::StorageServiceObjectAdapter>(std::move(s));
|
||||||
AMS_FS_R_UNLESS(storage != nullptr, fs::ResultAllocationFailureInBisC());
|
AMS_FS_R_UNLESS(storage != nullptr, fs::ResultAllocationMemoryFailedInBisC());
|
||||||
|
|
||||||
*out = std::move(storage);
|
*out = std::move(storage);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInCodeA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInCodeA());
|
||||||
|
|
||||||
*out = std::move(fsa);
|
*out = std::move(fsa);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
@ -97,7 +97,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInCodeA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInCodeA());
|
||||||
|
|
||||||
*out = std::move(fsa);
|
*out = std::move(fsa);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
@ -135,11 +135,11 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Create a file storage for the program's package. */
|
/* Create a file storage for the program's package. */
|
||||||
auto package_storage = std::make_shared<FileStorage>(std::move(package_file));
|
auto package_storage = std::make_shared<FileStorage>(std::move(package_file));
|
||||||
R_UNLESS(package_storage != nullptr, fs::ResultAllocationFailureInCodeA());
|
R_UNLESS(package_storage != nullptr, fs::ResultAllocationMemoryFailedInCodeA());
|
||||||
|
|
||||||
/* Create a partition filesystem. */
|
/* Create a partition filesystem. */
|
||||||
auto package_fs = std::make_unique<fssystem::PartitionFileSystem>();
|
auto package_fs = std::make_unique<fssystem::PartitionFileSystem>();
|
||||||
R_UNLESS(package_fs != nullptr, fs::ResultAllocationFailureInCodeA());
|
R_UNLESS(package_fs != nullptr, fs::ResultAllocationMemoryFailedInCodeA());
|
||||||
|
|
||||||
/* Initialize the partition filesystem. */
|
/* Initialize the partition filesystem. */
|
||||||
R_TRY(package_fs->Initialize(package_storage));
|
R_TRY(package_fs->Initialize(package_storage));
|
||||||
|
@ -178,7 +178,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_shared<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_shared<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInCodeA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInCodeA());
|
||||||
|
|
||||||
*out = std::move(fsa);
|
*out = std::move(fsa);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
@ -427,7 +427,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Create an AtmosphereCodeFileSystem. */
|
/* Create an AtmosphereCodeFileSystem. */
|
||||||
auto ams_code_fs = std::make_unique<AtmosphereCodeFileSystem>();
|
auto ams_code_fs = std::make_unique<AtmosphereCodeFileSystem>();
|
||||||
R_UNLESS(ams_code_fs != nullptr, fs::ResultAllocationFailureInCodeA());
|
R_UNLESS(ams_code_fs != nullptr, fs::ResultAllocationMemoryFailedInCodeA());
|
||||||
|
|
||||||
/* Initialize the code file system. */
|
/* Initialize the code file system. */
|
||||||
R_TRY(ams_code_fs->Initialize(out, path, program_id, is_hbl, is_specific));
|
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. */
|
/* Create a wrapper fs. */
|
||||||
auto wrap_fsa = std::make_unique<SdCardRedirectionCodeFileSystem>(std::move(fsa), program_id, false);
|
auto wrap_fsa = std::make_unique<SdCardRedirectionCodeFileSystem>(std::move(fsa), program_id, false);
|
||||||
R_UNLESS(wrap_fsa != nullptr, fs::ResultAllocationFailureInCodeA());
|
R_UNLESS(wrap_fsa != nullptr, fs::ResultAllocationMemoryFailedInCodeA());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(name, std::move(wrap_fsa)));
|
R_RETURN(fsa::Register(name, std::move(wrap_fsa)));
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInContentA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInContentA());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(name, std::move(fsa)));
|
R_RETURN(fsa::Register(name, std::move(fsa)));
|
||||||
|
|
|
@ -90,11 +90,11 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInContentStorageA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInContentStorageA());
|
||||||
|
|
||||||
/* Allocate a new mountname generator. */
|
/* Allocate a new mountname generator. */
|
||||||
auto generator = std::make_unique<ContentStorageCommonMountNameGenerator>(id);
|
auto generator = std::make_unique<ContentStorageCommonMountNameGenerator>(id);
|
||||||
R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInContentStorageB());
|
R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInContentStorageB());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator)));
|
R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator)));
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace ams::fs::impl {
|
||||||
AMS_FS_R_TRY(OpenDataStorageByDataIdImpl(std::addressof(s), data_id, storage_id));
|
AMS_FS_R_TRY(OpenDataStorageByDataIdImpl(std::addressof(s), data_id, storage_id));
|
||||||
|
|
||||||
auto storage = std::make_unique<impl::StorageServiceObjectAdapter>(std::move(s));
|
auto storage = std::make_unique<impl::StorageServiceObjectAdapter>(std::move(s));
|
||||||
R_UNLESS(storage != nullptr, fs::ResultAllocationFailureInDataA());
|
R_UNLESS(storage != nullptr, fs::ResultAllocationMemoryFailedInDataA());
|
||||||
|
|
||||||
*out = std::move(storage);
|
*out = std::move(storage);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
@ -47,7 +47,7 @@ namespace ams::fs::impl {
|
||||||
R_TRY(OpenDataStorageByDataId(std::addressof(storage), data_id, storage_id));
|
R_TRY(OpenDataStorageByDataId(std::addressof(storage), data_id, storage_id));
|
||||||
|
|
||||||
auto fs = std::make_unique<RomFsFileSystem>();
|
auto fs = std::make_unique<RomFsFileSystem>();
|
||||||
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));
|
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);
|
return fsa::Register(name, std::move(fs), nullptr, use_data_cache, use_path_cache, false);
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInDeviceSaveDataA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInDeviceSaveDataA());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
return fsa::Register(name, std::move(fsa));
|
return fsa::Register(name, std::move(fsa));
|
||||||
|
|
|
@ -81,11 +81,11 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInGameCardC());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInGameCardC());
|
||||||
|
|
||||||
/* Allocate a new mountname generator. */
|
/* Allocate a new mountname generator. */
|
||||||
auto generator = std::make_unique<GameCardCommonMountNameGenerator>(handle, partition);
|
auto generator = std::make_unique<GameCardCommonMountNameGenerator>(handle, partition);
|
||||||
R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInGameCardD());
|
R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInGameCardD());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator)));
|
R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator)));
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInHostA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInHostA());
|
||||||
|
|
||||||
/* Set the output. */
|
/* Set the output. */
|
||||||
*out = std::move(fsa);
|
*out = std::move(fsa);
|
||||||
|
@ -95,7 +95,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Create a new HostCommonMountNameGenerator. */
|
/* Create a new HostCommonMountNameGenerator. */
|
||||||
*out = std::make_unique<HostCommonMountNameGenerator>(path);
|
*out = std::make_unique<HostCommonMountNameGenerator>(path);
|
||||||
R_UNLESS(out->get() != nullptr, fs::ResultAllocationFailureInHostB());
|
R_UNLESS(out->get() != nullptr, fs::ResultAllocationMemoryFailedInHostB());
|
||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ namespace ams::fs {
|
||||||
auto register_impl = [&]() -> Result {
|
auto register_impl = [&]() -> Result {
|
||||||
/* Allocate a new mountname generator. */
|
/* Allocate a new mountname generator. */
|
||||||
auto generator = std::make_unique<HostRootCommonMountNameGenerator>();
|
auto generator = std::make_unique<HostRootCommonMountNameGenerator>();
|
||||||
R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInHostC());
|
R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInHostC());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(impl::HostRootFileSystemMountName, std::move(fsa), std::move(generator)));
|
R_RETURN(fsa::Register(impl::HostRootFileSystemMountName, std::move(fsa), std::move(generator)));
|
||||||
|
@ -219,7 +219,7 @@ namespace ams::fs {
|
||||||
auto register_impl = [&]() -> Result {
|
auto register_impl = [&]() -> Result {
|
||||||
/* Allocate a new mountname generator. */
|
/* Allocate a new mountname generator. */
|
||||||
auto generator = std::make_unique<HostRootCommonMountNameGenerator>();
|
auto generator = std::make_unique<HostRootCommonMountNameGenerator>();
|
||||||
R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInHostC());
|
R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInHostC());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(impl::HostRootFileSystemMountName, std::move(fsa), std::move(generator)));
|
R_RETURN(fsa::Register(impl::HostRootFileSystemMountName, std::move(fsa), std::move(generator)));
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInImageDirectoryA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInImageDirectoryA());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
R_RETURN(fsa::Register(name, std::move(fsa)));
|
R_RETURN(fsa::Register(name, std::move(fsa)));
|
||||||
|
|
|
@ -281,7 +281,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
constexpr size_t NameBufferSize = fs::EntryNameLengthMax + 1;
|
constexpr size_t NameBufferSize = fs::EntryNameLengthMax + 1;
|
||||||
char *name_buf = static_cast<char *>(::ams::fs::impl::Allocate(NameBufferSize));
|
char *name_buf = static_cast<char *>(::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); };
|
ON_SCOPE_EXIT { ::ams::fs::impl::Deallocate(name_buf, NameBufferSize); };
|
||||||
|
|
||||||
s32 i = 0;
|
s32 i = 0;
|
||||||
|
@ -393,10 +393,10 @@ namespace ams::fs {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure we allocated storages successfully. */
|
/* Ensure we allocated storages successfully. */
|
||||||
R_UNLESS(m_dir_bucket_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemA());
|
R_UNLESS(m_dir_bucket_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemA());
|
||||||
R_UNLESS(m_dir_entry_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemA());
|
R_UNLESS(m_dir_entry_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemA());
|
||||||
R_UNLESS(m_file_bucket_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemA());
|
R_UNLESS(m_file_bucket_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemA());
|
||||||
R_UNLESS(m_file_entry_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemA());
|
R_UNLESS(m_file_entry_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemA());
|
||||||
|
|
||||||
/* Initialize the rom table. */
|
/* Initialize the rom table. */
|
||||||
{
|
{
|
||||||
|
@ -505,7 +505,7 @@ namespace ams::fs {
|
||||||
R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString()));
|
R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString()));
|
||||||
|
|
||||||
auto file = std::make_unique<RomFsFile>(this, m_entry_size + file_info.offset.Get(), m_entry_size + file_info.offset.Get() + file_info.size.Get());
|
auto file = std::make_unique<RomFsFile>(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);
|
*out_file = std::move(file);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
@ -521,7 +521,7 @@ namespace ams::fs {
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
auto dir = std::make_unique<RomFsDirectory>(this, find, mode);
|
auto dir = std::make_unique<RomFsDirectory>(this, find, mode);
|
||||||
R_UNLESS(dir != nullptr, fs::ResultAllocationFailureInRomFsFileSystemC());
|
R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemC());
|
||||||
|
|
||||||
*out_dir = std::move(dir);
|
*out_dir = std::move(dir);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
|
|
@ -58,12 +58,12 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSdCardA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSdCardA());
|
||||||
|
|
||||||
/* Allocate a new mountname generator. */
|
/* Allocate a new mountname generator. */
|
||||||
/* NOTE: Nintendo does not attach a generator. */
|
/* NOTE: Nintendo does not attach a generator. */
|
||||||
auto generator = std::make_unique<SdCardCommonMountNameGenerator>();
|
auto generator = std::make_unique<SdCardCommonMountNameGenerator>();
|
||||||
R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInSdCardA());
|
R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInSdCardA());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
return fsa::Register(name, std::move(fsa), std::move(generator));
|
return fsa::Register(name, std::move(fsa), std::move(generator));
|
||||||
|
@ -80,7 +80,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_shared<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_shared<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSdCardA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSdCardA());
|
||||||
|
|
||||||
/* Ensure that the error report directory exists. */
|
/* Ensure that the error report directory exists. */
|
||||||
constexpr fs::Path fs_path = fs::MakeConstantPath(AtmosphereErrorReportDirectory);
|
constexpr fs::Path fs_path = fs::MakeConstantPath(AtmosphereErrorReportDirectory);
|
||||||
|
@ -88,7 +88,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Create a subdirectory filesystem. */
|
/* Create a subdirectory filesystem. */
|
||||||
auto subdir_fs = std::make_unique<fssystem::SubDirectoryFileSystem>(std::move(fsa));
|
auto subdir_fs = std::make_unique<fssystem::SubDirectoryFileSystem>(std::move(fsa));
|
||||||
R_UNLESS(subdir_fs != nullptr, fs::ResultAllocationFailureInSdCardA());
|
R_UNLESS(subdir_fs != nullptr, fs::ResultAllocationMemoryFailedInSdCardA());
|
||||||
R_TRY(subdir_fs->Initialize(fs_path));
|
R_TRY(subdir_fs->Initialize(fs_path));
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
|
@ -104,7 +104,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Create an event notifier adapter. */
|
/* Create an event notifier adapter. */
|
||||||
auto adapter = std::make_unique<impl::EventNotifierObjectAdapter>(std::move(notifier));
|
auto adapter = std::make_unique<impl::EventNotifierObjectAdapter>(std::move(notifier));
|
||||||
AMS_FS_R_UNLESS(adapter != nullptr, fs::ResultAllocationFailureInSdCardB());
|
AMS_FS_R_UNLESS(adapter != nullptr, fs::ResultAllocationMemoryFailedInSdCardB());
|
||||||
|
|
||||||
*out = std::move(adapter);
|
*out = std::move(adapter);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
auto fsa = std::make_unique<impl::FileSystemServiceObjectAdapter>(std::move(fs));
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSystemSaveDataA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSystemSaveDataA());
|
||||||
|
|
||||||
/* Register. */
|
/* Register. */
|
||||||
return fsa::Register(name, std::move(fsa));
|
return fsa::Register(name, std::move(fsa));
|
||||||
|
|
|
@ -223,7 +223,7 @@ namespace ams::fs::impl {
|
||||||
R_TRY(m_impl->OpenFile(std::addressof(file), normalized_path, mode));
|
R_TRY(m_impl->OpenFile(std::addressof(file), normalized_path, mode));
|
||||||
|
|
||||||
auto accessor = new FileAccessor(std::move(file), this, 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);
|
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));
|
R_TRY(m_impl->OpenDirectory(std::addressof(dir), normalized_path, mode));
|
||||||
|
|
||||||
auto accessor = new DirectoryAccessor(std::move(dir), *this);
|
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);
|
std::scoped_lock lk(m_open_list_lock);
|
||||||
|
|
|
@ -21,21 +21,21 @@ namespace ams::fs::fsa {
|
||||||
|
|
||||||
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs) {
|
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs) {
|
||||||
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs));
|
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs));
|
||||||
R_UNLESS(accessor != nullptr, fs::ResultAllocationFailureInRegisterA());
|
R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterA());
|
||||||
|
|
||||||
return impl::Register(std::move(accessor));
|
return impl::Register(std::move(accessor));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator) {
|
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator) {
|
||||||
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs), std::move(generator));
|
auto accessor = std::make_unique<impl::FileSystemAccessor>(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));
|
return impl::Register(std::move(accessor));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator, bool use_data_cache, bool use_path_cache, bool support_multi_commit) {
|
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator, bool use_data_cache, bool use_path_cache, bool support_multi_commit) {
|
||||||
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs), std::move(generator));
|
auto accessor = std::make_unique<impl::FileSystemAccessor>(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->SetFileDataCacheAttachable(use_data_cache);
|
||||||
accessor->SetPathBasedFileDataCacheAttachable(use_path_cache);
|
accessor->SetPathBasedFileDataCacheAttachable(use_path_cache);
|
||||||
|
|
|
@ -201,7 +201,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
|
AMS_FS_R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
|
||||||
|
|
||||||
auto file_accessor = std::make_unique<impl::FileAccessor>(std::move(file), nullptr, static_cast<OpenMode>(mode));
|
auto file_accessor = std::make_unique<impl::FileAccessor>(std::move(file), nullptr, static_cast<OpenMode>(mode));
|
||||||
AMS_FS_R_UNLESS(file_accessor != nullptr, fs::ResultAllocationFailureInNew());
|
AMS_FS_R_UNLESS(file_accessor != nullptr, fs::ResultAllocationMemoryFailedNew());
|
||||||
out->handle = file_accessor.release();
|
out->handle = file_accessor.release();
|
||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
|
|
@ -127,7 +127,7 @@ namespace ams::fs::impl {
|
||||||
|
|
||||||
/* Create the output fsa file. */
|
/* Create the output fsa file. */
|
||||||
out_file->reset(new FileServiceObjectAdapter(std::move(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();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ namespace ams::fs::impl {
|
||||||
|
|
||||||
/* Create the output fsa directory. */
|
/* Create the output fsa directory. */
|
||||||
out_dir->reset(new DirectoryServiceObjectAdapter(std::move(dir)));
|
out_dir->reset(new DirectoryServiceObjectAdapter(std::move(dir)));
|
||||||
R_UNLESS(out_dir != nullptr, fs::ResultAllocationFailureInNew());
|
R_UNLESS(out_dir != nullptr, fs::ResultAllocationMemoryFailedNew());
|
||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace ams::fssrv::fscreator {
|
||||||
|
|
||||||
/* Allocate a local filesystem. */
|
/* Allocate a local filesystem. */
|
||||||
auto local_fs = fs::AllocateShared<fssystem::LocalFileSystem>();
|
auto local_fs = fs::AllocateShared<fssystem::LocalFileSystem>();
|
||||||
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 we're supposed to make sure the root path exists, do so. */
|
||||||
if (ensure_root) {
|
if (ensure_root) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace ams::fssrv::fscreator {
|
||||||
Result PartitionFileSystemCreator::Create(std::shared_ptr<fs::fsa::IFileSystem> *out, std::shared_ptr<fs::IStorage> storage) {
|
Result PartitionFileSystemCreator::Create(std::shared_ptr<fs::fsa::IFileSystem> *out, std::shared_ptr<fs::IStorage> storage) {
|
||||||
/* Allocate a filesystem. */
|
/* Allocate a filesystem. */
|
||||||
std::shared_ptr fs = fssystem::AllocateShared<fssystem::PartitionFileSystem>();
|
std::shared_ptr fs = fssystem::AllocateShared<fssystem::PartitionFileSystem>();
|
||||||
R_UNLESS(fs != nullptr, fs::ResultAllocationFailureInPartitionFileSystemCreatorA());
|
R_UNLESS(fs != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemCreatorA());
|
||||||
|
|
||||||
/* Initialize the filesystem. */
|
/* Initialize the filesystem. */
|
||||||
R_TRY(fs->Initialize(std::move(storage)));
|
R_TRY(fs->Initialize(std::move(storage)));
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace ams::fssrv::fscreator {
|
||||||
Result RomFileSystemCreator::Create(std::shared_ptr<fs::fsa::IFileSystem> *out, std::shared_ptr<fs::IStorage> storage) {
|
Result RomFileSystemCreator::Create(std::shared_ptr<fs::fsa::IFileSystem> *out, std::shared_ptr<fs::IStorage> storage) {
|
||||||
/* Allocate a filesystem. */
|
/* Allocate a filesystem. */
|
||||||
std::shared_ptr fs = fssystem::AllocateShared<RomFileSystemWithBuffer>(m_allocator);
|
std::shared_ptr fs = fssystem::AllocateShared<RomFileSystemWithBuffer>(m_allocator);
|
||||||
R_UNLESS(fs != nullptr, fs::ResultAllocationFailureInRomFileSystemCreatorA());
|
R_UNLESS(fs != nullptr, fs::ResultAllocationMemoryFailedInRomFileSystemCreatorA());
|
||||||
|
|
||||||
/* Initialize the filesystem. */
|
/* Initialize the filesystem. */
|
||||||
R_TRY(fs->Initialize(std::move(storage)));
|
R_TRY(fs->Initialize(std::move(storage)));
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace ams::fssrv::fscreator {
|
||||||
Result StorageOnNcaCreator::CreateNcaReader(std::shared_ptr<fssystem::NcaReader> *out, std::shared_ptr<fs::IStorage> storage) {
|
Result StorageOnNcaCreator::CreateNcaReader(std::shared_ptr<fssystem::NcaReader> *out, std::shared_ptr<fs::IStorage> storage) {
|
||||||
/* Create a reader. */
|
/* Create a reader. */
|
||||||
std::shared_ptr reader = fssystem::AllocateShared<fssystem::NcaReader>();
|
std::shared_ptr reader = fssystem::AllocateShared<fssystem::NcaReader>();
|
||||||
R_UNLESS(reader != nullptr, fs::ResultAllocationFailureInStorageOnNcaCreatorB());
|
R_UNLESS(reader != nullptr, fs::ResultAllocationMemoryFailedInStorageOnNcaCreatorB());
|
||||||
|
|
||||||
/* Initialize the reader. */
|
/* Initialize the reader. */
|
||||||
R_TRY(reader->Initialize(std::move(storage), m_nca_crypto_cfg, m_nca_compression_cfg, m_hash_generator_factory_selector));
|
R_TRY(reader->Initialize(std::move(storage), m_nca_crypto_cfg, m_nca_compression_cfg, m_hash_generator_factory_selector));
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace ams::fssrv::fscreator {
|
||||||
|
|
||||||
/* Allocate a SubDirectoryFileSystem. */
|
/* Allocate a SubDirectoryFileSystem. */
|
||||||
auto sub_dir_fs = fs::AllocateShared<fssystem::SubDirectoryFileSystem>(std::move(base_fs));
|
auto sub_dir_fs = fs::AllocateShared<fssystem::SubDirectoryFileSystem>(std::move(base_fs));
|
||||||
R_UNLESS(sub_dir_fs != nullptr, fs::ResultAllocationFailureInSubDirectoryFileSystemCreatorA());
|
R_UNLESS(sub_dir_fs != nullptr, fs::ResultAllocationMemoryFailedInSubDirectoryFileSystemCreatorA());
|
||||||
|
|
||||||
/* Initialize the new filesystem. */
|
/* Initialize the new filesystem. */
|
||||||
R_TRY(sub_dir_fs->Initialize(path));
|
R_TRY(sub_dir_fs->Initialize(path));
|
||||||
|
|
|
@ -186,7 +186,7 @@ namespace ams::fssrv {
|
||||||
|
|
||||||
/* Create an interface adapter. */
|
/* Create an interface adapter. */
|
||||||
auto sf_fs = impl::FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IFileSystem, impl::FileSystemInterfaceAdapter>(std::move(fs), host_path_flags, false);
|
auto sf_fs = impl::FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IFileSystem, impl::FileSystemInterfaceAdapter>(std::move(fs), host_path_flags, false);
|
||||||
R_UNLESS(sf_fs != nullptr, fs::ResultAllocationFailureInFileSystemProxyImplA());
|
R_UNLESS(sf_fs != nullptr, fs::ResultAllocationMemoryFailedInFileSystemProxyImplA());
|
||||||
|
|
||||||
/* Set the output. */
|
/* Set the output. */
|
||||||
*out = std::move(sf_fs);
|
*out = std::move(sf_fs);
|
||||||
|
|
|
@ -251,12 +251,12 @@ namespace ams::fssrv::impl {
|
||||||
const auto target_object_id = file->GetDomainObjectId();
|
const auto target_object_id = file->GetDomainObjectId();
|
||||||
|
|
||||||
ams::sf::SharedPointer<fssrv::sf::IFile> file_intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IFile, FileInterfaceAdapter>(std::move(file), this, m_allow_all_operations);
|
ams::sf::SharedPointer<fssrv::sf::IFile> file_intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IFile, FileInterfaceAdapter>(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);
|
out.SetValue(std::move(file_intf), target_object_id);
|
||||||
} else {
|
} else {
|
||||||
ams::sf::SharedPointer<fssrv::sf::IFile> file_intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IFile, FileInterfaceAdapter>(std::move(file), this, m_allow_all_operations);
|
ams::sf::SharedPointer<fssrv::sf::IFile> file_intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IFile, FileInterfaceAdapter>(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));
|
out.SetValue(std::move(file_intf));
|
||||||
}
|
}
|
||||||
|
@ -281,12 +281,12 @@ namespace ams::fssrv::impl {
|
||||||
const auto target_object_id = dir->GetDomainObjectId();
|
const auto target_object_id = dir->GetDomainObjectId();
|
||||||
|
|
||||||
ams::sf::SharedPointer<fssrv::sf::IDirectory> dir_intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IDirectory, DirectoryInterfaceAdapter>(std::move(dir), this, m_allow_all_operations);
|
ams::sf::SharedPointer<fssrv::sf::IDirectory> dir_intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IDirectory, DirectoryInterfaceAdapter>(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);
|
out.SetValue(std::move(dir_intf), target_object_id);
|
||||||
} else {
|
} else {
|
||||||
ams::sf::SharedPointer<fssrv::sf::IDirectory> dir_intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IDirectory, DirectoryInterfaceAdapter>(std::move(dir), this, m_allow_all_operations);
|
ams::sf::SharedPointer<fssrv::sf::IDirectory> dir_intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IDirectory, DirectoryInterfaceAdapter>(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));
|
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)));
|
R_TRY(fsFsOpenFile(std::addressof(m_base_fs), path.str, mode, std::addressof(f)));
|
||||||
|
|
||||||
auto intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IFile, RemoteFile>(f);
|
auto intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IFile, RemoteFile>(f);
|
||||||
R_UNLESS(intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter());
|
R_UNLESS(intf != nullptr, fs::ResultAllocationMemoryFailedInFileSystemInterfaceAdapterA());
|
||||||
|
|
||||||
out.SetValue(std::move(intf));
|
out.SetValue(std::move(intf));
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
@ -369,7 +369,7 @@ namespace ams::fssrv::impl {
|
||||||
R_TRY(fsFsOpenDirectory(std::addressof(m_base_fs), path.str, mode, std::addressof(d)));
|
R_TRY(fsFsOpenDirectory(std::addressof(m_base_fs), path.str, mode, std::addressof(d)));
|
||||||
|
|
||||||
auto intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IDirectory, RemoteDirectory>(d);
|
auto intf = FileSystemObjectFactory::CreateSharedEmplaced<fssrv::sf::IDirectory, RemoteDirectory>(d);
|
||||||
R_UNLESS(intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter());
|
R_UNLESS(intf != nullptr, fs::ResultAllocationMemoryFailedInFileSystemInterfaceAdapterA());
|
||||||
|
|
||||||
out.SetValue(std::move(intf));
|
out.SetValue(std::move(intf));
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
|
|
@ -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) {
|
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. */
|
/* Allocate a new node. */
|
||||||
std::unique_ptr<ProgramInfoNode> new_node(new ProgramInfoNode());
|
std::unique_ptr<ProgramInfoNode> new_node(new ProgramInfoNode());
|
||||||
R_UNLESS(new_node != nullptr, fs::ResultAllocationFailureInProgramRegistryManagerA());
|
R_UNLESS(new_node != nullptr, fs::ResultAllocationMemoryFailedInProgramRegistryManagerA());
|
||||||
|
|
||||||
/* Create a new program info. */
|
/* Create a new program info. */
|
||||||
{
|
{
|
||||||
/* Allocate the new info. */
|
/* Allocate the new info. */
|
||||||
auto new_info = fssystem::AllocateShared<ProgramInfo>(process_id, program_id, storage_id, data, data_size, desc, desc_size);
|
auto new_info = fssystem::AllocateShared<ProgramInfo>(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. */
|
/* Set the info in the node. */
|
||||||
new_node->program_info = std::move(new_info);
|
new_node->program_info = std::move(new_info);
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace ams::fssystem {
|
||||||
} else {
|
} else {
|
||||||
m_internal_free_lists.reset(new PageList[m_order_max + 1]);
|
m_internal_free_lists.reset(new PageList[m_order_max + 1]);
|
||||||
m_free_lists = m_internal_free_lists.get();
|
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. */
|
/* All but the last page region should go to the max order. */
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace ams::fssystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to have at least one entry buffer. */
|
/* 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. */
|
/* Set entries. */
|
||||||
m_entries = reinterpret_cast<Entry *>(m_external_entry_buffer != nullptr ? m_external_entry_buffer : m_internal_entry_buffer.get());
|
m_entries = reinterpret_cast<Entry *>(m_external_entry_buffer != nullptr ? m_external_entry_buffer : m_internal_entry_buffer.get());
|
||||||
|
|
|
@ -46,14 +46,14 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
Result AesCtrCounterExtendedStorage::CreateExternalDecryptor(std::unique_ptr<IDecryptor> *out, DecryptFunction func, s32 key_index) {
|
Result AesCtrCounterExtendedStorage::CreateExternalDecryptor(std::unique_ptr<IDecryptor> *out, DecryptFunction func, s32 key_index) {
|
||||||
std::unique_ptr<IDecryptor> decryptor = std::make_unique<ExternalDecryptor>(func, key_index);
|
std::unique_ptr<IDecryptor> decryptor = std::make_unique<ExternalDecryptor>(func, key_index);
|
||||||
R_UNLESS(decryptor != nullptr, fs::ResultAllocationFailureInAesCtrCounterExtendedStorageA());
|
R_UNLESS(decryptor != nullptr, fs::ResultAllocationMemoryFailedInAesCtrCounterExtendedStorageA());
|
||||||
*out = std::move(decryptor);
|
*out = std::move(decryptor);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result AesCtrCounterExtendedStorage::CreateSoftwareDecryptor(std::unique_ptr<IDecryptor> *out) {
|
Result AesCtrCounterExtendedStorage::CreateSoftwareDecryptor(std::unique_ptr<IDecryptor> *out) {
|
||||||
std::unique_ptr<IDecryptor> decryptor = std::make_unique<SoftwareDecryptor>();
|
std::unique_ptr<IDecryptor> decryptor = std::make_unique<SoftwareDecryptor>();
|
||||||
R_UNLESS(decryptor != nullptr, fs::ResultAllocationFailureInAesCtrCounterExtendedStorageA());
|
R_UNLESS(decryptor != nullptr, fs::ResultAllocationMemoryFailedInAesCtrCounterExtendedStorageA());
|
||||||
*out = std::move(decryptor);
|
*out = std::move(decryptor);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace ams::fssystem {
|
||||||
do {
|
do {
|
||||||
/* Do the bulk read. If we fail due to pooled buffer allocation failing, fall back to the normal read codepath. */
|
/* 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_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;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
/* Se successfully did a bulk read, so we're done. */
|
/* 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) {
|
if (start_offset < offset || offset + size < end_offset) {
|
||||||
/* Allocate a work buffer. */
|
/* Allocate a work buffer. */
|
||||||
std::unique_ptr<char[], fs::impl::Deleter> work = fs::impl::MakeUnique<char[]>(m_verification_block_size);
|
std::unique_ptr<char[], fs::impl::Deleter> work = fs::impl::MakeUnique<char[]>(m_verification_block_size);
|
||||||
R_UNLESS(work != nullptr, fs::ResultAllocationFailureInBlockCacheBufferedStorageB());
|
R_UNLESS(work != nullptr, fs::ResultAllocationMemoryFailedInBlockCacheBufferedStorageB());
|
||||||
|
|
||||||
/* Handle data before the aligned range. */
|
/* Handle data before the aligned range. */
|
||||||
if (start_offset < offset) {
|
if (start_offset < offset) {
|
||||||
|
@ -1005,7 +1005,7 @@ namespace ams::fssystem {
|
||||||
read_buffer = reinterpret_cast<char *>(range_head->first);
|
read_buffer = reinterpret_cast<char *>(range_head->first);
|
||||||
} else {
|
} else {
|
||||||
pooled_buffer.AllocateParticularlyLarge(buffer_size, 1);
|
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();
|
read_buffer = pooled_buffer.GetBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Allocate the caches. */
|
/* Allocate the caches. */
|
||||||
m_caches.reset(new Cache[buffer_count]);
|
m_caches.reset(new Cache[buffer_count]);
|
||||||
R_UNLESS(m_caches != nullptr, fs::ResultAllocationFailureInBufferedStorageA());
|
R_UNLESS(m_caches != nullptr, fs::ResultAllocationMemoryFailedInBufferedStorageA());
|
||||||
|
|
||||||
/* Initialize the caches. */
|
/* Initialize the caches. */
|
||||||
for (auto i = 0; i < buffer_count; i++) {
|
for (auto i = 0; i < buffer_count; i++) {
|
||||||
|
@ -793,7 +793,7 @@ namespace ams::fssystem {
|
||||||
do {
|
do {
|
||||||
/* Try to do a bulk read. */
|
/* Try to do a bulk read. */
|
||||||
R_TRY_CATCH(this->BulkRead(cur_offset, static_cast<u8 *>(buffer) + buf_offset, remaining_size, head_cache_needed, tail_cache_needed)) {
|
R_TRY_CATCH(this->BulkRead(cur_offset, static_cast<u8 *>(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, */
|
/* If the read fails due to insufficient pooled buffer size, */
|
||||||
/* then we want to fall back to the normal read path. */
|
/* then we want to fall back to the normal read path. */
|
||||||
break;
|
break;
|
||||||
|
@ -940,7 +940,7 @@ namespace ams::fssystem {
|
||||||
work_buffer = static_cast<char *>(buffer);
|
work_buffer = static_cast<char *>(buffer);
|
||||||
} else {
|
} else {
|
||||||
pooled_buffer.AllocateParticularlyLarge(static_cast<size_t>(aligned_size), 1);
|
pooled_buffer.AllocateParticularlyLarge(static_cast<size_t>(aligned_size), 1);
|
||||||
R_UNLESS(static_cast<s64>(pooled_buffer.GetSize()) >= aligned_size, fs::ResultAllocationFailurePooledBufferNotEnoughSize());
|
R_UNLESS(static_cast<s64>(pooled_buffer.GetSize()) >= aligned_size, fs::ResultAllocationPooledBufferNotEnoughSize());
|
||||||
work_buffer = pooled_buffer.GetBuffer();
|
work_buffer = pooled_buffer.GetBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Make DirectorySaveDataFile. */
|
/* Make DirectorySaveDataFile. */
|
||||||
std::unique_ptr<fs::fsa::IFile> file = std::make_unique<DirectorySaveDataFile>(std::move(base_file), this, mode);
|
std::unique_ptr<fs::fsa::IFile> file = std::make_unique<DirectorySaveDataFile>(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. */
|
/* Increment our open writable files, if the file is writable. */
|
||||||
if (mode & fs::OpenMode_Write) {
|
if (mode & fs::OpenMode_Write) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace ams::fssystem {
|
||||||
/* Set master hash. */
|
/* Set master hash. */
|
||||||
m_master_hash = master_hash;
|
m_master_hash = master_hash;
|
||||||
m_master_hash_storage = std::make_unique<fs::MemoryStorage>(std::addressof(m_master_hash), sizeof(Hash));
|
m_master_hash_storage = std::make_unique<fs::MemoryStorage>(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. */
|
/* Set the master hash storage. */
|
||||||
storage_info[0] = fs::SubStorage(m_master_hash_storage.get(), 0, sizeof(Hash));
|
storage_info[0] = fs::SubStorage(m_master_hash_storage.get(), 0, sizeof(Hash));
|
||||||
|
|
|
@ -283,7 +283,7 @@ namespace ams::fssystem {
|
||||||
/* Allocate a work buffer. */
|
/* Allocate a work buffer. */
|
||||||
const auto buf_size = static_cast<size_t>(std::min(sign_size, static_cast<s64>(1) << (m_upper_layer_verification_block_order + 2)));
|
const auto buf_size = static_cast<size_t>(std::min(sign_size, static_cast<s64>(1) << (m_upper_layer_verification_block_order + 2)));
|
||||||
std::unique_ptr<char[], fs::impl::Deleter> buf = fs::impl::MakeUnique<char[]>(buf_size);
|
std::unique_ptr<char[], fs::impl::Deleter> buf = fs::impl::MakeUnique<char[]>(buf_size);
|
||||||
R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInIntegrityVerificationStorageA());
|
R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedInIntegrityVerificationStorageA());
|
||||||
|
|
||||||
/* Clear the work buffer. */
|
/* Clear the work buffer. */
|
||||||
std::memset(buf.get(), 0, buf_size);
|
std::memset(buf.get(), 0, buf_size);
|
||||||
|
@ -315,7 +315,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Allocate a work buffer. */
|
/* Allocate a work buffer. */
|
||||||
std::unique_ptr<char[], fs::impl::Deleter> buf = fs::impl::MakeUnique<char[]>(sign_size);
|
std::unique_ptr<char[], fs::impl::Deleter> buf = fs::impl::MakeUnique<char[]>(sign_size);
|
||||||
R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInIntegrityVerificationStorageB());
|
R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedInIntegrityVerificationStorageB());
|
||||||
|
|
||||||
/* Read the existing signature. */
|
/* Read the existing signature. */
|
||||||
R_TRY(m_hash_storage.Read(sign_offset, buf.get(), sign_size));
|
R_TRY(m_hash_storage.Read(sign_offset, buf.get(), sign_size));
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace ams::fssystem {
|
||||||
for (auto it = list->begin(); it != list->end(); ++it) {
|
for (auto it = list->begin(); it != list->end(); ++it) {
|
||||||
if (it->Contains(key, key_size, key2)) {
|
if (it->Contains(key, key_size, key2)) {
|
||||||
std::unique_ptr accessor = std::make_unique<KeySlotCacheAccessor>(it->GetKeySlotIndex(), std::move(lk));
|
std::unique_ptr accessor = std::make_unique<KeySlotCacheAccessor>(it->GetKeySlotIndex(), std::move(lk));
|
||||||
R_UNLESS(accessor != nullptr, fs::ResultAllocationFailure());
|
R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailed());
|
||||||
|
|
||||||
*out = std::move(accessor);
|
*out = std::move(accessor);
|
||||||
|
|
||||||
|
|
|
@ -880,7 +880,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Allocate our native path buffer. */
|
/* Allocate our native path buffer. */
|
||||||
native_path = fs::impl::MakeUnique<NativeCharacterType[]>(native_len + 1);
|
native_path = fs::impl::MakeUnique<NativeCharacterType[]>(native_len + 1);
|
||||||
R_UNLESS(native_path != nullptr, fs::ResultAllocationFailureInMakeUnique());
|
R_UNLESS(native_path != nullptr, fs::ResultAllocationMemoryFailedMakeUnique());
|
||||||
|
|
||||||
/* Convert path. */
|
/* Convert path. */
|
||||||
const auto res = ::MultiByteToWideChar(CP_UTF8, 0, m_root_path.GetString(), -1, native_path.get(), native_len);
|
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. */
|
/* Tentatively assume other operating systems do the sane thing and use utf-8 strings. */
|
||||||
native_path = fs::impl::MakeUnique<NativeCharacterType[]>(native_len + 1);
|
native_path = fs::impl::MakeUnique<NativeCharacterType[]>(native_len + 1);
|
||||||
R_UNLESS(native_path != nullptr, fs::ResultAllocationFailureInMakeUnique());
|
R_UNLESS(native_path != nullptr, fs::ResultAllocationMemoryFailedMakeUnique());
|
||||||
|
|
||||||
/* Copy in path. */
|
/* Copy in path. */
|
||||||
std::memcpy(native_path.get(), m_root_path.GetString(), native_len + 1);
|
std::memcpy(native_path.get(), m_root_path.GetString(), native_len + 1);
|
||||||
|
@ -972,7 +972,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Allocate our native path buffer. */
|
/* Allocate our native path buffer. */
|
||||||
native_path = fs::impl::MakeUnique<NativeCharacterType[]>(native_len + min_len + 1);
|
native_path = fs::impl::MakeUnique<NativeCharacterType[]>(native_len + min_len + 1);
|
||||||
R_UNLESS(native_path != nullptr, fs::ResultAllocationFailureInMakeUnique());
|
R_UNLESS(native_path != nullptr, fs::ResultAllocationMemoryFailedMakeUnique());
|
||||||
|
|
||||||
/* Convert path. */
|
/* Convert path. */
|
||||||
const auto res = ::MultiByteToWideChar(CP_UTF8, 0, full_path.GetString(), -1, native_path.get(), native_len);
|
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. */
|
/* Allocate case sensitive buffer. */
|
||||||
auto case_sensitive_buffer_size = sizeof(NativeCharacterType) * (m_native_path_length + native_len + 1 + fs::EntryNameLengthMax);
|
auto case_sensitive_buffer_size = sizeof(NativeCharacterType) * (m_native_path_length + native_len + 1 + fs::EntryNameLengthMax);
|
||||||
NativePathBuffer case_sensitive_path_buffer = fs::impl::MakeUnique<NativeCharacterType[]>(case_sensitive_buffer_size / sizeof(NativeCharacterType));
|
NativePathBuffer case_sensitive_path_buffer = fs::impl::MakeUnique<NativeCharacterType[]>(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. */
|
/* Get root path. */
|
||||||
const NativeCharacterType *root_path = m_native_path_buffer.get() != nullptr ? m_native_path_buffer.get() : L"";
|
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. */
|
/* Tentatively assume other operating systems do the sane thing and use utf-8 strings. */
|
||||||
native_path = fs::impl::MakeUnique<NativeCharacterType[]>(native_len + min_len + 1);
|
native_path = fs::impl::MakeUnique<NativeCharacterType[]>(native_len + min_len + 1);
|
||||||
R_UNLESS(native_path != nullptr, fs::ResultAllocationFailureInMakeUnique());
|
R_UNLESS(native_path != nullptr, fs::ResultAllocationMemoryFailedMakeUnique());
|
||||||
|
|
||||||
/* Copy in path. */
|
/* Copy in path. */
|
||||||
std::memcpy(native_path.get(), full_path.GetString(), native_len + 1);
|
std::memcpy(native_path.get(), full_path.GetString(), native_len + 1);
|
||||||
|
@ -1075,7 +1075,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Allocate a new path buffer. */
|
/* Allocate a new path buffer. */
|
||||||
NativePathBuffer cur_path_buf = fs::impl::MakeUnique<NativeCharacterType[]>(path_len + MAX_PATH);
|
NativePathBuffer cur_path_buf = fs::impl::MakeUnique<NativeCharacterType[]>(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. */
|
/* Copy the path into the temporary buffer. */
|
||||||
::wcscpy(cur_path_buf.get(), path);
|
::wcscpy(cur_path_buf.get(), path);
|
||||||
|
@ -1143,7 +1143,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Allocate a temporary buffer. */
|
/* Allocate a temporary buffer. */
|
||||||
NativePathBuffer cur_path_buf = fs::impl::MakeUnique<NativeCharacterType[]>(path_len + PATH_MAX);
|
NativePathBuffer cur_path_buf = fs::impl::MakeUnique<NativeCharacterType[]>(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. */
|
/* Copy the path into the temporary buffer. */
|
||||||
std::memcpy(cur_path_buf.get(), path, path_len);
|
std::memcpy(cur_path_buf.get(), path, path_len);
|
||||||
|
@ -1561,7 +1561,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create a new local file. */
|
/* Create a new local file. */
|
||||||
auto file = std::make_unique<LocalFile>(file_handle, mode);
|
auto file = std::make_unique<LocalFile>(file_handle, mode);
|
||||||
R_UNLESS(file != nullptr, fs::ResultAllocationFailureInLocalFileSystemA());
|
R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInLocalFileSystemA());
|
||||||
|
|
||||||
/* Set the output file. */
|
/* Set the output file. */
|
||||||
*out_file = std::move(file);
|
*out_file = std::move(file);
|
||||||
|
@ -1629,7 +1629,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create a new local directory. */
|
/* Create a new local directory. */
|
||||||
auto dir = std::make_unique<LocalDirectory>(dir_handle, search_handle, mode, std::move(native_path));
|
auto dir = std::make_unique<LocalDirectory>(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. */
|
/* Set the output directory. */
|
||||||
*out_dir = std::move(dir);
|
*out_dir = std::move(dir);
|
||||||
|
|
|
@ -312,7 +312,7 @@ namespace ams::fssystem {
|
||||||
} else {
|
} else {
|
||||||
/* Otherwise, allocate a default splitter. */
|
/* Otherwise, allocate a default splitter. */
|
||||||
*out_splitter = fssystem::AllocateShared<DefaultAsynchronousAccessSplitter>();
|
*out_splitter = fssystem::AllocateShared<DefaultAsynchronousAccessSplitter>();
|
||||||
R_UNLESS(*out_splitter != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(*out_splitter != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
@ -430,7 +430,7 @@ namespace ams::fssystem {
|
||||||
} else {
|
} else {
|
||||||
/* Allocate a dummy memory storage as original storage. */
|
/* Allocate a dummy memory storage as original storage. */
|
||||||
original_indirectable_storage = fssystem::AllocateShared<fs::MemoryStorage>(nullptr, 0);
|
original_indirectable_storage = fssystem::AllocateShared<fs::MemoryStorage>(nullptr, 0);
|
||||||
R_UNLESS(original_indirectable_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(original_indirectable_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the indirect storage. */
|
/* Create the indirect storage. */
|
||||||
|
@ -517,7 +517,7 @@ namespace ams::fssystem {
|
||||||
Result NcaFileSystemDriver::CreateBodySubStorage(std::shared_ptr<fs::IStorage> *out, s64 offset, s64 size) {
|
Result NcaFileSystemDriver::CreateBodySubStorage(std::shared_ptr<fs::IStorage> *out, s64 offset, s64 size) {
|
||||||
/* Create the body storage. */
|
/* Create the body storage. */
|
||||||
auto body_storage = fssystem::AllocateShared<SharedNcaBodyStorage>(m_reader->GetSharedBodyStorage(), m_reader);
|
auto body_storage = fssystem::AllocateShared<SharedNcaBodyStorage>(m_reader->GetSharedBodyStorage(), m_reader);
|
||||||
R_UNLESS(body_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(body_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Get the body storage size. */
|
/* Get the body storage size. */
|
||||||
s64 body_size = 0;
|
s64 body_size = 0;
|
||||||
|
@ -528,7 +528,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create substorage. */
|
/* Create substorage. */
|
||||||
auto body_substorage = fssystem::AllocateShared<fs::SubStorage>(std::move(body_storage), offset, size);
|
auto body_substorage = fssystem::AllocateShared<fs::SubStorage>(std::move(body_storage), offset, size);
|
||||||
R_UNLESS(body_substorage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(body_substorage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Set the output storage. */
|
/* Set the output storage. */
|
||||||
*out = std::move(body_substorage);
|
*out = std::move(body_substorage);
|
||||||
|
@ -550,7 +550,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create buffered storage. */
|
/* Create buffered storage. */
|
||||||
auto buffered_storage = fssystem::AllocateShared<BufferedStorage>();
|
auto buffered_storage = fssystem::AllocateShared<BufferedStorage>();
|
||||||
R_UNLESS(buffered_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(buffered_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the buffered storage. */
|
/* Initialize the buffered storage. */
|
||||||
R_TRY(buffered_storage->Initialize(fs::SubStorage(std::move(base_storage), 0, base_size), m_buffer_manager, AesCtrStorageCacheBlockSize, AesCtrStorageCacheCount));
|
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<fs::IStorage> aes_ctr_storage;
|
std::shared_ptr<fs::IStorage> aes_ctr_storage;
|
||||||
if (m_reader->HasExternalDecryptionKey()) {
|
if (m_reader->HasExternalDecryptionKey()) {
|
||||||
aes_ctr_storage = fssystem::AllocateShared<AesCtrStorageExternal>(std::move(base_storage), m_reader->GetExternalDecryptionKey(), AesCtrStorageExternal::KeySize, iv, AesCtrStorageExternal::IvSize, m_reader->GetExternalDecryptAesCtrFunctionForExternalKey(), -1);
|
aes_ctr_storage = fssystem::AllocateShared<AesCtrStorageExternal>(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 {
|
} else {
|
||||||
/* Create software decryption storage. */
|
/* Create software decryption storage. */
|
||||||
auto sw_storage = fssystem::AllocateShared<AesCtrStorageBySharedPointer>(base_storage, m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesCtr), AesCtrStorageBySharedPointer::KeySize, iv, AesCtrStorageBySharedPointer::IvSize);
|
auto sw_storage = fssystem::AllocateShared<AesCtrStorageBySharedPointer>(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 we have a hardware key and should use it, make the hardware decryption storage. */
|
||||||
if (m_reader->HasInternalDecryptionKeyForAesHw() && !m_reader->IsSoftwareAesPrioritized()) {
|
if (m_reader->HasInternalDecryptionKeyForAesHw() && !m_reader->IsSoftwareAesPrioritized()) {
|
||||||
auto hw_storage = fssystem::AllocateShared<AesCtrStorageExternal>(base_storage, m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesCtrHw), AesCtrStorageExternal::KeySize, iv, AesCtrStorageExternal::IvSize, m_reader->GetExternalDecryptAesCtrFunction(), GetKeyTypeValue(m_reader->GetKeyIndex(), m_reader->GetKeyGeneration()));
|
auto hw_storage = fssystem::AllocateShared<AesCtrStorageExternal>(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. */
|
/* Create the selection storage. */
|
||||||
auto switch_storage = fssystem::AllocateShared<SwitchStorage<bool (*)()>>(std::move(hw_storage), std::move(sw_storage), IsUsingHwAesCtrForSpeedEmulation);
|
auto switch_storage = fssystem::AllocateShared<SwitchStorage<bool (*)()>>(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. */
|
/* Use the selection storage. */
|
||||||
aes_ctr_storage = std::move(switch_storage);
|
aes_ctr_storage = std::move(switch_storage);
|
||||||
|
@ -601,7 +601,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create alignment matching storage. */
|
/* Create alignment matching storage. */
|
||||||
auto aligned_storage = fssystem::AllocateShared<AlignmentMatchingStorage<NcaHeader::CtrBlockSize, 1>>(std::move(aes_ctr_storage));
|
auto aligned_storage = fssystem::AllocateShared<AlignmentMatchingStorage<NcaHeader::CtrBlockSize, 1>>(std::move(aes_ctr_storage));
|
||||||
R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Set the out storage. */
|
/* Set the out storage. */
|
||||||
*out = std::move(aligned_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 key1 = m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesXts1);
|
||||||
const auto * const key2 = m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesXts2);
|
const auto * const key2 = m_reader->GetDecryptionKey(NcaHeader::DecryptionKey_AesXts2);
|
||||||
auto xts_storage = fssystem::AllocateShared<AesXtsStorageBySharedPointer>(std::move(base_storage), key1, key2, AesXtsStorageBySharedPointer::KeySize, iv, AesXtsStorageBySharedPointer::IvSize, NcaHeader::XtsBlockSize);
|
auto xts_storage = fssystem::AllocateShared<AesXtsStorageBySharedPointer>(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. */
|
/* Create alignment matching storage. */
|
||||||
auto aligned_storage = fssystem::AllocateShared<AlignmentMatchingStorage<NcaHeader::XtsBlockSize, 1>>(std::move(xts_storage));
|
auto aligned_storage = fssystem::AllocateShared<AlignmentMatchingStorage<NcaHeader::XtsBlockSize, 1>>(std::move(xts_storage));
|
||||||
R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Set the out storage. */
|
/* Set the out storage. */
|
||||||
*out = std::move(aligned_storage);
|
*out = std::move(aligned_storage);
|
||||||
|
@ -648,7 +648,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create the encrypted storage. */
|
/* Create the encrypted storage. */
|
||||||
auto enc_storage = fssystem::AllocateShared<fs::SubStorage>(std::move(base_storage), meta_offset, meta_size);
|
auto enc_storage = fssystem::AllocateShared<fs::SubStorage>(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. */
|
/* Create the decrypted storage. */
|
||||||
std::shared_ptr<fs::IStorage> decrypted_storage;
|
std::shared_ptr<fs::IStorage> decrypted_storage;
|
||||||
|
@ -656,7 +656,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create meta storage. */
|
/* Create meta storage. */
|
||||||
auto meta_storage = fssystem::AllocateShared<BufferedStorage>();
|
auto meta_storage = fssystem::AllocateShared<BufferedStorage>();
|
||||||
R_UNLESS(meta_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(meta_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the meta storage. */
|
/* Initialize the meta storage. */
|
||||||
R_TRY(meta_storage->Initialize(fs::SubStorage(std::move(decrypted_storage), 0, meta_size), m_buffer_manager, SparseTableCacheBlockSize, SparseTableCacheCount));
|
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. */
|
/* Create the sparse storage. */
|
||||||
auto sparse_storage = fssystem::AllocateShared<fssystem::SparseStorage>();
|
auto sparse_storage = fssystem::AllocateShared<fssystem::SparseStorage>();
|
||||||
R_UNLESS(sparse_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(sparse_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Sanity check that we can be doing this. */
|
/* Sanity check that we can be doing this. */
|
||||||
AMS_ASSERT(header.entry_count != 0);
|
AMS_ASSERT(header.entry_count != 0);
|
||||||
|
@ -742,7 +742,7 @@ namespace ams::fssystem {
|
||||||
} else {
|
} else {
|
||||||
/* If there are no entries, there's nothing to actually do. */
|
/* If there are no entries, there's nothing to actually do. */
|
||||||
sparse_storage = fssystem::AllocateShared<fssystem::SparseStorage>();
|
sparse_storage = fssystem::AllocateShared<fssystem::SparseStorage>();
|
||||||
R_UNLESS(sparse_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(sparse_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
sparse_storage->Initialize(fs_size);
|
sparse_storage->Initialize(fs_size);
|
||||||
}
|
}
|
||||||
|
@ -782,7 +782,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create the encrypted storage. */
|
/* Create the encrypted storage. */
|
||||||
auto enc_storage = fssystem::AllocateShared<fs::SubStorage>(std::move(base_storage), meta_offset, meta_size);
|
auto enc_storage = fssystem::AllocateShared<fs::SubStorage>(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. */
|
/* Create the decrypted storage. */
|
||||||
std::shared_ptr<fs::IStorage> decrypted_storage;
|
std::shared_ptr<fs::IStorage> decrypted_storage;
|
||||||
|
@ -790,7 +790,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create meta storage. */
|
/* Create meta storage. */
|
||||||
auto meta_storage = fssystem::AllocateShared<BufferedStorage>();
|
auto meta_storage = fssystem::AllocateShared<BufferedStorage>();
|
||||||
R_UNLESS(meta_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(meta_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the meta storage. */
|
/* Initialize the meta storage. */
|
||||||
R_TRY(meta_storage->Initialize(fs::SubStorage(std::move(decrypted_storage), 0, meta_size), m_buffer_manager, AesCtrExTableCacheBlockSize, AesCtrExTableCacheCount));
|
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. */
|
/* Create an alignment-matching storage. */
|
||||||
using AlignedStorage = AlignmentMatchingStorage<NcaHeader::CtrBlockSize, 1>;
|
using AlignedStorage = AlignmentMatchingStorage<NcaHeader::CtrBlockSize, 1>;
|
||||||
auto aligned_storage = fssystem::AllocateShared<AlignedStorage>(std::move(meta_storage));
|
auto aligned_storage = fssystem::AllocateShared<AlignedStorage>(std::move(meta_storage));
|
||||||
R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Set the output. */
|
/* Set the output. */
|
||||||
*out = std::move(aligned_storage);
|
*out = std::move(aligned_storage);
|
||||||
|
@ -843,7 +843,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create the aes ctr ex storage. */
|
/* Create the aes ctr ex storage. */
|
||||||
auto impl_storage = fssystem::AllocateShared<AesCtrCounterExtendedStorage>();
|
auto impl_storage = fssystem::AllocateShared<AesCtrCounterExtendedStorage>();
|
||||||
R_UNLESS(impl_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(impl_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the aes ctr ex storage. */
|
/* 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)));
|
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. */
|
/* Make the software storage. */
|
||||||
auto sw_storage = fssystem::AllocateShared<AesCtrCounterExtendedStorage>();
|
auto sw_storage = fssystem::AllocateShared<AesCtrCounterExtendedStorage>();
|
||||||
R_UNLESS(sw_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(sw_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the software storage. */
|
/* 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)));
|
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. */
|
/* Create the hardware storage. */
|
||||||
auto hw_storage = fssystem::AllocateShared<AesCtrCounterExtendedStorage>();
|
auto hw_storage = fssystem::AllocateShared<AesCtrCounterExtendedStorage>();
|
||||||
R_UNLESS(hw_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(hw_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the hardware storage. */
|
/* 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)));
|
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. */
|
/* Create the selection storage. */
|
||||||
auto switch_storage = fssystem::AllocateShared<SwitchStorage<bool (*)()>>(std::move(hw_storage), std::move(sw_storage), IsUsingHwAesCtrForSpeedEmulation);
|
auto switch_storage = fssystem::AllocateShared<SwitchStorage<bool (*)()>>(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. */
|
/* Set the implementation storage. */
|
||||||
aes_ctr_ex_storage = std::move(switch_storage);
|
aes_ctr_ex_storage = std::move(switch_storage);
|
||||||
|
@ -900,7 +900,7 @@ namespace ams::fssystem {
|
||||||
/* Create an alignment-matching storage. */
|
/* Create an alignment-matching storage. */
|
||||||
using AlignedStorage = AlignmentMatchingStorage<NcaHeader::CtrBlockSize, 1>;
|
using AlignedStorage = AlignmentMatchingStorage<NcaHeader::CtrBlockSize, 1>;
|
||||||
auto aligned_storage = fssystem::AllocateShared<AlignedStorage>(std::move(aes_ctr_ex_storage));
|
auto aligned_storage = fssystem::AllocateShared<AlignedStorage>(std::move(aes_ctr_ex_storage));
|
||||||
R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(aligned_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Set the output. */
|
/* Set the output. */
|
||||||
*out = std::move(aligned_storage);
|
*out = std::move(aligned_storage);
|
||||||
|
@ -922,7 +922,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Allocate the meta storage. */
|
/* Allocate the meta storage. */
|
||||||
auto meta_storage = fssystem::AllocateShared<BufferedStorage>();
|
auto meta_storage = fssystem::AllocateShared<BufferedStorage>();
|
||||||
R_UNLESS(meta_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(meta_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the meta storage. */
|
/* 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));
|
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. */
|
/* Create the indirect data storage. */
|
||||||
auto indirect_data_storage = fssystem::AllocateShared<BufferedStorage>();
|
auto indirect_data_storage = fssystem::AllocateShared<BufferedStorage>();
|
||||||
R_UNLESS(indirect_data_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(indirect_data_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the indirect data storage. */
|
/* Initialize the indirect data storage. */
|
||||||
R_TRY(indirect_data_storage->Initialize(fs::SubStorage(base_storage, 0, indirect_data_size), m_buffer_manager, IndirectDataCacheBlockSize, IndirectDataCacheCount));
|
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. */
|
/* Create the indirect storage. */
|
||||||
auto indirect_storage = fssystem::AllocateShared<IndirectStorage>();
|
auto indirect_storage = fssystem::AllocateShared<IndirectStorage>();
|
||||||
R_UNLESS(indirect_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(indirect_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the indirect storage. */
|
/* 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));
|
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. */
|
/* Make a buffer holder storage. */
|
||||||
auto buffer_hold_storage = fssystem::AllocateShared<MemoryResourceBufferHoldStorage>(std::move(base_storage), m_allocator, total_buffer_size);
|
auto buffer_hold_storage = fssystem::AllocateShared<MemoryResourceBufferHoldStorage>(std::move(base_storage), m_allocator, total_buffer_size);
|
||||||
R_UNLESS(buffer_hold_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(buffer_hold_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
R_UNLESS(buffer_hold_storage->IsValid(), fs::ResultAllocationFailureInNcaFileSystemDriverI());
|
R_UNLESS(buffer_hold_storage->IsValid(), fs::ResultAllocationMemoryFailedInNcaFileSystemDriverI());
|
||||||
|
|
||||||
/* Get storage size. */
|
/* Get storage size. */
|
||||||
s64 base_size;
|
s64 base_size;
|
||||||
|
@ -1030,7 +1030,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Make the verification storage. */
|
/* Make the verification storage. */
|
||||||
auto verification_storage = fssystem::AllocateShared<VerificationStorage>();
|
auto verification_storage = fssystem::AllocateShared<VerificationStorage>();
|
||||||
R_UNLESS(verification_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(verification_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Make layer storages. */
|
/* Make layer storages. */
|
||||||
fs::SubStorage layer_storages[VerificationStorage::LayerCount] = {
|
fs::SubStorage layer_storages[VerificationStorage::LayerCount] = {
|
||||||
|
@ -1044,11 +1044,11 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Make the cache storage. */
|
/* Make the cache storage. */
|
||||||
auto cache_storage = fssystem::AllocateShared<CacheStorage>(std::move(verification_storage), hash_data.hash_block_size, static_cast<char *>(buffer_hold_storage->GetBuffer()) + hash_buffer_size, cache_buffer_size, CacheBlockCount);
|
auto cache_storage = fssystem::AllocateShared<CacheStorage>(std::move(verification_storage), hash_data.hash_block_size, static_cast<char *>(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. */
|
/* Make the aligned storage. */
|
||||||
auto aligned_storage = fssystem::AllocateShared<AlignedStorage>(std::move(cache_storage), hash_data.hash_block_size);
|
auto aligned_storage = fssystem::AllocateShared<AlignedStorage>(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. */
|
/* Set the output. */
|
||||||
*out = std::move(aligned_storage);
|
*out = std::move(aligned_storage);
|
||||||
|
@ -1091,7 +1091,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Make the integrity romfs storage. */
|
/* Make the integrity romfs storage. */
|
||||||
auto integrity_storage = fssystem::AllocateShared<fssystem::IntegrityRomFsStorage>();
|
auto integrity_storage = fssystem::AllocateShared<fssystem::IntegrityRomFsStorage>();
|
||||||
R_UNLESS(integrity_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(integrity_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the integrity storage. */
|
/* 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()));
|
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 we should, set the output meta storage. */
|
||||||
if (out_meta != nullptr) {
|
if (out_meta != nullptr) {
|
||||||
auto meta_storage = fssystem::AllocateShared<fs::SubStorage>(base_storage, table_offset, table_size);
|
auto meta_storage = fssystem::AllocateShared<fs::SubStorage>(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);
|
*out_meta = std::move(meta_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate the compressed storage. */
|
/* Allocate the compressed storage. */
|
||||||
auto compressed_storage = fssystem::AllocateShared<fssystem::CompressedStorage>();
|
auto compressed_storage = fssystem::AllocateShared<fssystem::CompressedStorage>();
|
||||||
R_UNLESS(compressed_storage != nullptr, fs::ResultAllocationFailureInAllocateShared());
|
R_UNLESS(compressed_storage != nullptr, fs::ResultAllocationMemoryFailedAllocateShared());
|
||||||
|
|
||||||
/* Initialize the compressed storage. */
|
/* 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));
|
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));
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace ams::fssystem {
|
||||||
/* Create the header storage. */
|
/* Create the header storage. */
|
||||||
const u8 header_iv[AesXtsStorageForNcaHeader::IvSize] = {};
|
const u8 header_iv[AesXtsStorageForNcaHeader::IvSize] = {};
|
||||||
std::unique_ptr<fs::IStorage> work_header_storage = std::make_unique<AesXtsStorageForNcaHeader>(base_storage, header_decryption_keys[0], header_decryption_keys[1], AesXtsStorageForNcaHeader::KeySize, header_iv, AesXtsStorageForNcaHeader::IvSize, NcaHeader::XtsBlockSize);
|
std::unique_ptr<fs::IStorage> work_header_storage = std::make_unique<AesXtsStorageForNcaHeader>(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. */
|
/* Read the header. */
|
||||||
R_TRY(work_header_storage->Read(0, std::addressof(m_header), sizeof(m_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;
|
s64 base_storage_size;
|
||||||
R_TRY(base_storage->GetSize(std::addressof(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));
|
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. */
|
/* Set encryption type as plaintext. */
|
||||||
m_header_encryption_type = NcaHeader::EncryptionType::None;
|
m_header_encryption_type = NcaHeader::EncryptionType::None;
|
||||||
|
|
|
@ -286,7 +286,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Allocate meta data. */
|
/* Allocate meta data. */
|
||||||
m_unique_meta_data = std::make_unique<MetaType>();
|
m_unique_meta_data = std::make_unique<MetaType>();
|
||||||
R_UNLESS(m_unique_meta_data != nullptr, fs::ResultAllocationFailureInPartitionFileSystemA());
|
R_UNLESS(m_unique_meta_data != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemA());
|
||||||
|
|
||||||
/* Initialize meta data. */
|
/* Initialize meta data. */
|
||||||
R_TRY(m_unique_meta_data->Initialize(base_storage, allocator));
|
R_TRY(m_unique_meta_data->Initialize(base_storage, allocator));
|
||||||
|
@ -382,7 +382,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create and output the file directory. */
|
/* Create and output the file directory. */
|
||||||
std::unique_ptr file = std::make_unique<PartitionFile>(this, m_meta_data->GetEntry(entry_index), mode);
|
std::unique_ptr file = std::make_unique<PartitionFile>(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);
|
*out_file = std::move(file);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Create and output the partition directory. */
|
/* Create and output the partition directory. */
|
||||||
std::unique_ptr directory = std::make_unique<PartitionDirectory>(this, mode);
|
std::unique_ptr directory = std::make_unique<PartitionDirectory>(this, mode);
|
||||||
R_UNLESS(directory != nullptr, fs::ResultAllocationFailureInPartitionFileSystemC());
|
R_UNLESS(directory != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemC());
|
||||||
*out_dir = std::move(directory);
|
*out_dir = std::move(directory);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace ams::fssystem {
|
||||||
this->DeallocateBuffer();
|
this->DeallocateBuffer();
|
||||||
m_allocator = allocator;
|
m_allocator = allocator;
|
||||||
m_buffer = static_cast<char *>(m_allocator->Allocate(m_meta_data_size));
|
m_buffer = static_cast<char *>(m_allocator->Allocate(m_meta_data_size));
|
||||||
R_UNLESS(m_buffer != nullptr, fs::ResultAllocationFailureInPartitionFileSystemMetaA());
|
R_UNLESS(m_buffer != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemMetaA());
|
||||||
|
|
||||||
/* Perform regular initialization. */
|
/* Perform regular initialization. */
|
||||||
return this->Initialize(storage, m_buffer, m_meta_data_size);
|
return this->Initialize(storage, m_buffer, m_meta_data_size);
|
||||||
|
@ -175,7 +175,7 @@ namespace ams::fssystem {
|
||||||
/* Set allocator and allocate buffer. */
|
/* Set allocator and allocate buffer. */
|
||||||
m_allocator = allocator;
|
m_allocator = allocator;
|
||||||
m_buffer = static_cast<char *>(m_allocator->Allocate(m_meta_data_size));
|
m_buffer = static_cast<char *>(m_allocator->Allocate(m_meta_data_size));
|
||||||
R_UNLESS(m_buffer != nullptr, fs::ResultAllocationFailureInPartitionFileSystemMetaB());
|
R_UNLESS(m_buffer != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemMetaB());
|
||||||
|
|
||||||
/* Read metadata. */
|
/* Read metadata. */
|
||||||
R_TRY(base_storage->Read(0, m_buffer, m_meta_data_size));
|
R_TRY(base_storage->Read(0, m_buffer, m_meta_data_size));
|
||||||
|
|
|
@ -233,7 +233,7 @@ namespace ams::fssystem {
|
||||||
/* Set up our storages. */
|
/* Set up our storages. */
|
||||||
if (use_cache) {
|
if (use_cache) {
|
||||||
const size_t needed_size = CalculateRequiredWorkingMemorySize(header);
|
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<u8 *>(work);
|
u8 *buf = static_cast<u8 *>(work);
|
||||||
auto dir_bucket_buf = buf; buf += header.directory_bucket_size;
|
auto dir_bucket_buf = buf; buf += header.directory_bucket_size;
|
||||||
|
@ -258,10 +258,10 @@ namespace ams::fssystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure we allocated storages successfully. */
|
/* Ensure we allocated storages successfully. */
|
||||||
R_UNLESS(m_dir_bucket_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB());
|
R_UNLESS(m_dir_bucket_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB());
|
||||||
R_UNLESS(m_dir_entry_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB());
|
R_UNLESS(m_dir_entry_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB());
|
||||||
R_UNLESS(m_file_bucket_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB());
|
R_UNLESS(m_file_bucket_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB());
|
||||||
R_UNLESS(m_file_entry_storage != nullptr, fs::ResultAllocationFailureInRomFsFileSystemB());
|
R_UNLESS(m_file_entry_storage != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB());
|
||||||
|
|
||||||
/* Initialize the rom table. */
|
/* Initialize the rom table. */
|
||||||
R_TRY(m_rom_file_table.Initialize(fs::SubStorage(m_dir_bucket_storage.get(), 0, static_cast<u32>(header.directory_bucket_size)),
|
R_TRY(m_rom_file_table.Initialize(fs::SubStorage(m_dir_bucket_storage.get(), 0, static_cast<u32>(header.directory_bucket_size)),
|
||||||
|
@ -369,7 +369,7 @@ namespace ams::fssystem {
|
||||||
R_TRY(this->GetFileInfo(std::addressof(file_info), path));
|
R_TRY(this->GetFileInfo(std::addressof(file_info), path));
|
||||||
|
|
||||||
auto file = std::make_unique<RomFsFile>(this, m_entry_size + file_info.offset.Get(), m_entry_size + file_info.offset.Get() + file_info.size.Get());
|
auto file = std::make_unique<RomFsFile>(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);
|
*out_file = std::move(file);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
@ -388,7 +388,7 @@ namespace ams::fssystem {
|
||||||
}, AMS_CURRENT_FUNCTION_NAME));
|
}, AMS_CURRENT_FUNCTION_NAME));
|
||||||
|
|
||||||
auto dir = std::make_unique<RomFsDirectory>(this, find, mode);
|
auto dir = std::make_unique<RomFsDirectory>(this, find, mode);
|
||||||
R_UNLESS(dir != nullptr, fs::ResultAllocationFailureInRomFsFileSystemD());
|
R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemD());
|
||||||
|
|
||||||
*out_dir = std::move(dir);
|
*out_dir = std::move(dir);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
|
|
@ -55,77 +55,163 @@ namespace ams::fs {
|
||||||
|
|
||||||
R_DEFINE_ERROR_RESULT(SystemPartitionNotReady, 3100);
|
R_DEFINE_ERROR_RESULT(SystemPartitionNotReady, 3100);
|
||||||
|
|
||||||
R_DEFINE_ERROR_RANGE(AllocationFailure, 3200, 3499);
|
R_DEFINE_ERROR_RANGE(AllocationMemoryFailed, 3200, 3499);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemAccessorA, 3211);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemA, 3201);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemAccessorB, 3212);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemC, 3203);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInApplicationA, 3213);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemD, 3204);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInBisA, 3215);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemE, 3205);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInBisB, 3216);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemF, 3206);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInBisC, 3217);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemH, 3208);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInCodeA, 3218);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemAccessorA, 3211);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInContentA, 3219);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemAccessorB, 3212);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInContentStorageA, 3220);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInApplicationA, 3213);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInContentStorageB, 3221);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBcatSaveDataA, 3214);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInDataA, 3222);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBisA, 3215);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInDataB, 3223);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBisB, 3216);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInDeviceSaveDataA, 3224);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBisC, 3217);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInGameCardA, 3225);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInCodeA, 3218);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInGameCardB, 3226);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInContentA, 3219);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInGameCardC, 3227);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInContentStorageA, 3220);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInGameCardD, 3228);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInContentStorageB, 3221);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInHostA, 3229);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDataA, 3222);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInHostB, 3230);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDataB, 3223);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInHostC, 3231);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDeviceSaveDataA, 3224);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInImageDirectoryA, 3232);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardA, 3225);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInSdCardA, 3244);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardB, 3226);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInSdCardB, 3245);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardC, 3227);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInSystemSaveDataA, 3246);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardD, 3228);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemA, 3247);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInHostA, 3229);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemB, 3248);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInHostB, 3230);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemC, 3249);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInHostC, 3231);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemProxyCoreImplD, 3256);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInImageDirectoryA, 3232);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemProxyCoreImplE, 3257);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInLogoA, 3233);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInProgramRegistryManagerA, 3258);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomA, 3234);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInLocalFileSystemCreatorA, 3279);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomB, 3235);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemCreatorA, 3280);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomC, 3236);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInRomFileSystemCreatorA, 3281);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomD, 3237);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInStorageOnNcaCreatorA, 3288);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomE, 3238);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInStorageOnNcaCreatorB, 3289);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomF, 3239);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInSubDirectoryFileSystemCreatorA, 3290);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataManagementA, 3242);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemBuddyHeapA, 3294);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataThumbnailA, 3243);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemBufferManagerA, 3295);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdCardA, 3244);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInBlockCacheBufferedStorageA, 3296);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdCardB, 3245);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInBlockCacheBufferedStorageB, 3297);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSystemSaveDataA, 3246);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInIntegrityVerificationStorageA, 3304);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFsFileSystemA, 3247);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInIntegrityVerificationStorageB, 3305);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFsFileSystemB, 3248);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInDirectorySaveDataFileSystem, 3321);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInRomFsFileSystemC, 3249);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInLocalFileSystemA, 3322);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGuidPartitionTableA, 3251);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInLocalFileSystemB, 3323);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInDeviceDetectionEventManagerA, 3252);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInNcaFileSystemDriverI, 3341);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSaveDataFileSystemServiceImplA, 3253);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemA, 3347);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFileSystemProxyCoreImplB, 3254);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemB, 3348);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdCardProxyFileSystemCreatorA, 3255);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemC, 3349);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInNcaFileSystemServiceImplA, 3256);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemMetaA, 3350);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInNcaFileSystemServiceImplB, 3257);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInPartitionFileSystemMetaB, 3351);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInProgramRegistryManagerA, 3258);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemD, 3352);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInSdmmcStorageServiceA, 3259);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInSubDirectoryFileSystem, 3355);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBuiltInStorageCreatorA, 3260);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInNcaReaderA, 3363);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBuiltInStorageCreatorB, 3261);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInRegisterA, 3365);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInBuiltInStorageCreatorC, 3262);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInRegisterB, 3366);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedFatFileSystemWithBufferA, 3264);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInPathNormalizer, 3367);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemCreatorA, 3265);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInDbmRomKeyValueStorage, 3375);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInFatFileSystemCreatorB, 3266);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInRomFsFileSystemE, 3377);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorA, 3267);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInReadOnlyFileSystemA, 3386);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorB, 3268);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInAesCtrCounterExtendedStorageA, 3399);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorC, 3269);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInAesCtrCounterExtendedStorageB, 3400);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorD, 3270);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemInterfaceAdapter, 3407);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorE, 3271);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInBufferedStorageA, 3411);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardFileSystemCreatorF, 3272);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInIntegrityRomFsStorageA, 3412);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerA, 3273);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInNew, 3420);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerB, 3274);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInFileSystemProxyImplA, 3421);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerC, 3275);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInMakeUnique, 3422);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerD, 3276);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailureInAllocateShared, 3423);
|
R_DEFINE_ERROR_RESULT(AllocationMemoryFailedInGameCardManagerE, 3277);
|
||||||
R_DEFINE_ERROR_RESULT(AllocationFailurePooledBufferNotEnoughSize, 3424);
|
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(Internal, 3000, 7999);
|
||||||
R_DEFINE_ERROR_RANGE(MmcAccessFailed, 3500, 3999);
|
R_DEFINE_ERROR_RANGE(MmcAccessFailed, 3500, 3999);
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace ams::mitm::sysupdater {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_shared<ams::fs::RemoteFileSystem>(fs);
|
auto fsa = std::make_shared<ams::fs::RemoteFileSystem>(fs);
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSdCardA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSdCardA());
|
||||||
|
|
||||||
/* Set the output fs. */
|
/* Set the output fs. */
|
||||||
*out = std::move(fsa);
|
*out = std::move(fsa);
|
||||||
|
@ -83,7 +83,7 @@ namespace ams::mitm::sysupdater {
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_shared<ams::fs::RemoteFileSystem>(fs);
|
auto fsa = std::make_shared<ams::fs::RemoteFileSystem>(fs);
|
||||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInContentStorageA());
|
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInContentStorageA());
|
||||||
|
|
||||||
/* Set the output fs. */
|
/* Set the output fs. */
|
||||||
*out = std::move(fsa);
|
*out = std::move(fsa);
|
||||||
|
@ -123,7 +123,7 @@ namespace ams::mitm::sysupdater {
|
||||||
|
|
||||||
/* Open the file storage. */
|
/* Open the file storage. */
|
||||||
std::shared_ptr<ams::fs::FileStorageBasedFileSystem> file_storage = fssystem::AllocateShared<ams::fs::FileStorageBasedFileSystem>();
|
std::shared_ptr<ams::fs::FileStorageBasedFileSystem> file_storage = fssystem::AllocateShared<ams::fs::FileStorageBasedFileSystem>();
|
||||||
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));
|
R_TRY(file_storage->Initialize(std::move(base_fs), nsp_path, ams::fs::OpenMode_Read));
|
||||||
|
|
||||||
/* Create a partition fs. */
|
/* Create a partition fs. */
|
||||||
|
@ -138,7 +138,7 @@ namespace ams::mitm::sysupdater {
|
||||||
Result ParseNca(const char **path, std::shared_ptr<fssystem::NcaReader> *out, std::shared_ptr<ams::fs::fsa::IFileSystem> base_fs) {
|
Result ParseNca(const char **path, std::shared_ptr<fssystem::NcaReader> *out, std::shared_ptr<ams::fs::fsa::IFileSystem> base_fs) {
|
||||||
/* Open the file storage. */
|
/* Open the file storage. */
|
||||||
std::shared_ptr<ams::fs::FileStorageBasedFileSystem> file_storage = fssystem::AllocateShared<ams::fs::FileStorageBasedFileSystem>();
|
std::shared_ptr<ams::fs::FileStorageBasedFileSystem> file_storage = fssystem::AllocateShared<ams::fs::FileStorageBasedFileSystem>();
|
||||||
R_UNLESS(file_storage != nullptr, fs::ResultAllocationFailureInFileSystemProxyCoreImplE());
|
R_UNLESS(file_storage != nullptr, fs::ResultAllocationMemoryFailedInFileSystemProxyCoreImplE());
|
||||||
|
|
||||||
/* Get the nca path. */
|
/* Get the nca path. */
|
||||||
ams::fs::Path nca_path;
|
ams::fs::Path nca_path;
|
||||||
|
@ -245,7 +245,7 @@ namespace ams::mitm::sysupdater {
|
||||||
|
|
||||||
/* Create a holder for the fs. */
|
/* Create a holder for the fs. */
|
||||||
std::unique_ptr unique_fs = std::make_unique<ams::fs::SharedFileSystemHolder>(std::move(fs));
|
std::unique_ptr unique_fs = std::make_unique<ams::fs::SharedFileSystemHolder>(std::move(fs));
|
||||||
R_UNLESS(unique_fs != nullptr, fs::ResultAllocationFailureInNew());
|
R_UNLESS(unique_fs != nullptr, fs::ResultAllocationMemoryFailedNew());
|
||||||
|
|
||||||
/* Register the fs. */
|
/* Register the fs. */
|
||||||
return ams::fs::fsa::Register(mount_name, std::move(unique_fs));
|
return ams::fs::fsa::Register(mount_name, std::move(unique_fs));
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace ams::mitm::sysupdater {
|
||||||
|
|
||||||
data_buffer_size /= 2;
|
data_buffer_size /= 2;
|
||||||
} while (data_buffer_size >= 16_KB);
|
} 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); };
|
ON_SCOPE_EXIT { std::free(data_buffer); };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue