mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-04 16:53:48 -04:00
ams: globally prefer R_RETURN to return for ams::Result
This commit is contained in:
parent
dd78ede99f
commit
bbf22b4c60
325 changed files with 1955 additions and 1993 deletions
|
@ -74,7 +74,7 @@ namespace ams::fs {
|
|||
.dir = InvalidPosition,
|
||||
.file = InvalidPosition,
|
||||
};
|
||||
return m_dir_table.Add(std::addressof(root_pos), root_key, root_entry);
|
||||
R_RETURN(m_dir_table.Add(std::addressof(root_pos), root_key, root_entry));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::CreateDirectory(RomDirectoryId *out, const RomPathChar *path, const DirectoryInfo &info) {
|
||||
|
@ -213,7 +213,7 @@ namespace ams::fs {
|
|||
EntryKey key = {};
|
||||
R_TRY(this->FindDirectoryRecursive(std::addressof(key), std::addressof(parent_entry), path));
|
||||
|
||||
return this->GetDirectoryInformation(out, key);
|
||||
R_RETURN(this->GetDirectoryInformation(out, key));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetDirectoryInformation(DirectoryInfo *out, RomDirectoryId id) {
|
||||
|
@ -235,7 +235,7 @@ namespace ams::fs {
|
|||
EntryKey key = {};
|
||||
R_TRY(this->FindFileRecursive(std::addressof(key), std::addressof(parent_entry), path));
|
||||
|
||||
return this->OpenFile(out, key);
|
||||
R_RETURN(this->OpenFile(out, key));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::OpenFile(FileInfo *out, RomFileId id) {
|
||||
|
@ -256,7 +256,7 @@ namespace ams::fs {
|
|||
EntryKey key = {};
|
||||
R_TRY(this->FindDirectoryRecursive(std::addressof(key), std::addressof(parent_entry), path));
|
||||
|
||||
return this->FindOpen(out, key);
|
||||
R_RETURN(this->FindOpen(out, key));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::FindOpen(FindPosition *out, RomDirectoryId id) {
|
||||
|
@ -442,7 +442,7 @@ namespace ams::fs {
|
|||
AMS_ASSERT(out_dir_entry != nullptr);
|
||||
AMS_ASSERT(path != nullptr);
|
||||
|
||||
return this->FindPathRecursive(out_key, out_dir_entry, true, path);
|
||||
R_RETURN(this->FindPathRecursive(out_key, out_dir_entry, true, path));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::FindFileRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, const RomPathChar *path) {
|
||||
|
@ -450,7 +450,7 @@ namespace ams::fs {
|
|||
AMS_ASSERT(out_dir_entry != nullptr);
|
||||
AMS_ASSERT(path != nullptr);
|
||||
|
||||
return this->FindPathRecursive(out_key, out_dir_entry, false, path);
|
||||
R_RETURN(this->FindPathRecursive(out_key, out_dir_entry, false, path));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::CheckSameEntryExists(const EntryKey &key, Result if_exists) {
|
||||
|
@ -461,7 +461,7 @@ namespace ams::fs {
|
|||
const Result get_res = m_dir_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
if (!fs::ResultDbmKeyNotFound::Includes(get_res)) {
|
||||
R_TRY(get_res);
|
||||
return if_exists;
|
||||
R_RETURN(if_exists);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ namespace ams::fs {
|
|||
const Result get_res = m_file_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
if (!fs::ResultDbmKeyNotFound::Includes(get_res)) {
|
||||
R_TRY(get_res);
|
||||
return if_exists;
|
||||
R_RETURN(if_exists);
|
||||
}
|
||||
}
|
||||
R_SUCCEED();
|
||||
|
@ -491,7 +491,7 @@ namespace ams::fs {
|
|||
const Result file_res = m_file_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
R_UNLESS(R_FAILED(file_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(file_res), fs::ResultDbmDirectoryNotFound());
|
||||
return file_res;
|
||||
R_RETURN(file_res);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetDirectoryEntry(RomDirectoryEntry *out_entry, RomDirectoryId id) {
|
||||
|
@ -507,7 +507,7 @@ namespace ams::fs {
|
|||
const Result file_res = m_file_table.GetByPosition(std::addressof(key), std::addressof(entry), pos);
|
||||
R_UNLESS(R_FAILED(file_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(file_res), fs::ResultDbmDirectoryNotFound());
|
||||
return file_res;
|
||||
R_RETURN(file_res);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetFileEntry(Position *out_pos, RomFileEntry *out_entry, const EntryKey &key) {
|
||||
|
@ -523,7 +523,7 @@ namespace ams::fs {
|
|||
const Result dir_res = m_dir_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
R_UNLESS(R_FAILED(dir_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(dir_res), fs::ResultDbmFileNotFound());
|
||||
return dir_res;
|
||||
R_RETURN(dir_res);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetFileEntry(RomFileEntry *out_entry, RomFileId id) {
|
||||
|
@ -539,7 +539,7 @@ namespace ams::fs {
|
|||
const Result dir_res = m_dir_table.GetByPosition(std::addressof(key), std::addressof(entry), pos);
|
||||
R_UNLESS(R_FAILED(dir_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(dir_res), fs::ResultDbmFileNotFound());
|
||||
return dir_res;
|
||||
R_RETURN(dir_res);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetDirectoryInformation(DirectoryInfo *out, const EntryKey &key) {
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace ams::fs {
|
|||
|
||||
Result FileStorage::UpdateSize() {
|
||||
R_SUCCEED_IF(m_size != InvalidSize);
|
||||
return m_base_file->GetSize(std::addressof(m_size));
|
||||
R_RETURN(m_base_file->GetSize(std::addressof(m_size)));
|
||||
}
|
||||
|
||||
Result FileStorage::Read(s64 offset, void *buffer, size_t size) {
|
||||
|
@ -36,7 +36,7 @@ namespace ams::fs {
|
|||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
|
||||
size_t read_size;
|
||||
return m_base_file->Read(std::addressof(read_size), offset, buffer, size);
|
||||
R_RETURN(m_base_file->Read(std::addressof(read_size), offset, buffer, size));
|
||||
}
|
||||
|
||||
Result FileStorage::Write(s64 offset, const void *buffer, size_t size) {
|
||||
|
@ -52,11 +52,11 @@ namespace ams::fs {
|
|||
/* Ensure our access is valid. */
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
|
||||
return m_base_file->Write(offset, buffer, size, fs::WriteOption());
|
||||
R_RETURN(m_base_file->Write(offset, buffer, size, fs::WriteOption()));
|
||||
}
|
||||
|
||||
Result FileStorage::Flush() {
|
||||
return m_base_file->Flush();
|
||||
R_RETURN(m_base_file->Flush());
|
||||
}
|
||||
|
||||
Result FileStorage::GetSize(s64 *out_size) {
|
||||
|
@ -67,7 +67,7 @@ namespace ams::fs {
|
|||
|
||||
Result FileStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
return m_base_file->SetSize(size);
|
||||
R_RETURN(m_base_file->SetSize(size));
|
||||
}
|
||||
|
||||
Result FileStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
|
@ -105,7 +105,7 @@ namespace ams::fs {
|
|||
|
||||
Result FileHandleStorage::UpdateSize() {
|
||||
R_SUCCEED_IF(m_size != InvalidSize);
|
||||
return GetFileSize(std::addressof(m_size), m_handle);
|
||||
R_RETURN(GetFileSize(std::addressof(m_size), m_handle));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Read(s64 offset, void *buffer, size_t size) {
|
||||
|
@ -124,7 +124,7 @@ namespace ams::fs {
|
|||
/* Ensure our access is valid. */
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
|
||||
return ReadFile(m_handle, offset, buffer, size, fs::ReadOption());
|
||||
R_RETURN(ReadFile(m_handle, offset, buffer, size, fs::ReadOption()));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Write(s64 offset, const void *buffer, size_t size) {
|
||||
|
@ -143,11 +143,11 @@ namespace ams::fs {
|
|||
/* Ensure our access is valid. */
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
|
||||
return WriteFile(m_handle, offset, buffer, size, fs::WriteOption());
|
||||
R_RETURN(WriteFile(m_handle, offset, buffer, size, fs::WriteOption()));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Flush() {
|
||||
return FlushFile(m_handle);
|
||||
R_RETURN(FlushFile(m_handle));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::GetSize(s64 *out_size) {
|
||||
|
@ -158,7 +158,7 @@ namespace ams::fs {
|
|||
|
||||
Result FileHandleStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
return SetFileSize(m_handle, size);
|
||||
R_RETURN(SetFileSize(m_handle, size));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
|
@ -170,7 +170,7 @@ namespace ams::fs {
|
|||
R_UNLESS(dst != nullptr, fs::ResultNullptrArgument());
|
||||
R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize());
|
||||
|
||||
return QueryRange(static_cast<QueryRangeInfo *>(dst), m_handle, offset, size);
|
||||
R_RETURN(QueryRange(static_cast<QueryRangeInfo *>(dst), m_handle, offset, size));
|
||||
default:
|
||||
R_THROW(fs::ResultUnsupportedOperateRangeForFileHandleStorage());
|
||||
}
|
||||
|
|
|
@ -103,11 +103,11 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result MountBis(BisPartitionId id, const char *root_path) {
|
||||
return impl::MountBisImpl(GetBisMountName(id), id, root_path);
|
||||
R_RETURN(impl::MountBisImpl(GetBisMountName(id), id, root_path));
|
||||
}
|
||||
|
||||
Result MountBis(const char *name, BisPartitionId id) {
|
||||
return impl::MountBisImpl(name, id, nullptr);
|
||||
R_RETURN(impl::MountBisImpl(name, id, nullptr));
|
||||
}
|
||||
|
||||
void SetBisRootForHost(BisPartitionId id, const char *root_path) {
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result MountContentStorage(ContentStorageId id) {
|
||||
return MountContentStorage(GetContentStorageMountName(id), id);
|
||||
R_RETURN(MountContentStorage(GetContentStorageMountName(id), id));
|
||||
}
|
||||
|
||||
Result MountContentStorage(const char *name, ContentStorageId id) {
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace ams::fs::impl {
|
|||
R_UNLESS(fs != nullptr, fs::ResultAllocationMemoryFailedInDataB());
|
||||
R_TRY(fs->Initialize(std::move(storage), cache_buffer, cache_size, use_cache));
|
||||
|
||||
return fsa::Register(name, std::move(fs), nullptr, use_data_cache, use_path_cache, false);
|
||||
R_RETURN(fsa::Register(name, std::move(fs), nullptr, use_data_cache, use_path_cache, false));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace ams::fs::impl {
|
|||
/* Validate the mount name. */
|
||||
AMS_FS_R_TRY(impl::CheckMountName(name));
|
||||
|
||||
return MountDataImpl(name, data_id, storage_id, nullptr, 0, false, false, false);
|
||||
R_RETURN(MountDataImpl(name, data_id, storage_id, nullptr, 0, false, false, false));
|
||||
}
|
||||
|
||||
Result MountData(const char *name, ncm::DataId data_id, ncm::StorageId storage_id, void *cache_buffer, size_t cache_size) {
|
||||
|
@ -82,7 +82,7 @@ namespace ams::fs::impl {
|
|||
|
||||
AMS_FS_R_UNLESS(cache_buffer != nullptr, fs::ResultNullptrArgument());
|
||||
|
||||
return MountDataImpl(name, data_id, storage_id, cache_buffer, cache_size, true, false, false);
|
||||
R_RETURN(MountDataImpl(name, data_id, storage_id, cache_buffer, cache_size, true, false, false));
|
||||
}
|
||||
|
||||
Result MountData(const char *name, ncm::DataId data_id, ncm::StorageId storage_id, void *cache_buffer, size_t cache_size, bool use_data_cache, bool use_path_cache) {
|
||||
|
@ -91,7 +91,7 @@ namespace ams::fs::impl {
|
|||
|
||||
AMS_FS_R_UNLESS(cache_buffer != nullptr, fs::ResultNullptrArgument());
|
||||
|
||||
return MountDataImpl(name, data_id, storage_id, cache_buffer, cache_size, true, use_data_cache, use_path_cache);
|
||||
R_RETURN(MountDataImpl(name, data_id, storage_id, cache_buffer, cache_size, true, use_data_cache, use_path_cache));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace ams::fs {
|
|||
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInDeviceSaveDataA());
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(fsa));
|
||||
R_RETURN(fsa::Register(name, std::move(fsa)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace ams::fs {
|
|||
R_TRY(accessor->SetUpPath(std::addressof(sub_fs_path), sub_path));
|
||||
|
||||
/* Use the system implementation. */
|
||||
return fssystem::EnsureDirectory(accessor->GetRawFileSystemUnsafe(), sub_fs_path);
|
||||
R_RETURN(fssystem::EnsureDirectory(accessor->GetRawFileSystemUnsafe(), sub_fs_path));
|
||||
}
|
||||
|
||||
Result EnsureParentDirectory(const char *path) {
|
||||
|
@ -47,7 +47,7 @@ namespace ams::fs {
|
|||
R_TRY(sub_fs_path.RemoveChild());
|
||||
|
||||
/* Use the system implementation. */
|
||||
return fssystem::EnsureDirectory(accessor->GetRawFileSystemUnsafe(), sub_fs_path);
|
||||
R_RETURN(fssystem::EnsureDirectory(accessor->GetRawFileSystemUnsafe(), sub_fs_path));
|
||||
}
|
||||
|
||||
Result HasFile(bool *out, const char *path) {
|
||||
|
@ -60,7 +60,7 @@ namespace ams::fs {
|
|||
fs::Path sub_fs_path;
|
||||
R_TRY(accessor->SetUpPath(std::addressof(sub_fs_path), sub_path));
|
||||
|
||||
return fssystem::HasFile(out, accessor->GetRawFileSystemUnsafe(), sub_fs_path);
|
||||
R_RETURN(fssystem::HasFile(out, accessor->GetRawFileSystemUnsafe(), sub_fs_path));
|
||||
}
|
||||
|
||||
Result HasDirectory(bool *out, const char *path) {
|
||||
|
@ -73,7 +73,7 @@ namespace ams::fs {
|
|||
fs::Path sub_fs_path;
|
||||
R_TRY(accessor->SetUpPath(std::addressof(sub_fs_path), sub_path));
|
||||
|
||||
return fssystem::HasDirectory(out, accessor->GetRawFileSystemUnsafe(), sub_fs_path);
|
||||
R_RETURN(fssystem::HasDirectory(out, accessor->GetRawFileSystemUnsafe(), sub_fs_path));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace ams::fs {
|
|||
Result ConvertFatFileSystemCorruptedResult(Result res) {
|
||||
AMS_ASSERT(fs::ResultFatFileSystemCorrupted::Includes(res));
|
||||
|
||||
return res;
|
||||
R_RETURN(res);
|
||||
}
|
||||
|
||||
Result ConvertHostFileSystemCorruptedResult(Result res) {
|
||||
|
@ -149,14 +149,14 @@ namespace ams::fs {
|
|||
AMS_ASSERT(offset >= 0);
|
||||
AMS_ASSERT(buffer != nullptr || size == 0);
|
||||
|
||||
return ConvertRomFsResult(storage->Read(offset, buffer, size));
|
||||
R_RETURN(ConvertRomFsResult(storage->Read(offset, buffer, size)));
|
||||
}
|
||||
|
||||
Result ReadFileHeader(IStorage *storage, RomFileSystemInformation *out) {
|
||||
AMS_ASSERT(storage != nullptr);
|
||||
AMS_ASSERT(out != nullptr);
|
||||
|
||||
return ReadFile(storage, 0, out, sizeof(*out));
|
||||
R_RETURN(ReadFile(storage, 0, out, sizeof(*out)));
|
||||
}
|
||||
|
||||
constexpr size_t CalculateRequiredWorkingMemorySize(const RomFileSystemInformation &header) {
|
||||
|
@ -185,7 +185,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result ConvertResult(Result res) const {
|
||||
return ConvertRomFsResult(res);
|
||||
R_RETURN(ConvertRomFsResult(res));
|
||||
}
|
||||
|
||||
s64 GetOffset() const {
|
||||
|
@ -242,7 +242,7 @@ namespace ams::fs {
|
|||
operate_size = this->GetSize() - offset;
|
||||
}
|
||||
|
||||
return this->GetStorage()->OperateRange(dst, dst_size, op_id, m_start + offset, operate_size, src, src_size);
|
||||
R_RETURN(this->GetStorage()->OperateRange(dst, dst_size, op_id, m_start + offset, operate_size, src, src_size));
|
||||
}
|
||||
default:
|
||||
R_THROW(fs::ResultUnsupportedOperateRangeForRomFsFile());
|
||||
|
@ -267,12 +267,12 @@ namespace ams::fs {
|
|||
virtual ~RomFsDirectory() override { /* ... */ }
|
||||
public:
|
||||
virtual Result DoRead(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) override {
|
||||
return this->ReadInternal(out_count, std::addressof(m_current_find), out_entries, max_entries);
|
||||
R_RETURN(this->ReadInternal(out_count, std::addressof(m_current_find), out_entries, max_entries));
|
||||
}
|
||||
|
||||
virtual Result DoGetEntryCount(s64 *out) override {
|
||||
FindPosition find = m_first_find;
|
||||
return this->ReadInternal(out, std::addressof(find), nullptr, 0);
|
||||
R_RETURN(this->ReadInternal(out, std::addressof(find), nullptr, 0));
|
||||
}
|
||||
private:
|
||||
Result ReadInternal(s64 *out_count, FindPosition *find, DirectoryEntry *out_entries, s64 max_entries) {
|
||||
|
@ -416,7 +416,7 @@ namespace ams::fs {
|
|||
|
||||
Result RomFsFileSystem::Initialize(std::unique_ptr<IStorage>&& base, void *work, size_t work_size, bool use_cache) {
|
||||
m_unique_storage = std::move(base);
|
||||
return this->Initialize(m_unique_storage.get(), work, work_size, use_cache);
|
||||
R_RETURN(this->Initialize(m_unique_storage.get(), work, work_size, use_cache));
|
||||
}
|
||||
|
||||
Result RomFsFileSystem::GetFileInfo(RomFileTable::FileInfo *out, const char *path) {
|
||||
|
|
|
@ -68,23 +68,23 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result CreateSystemSaveData(SystemSaveDataId save_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(SaveDataSpaceId::System, save_id, InvalidUserId, 0, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(SaveDataSpaceId::System, save_id, InvalidUserId, 0, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SystemSaveDataId save_id, u64 owner_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(SaveDataSpaceId::System, save_id, InvalidUserId, owner_id, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(SaveDataSpaceId::System, save_id, InvalidUserId, owner_id, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SaveDataSpaceId space_id, SystemSaveDataId save_id, u64 owner_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(space_id, save_id, InvalidUserId, owner_id, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(space_id, save_id, InvalidUserId, owner_id, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SystemSaveDataId save_id, UserId user_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(SaveDataSpaceId::System, save_id, user_id, 0, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(SaveDataSpaceId::System, save_id, user_id, 0, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SystemSaveDataId save_id, UserId user_id, u64 owner_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(SaveDataSpaceId::System, save_id, user_id, owner_id, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(SaveDataSpaceId::System, save_id, user_id, owner_id, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result DeleteSaveData(SaveDataId id) {
|
||||
|
@ -139,7 +139,7 @@ namespace ams::fs {
|
|||
SaveDataExtraData extra_data;
|
||||
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), space_id, id));
|
||||
extra_data.flags = flags;
|
||||
return impl::WriteSaveDataFileSystemExtraData(space_id, id, extra_data);
|
||||
R_RETURN(impl::WriteSaveDataFileSystemExtraData(space_id, id, extra_data));
|
||||
}
|
||||
|
||||
Result GetSaveDataAvailableSize(s64 *out, SaveDataId id) {
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace ams::fs {
|
|||
R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInSdCardA());
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(fsa), std::move(generator));
|
||||
R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator)));
|
||||
}
|
||||
|
||||
Result MountSdCardErrorReportDirectoryForAtmosphere(const char *name) {
|
||||
|
@ -92,7 +92,7 @@ namespace ams::fs {
|
|||
R_TRY(subdir_fs->Initialize(fs_path));
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(subdir_fs));
|
||||
R_RETURN(fsa::Register(name, std::move(subdir_fs)));
|
||||
}
|
||||
|
||||
Result OpenSdCardDetectionEventNotifier(std::unique_ptr<IEventNotifier> *out) {
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
namespace ams::fs {
|
||||
|
||||
Result MountSystemSaveData(const char *name, SystemSaveDataId id) {
|
||||
return MountSystemSaveData(name, id, InvalidUserId);
|
||||
R_RETURN(MountSystemSaveData(name, id, InvalidUserId));
|
||||
}
|
||||
|
||||
Result MountSystemSaveData(const char *name, SaveDataSpaceId space_id, SystemSaveDataId id) {
|
||||
return MountSystemSaveData(name, space_id, id, InvalidUserId);
|
||||
R_RETURN(MountSystemSaveData(name, space_id, id, InvalidUserId));
|
||||
}
|
||||
|
||||
Result MountSystemSaveData(const char *name, SystemSaveDataId id, UserId user_id) {
|
||||
return MountSystemSaveData(name, SaveDataSpaceId::System, id, user_id);
|
||||
R_RETURN(MountSystemSaveData(name, SaveDataSpaceId::System, id, user_id));
|
||||
}
|
||||
|
||||
Result MountSystemSaveData(const char *name, SaveDataSpaceId space_id, SystemSaveDataId id, UserId user_id) {
|
||||
|
@ -50,7 +50,7 @@ namespace ams::fs {
|
|||
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSystemSaveDataA());
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(fsa));
|
||||
R_RETURN(fsa::Register(name, std::move(fsa)));
|
||||
};
|
||||
|
||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_SYSTEM_MOUNT(mount_impl(), name, AMS_FS_IMPL_ACCESS_LOG_FORMAT_MOUNT_SYSTEM_SAVE_DATA(name, space_id, id, user_id)));
|
||||
|
|
|
@ -29,11 +29,11 @@ namespace ams::fs::impl {
|
|||
}
|
||||
|
||||
Result DirectoryAccessor::Read(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) {
|
||||
return m_impl->Read(out_count, out_entries, max_entries);
|
||||
R_RETURN(m_impl->Read(out_count, out_entries, max_entries));
|
||||
}
|
||||
|
||||
Result DirectoryAccessor::GetEntryCount(s64 *out) {
|
||||
return m_impl->GetEntryCount(out);
|
||||
R_RETURN(m_impl->GetEntryCount(out));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace ams::fs::impl {
|
|||
}
|
||||
|
||||
Result FileAccessor::ReadWithoutCacheAccessLog(size_t *out, s64 offset, void *buf, size_t size, const ReadOption &option) {
|
||||
return m_impl->Read(out, offset, buf, size, option);
|
||||
R_RETURN(m_impl->Read(out, offset, buf, size, option));
|
||||
}
|
||||
|
||||
Result FileAccessor::Read(size_t *out, s64 offset, void *buf, size_t size, const ReadOption &option) {
|
||||
|
@ -62,9 +62,9 @@ namespace ams::fs::impl {
|
|||
|
||||
if (use_path_cache && use_data_cache && false) {
|
||||
/* TODO */
|
||||
return this->ReadWithCacheAccessLog(out, offset, buf, size, option, use_path_cache, use_data_cache);
|
||||
R_RETURN(this->ReadWithCacheAccessLog(out, offset, buf, size, option, use_path_cache, use_data_cache));
|
||||
} else {
|
||||
return AMS_FS_IMPL_ACCESS_LOG_WITH_NAME(this->ReadWithoutCacheAccessLog(out, offset, buf, size, option), handle, "ReadFile", AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_FILE(out, offset, size));
|
||||
R_RETURN(AMS_FS_IMPL_ACCESS_LOG_WITH_NAME(this->ReadWithoutCacheAccessLog(out, offset, buf, size, option), handle, "ReadFile", AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_FILE(out, offset, size)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,11 +117,11 @@ namespace ams::fs::impl {
|
|||
/* Fail after a write fails. */
|
||||
R_TRY(m_write_result);
|
||||
|
||||
return m_impl->GetSize(out);
|
||||
R_RETURN(m_impl->GetSize(out));
|
||||
}
|
||||
|
||||
Result FileAccessor::OperateRange(void *dst, size_t dst_size, OperationId operation, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
return m_impl->OperateRange(dst, dst_size, operation, offset, size, src, src_size);
|
||||
R_RETURN(m_impl->OperateRange(dst, dst_size, operation, offset, size, src, src_size));
|
||||
}
|
||||
|
||||
}
|
|
@ -61,7 +61,7 @@ namespace ams::fs::impl {
|
|||
if (!fs::ResultNotEnoughFreeSpace::Includes(r)) {
|
||||
m_write_result = r;
|
||||
}
|
||||
return r;
|
||||
R_RETURN(r);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace ams::fs::impl {
|
|||
MountName mount_name;
|
||||
R_TRY(GetMountNameAndSubPath(std::addressof(mount_name), out_sub_path, path));
|
||||
|
||||
return impl::Find(out_accessor, mount_name.str);
|
||||
R_RETURN(impl::Find(out_accessor, mount_name.str));
|
||||
}
|
||||
|
||||
Result Unmount(const char *name) {
|
||||
|
|
|
@ -23,14 +23,14 @@ namespace ams::fs::fsa {
|
|||
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs));
|
||||
R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterA());
|
||||
|
||||
return impl::Register(std::move(accessor));
|
||||
R_RETURN(impl::Register(std::move(accessor)));
|
||||
}
|
||||
|
||||
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));
|
||||
R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterB());
|
||||
|
||||
return impl::Register(std::move(accessor));
|
||||
R_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) {
|
||||
|
@ -41,7 +41,7 @@ namespace ams::fs::fsa {
|
|||
accessor->SetPathBasedFileDataCacheAttachable(use_path_cache);
|
||||
accessor->SetMultiCommitSupported(support_multi_commit);
|
||||
|
||||
return impl::Register(std::move(accessor));
|
||||
R_RETURN(impl::Register(std::move(accessor)));
|
||||
}
|
||||
|
||||
void Unregister(const char *name) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
namespace ams::fs {
|
||||
|
||||
Result CreateFile(const char *path, s64 size) {
|
||||
return CreateFile(path, size, 0);
|
||||
R_RETURN(CreateFile(path, size, 0));
|
||||
}
|
||||
|
||||
Result CreateFile(const char* path, s64 size, int option) {
|
||||
|
@ -220,11 +220,11 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result Commit(const char *mount_name) {
|
||||
return CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME);
|
||||
R_RETURN(CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME));
|
||||
}
|
||||
|
||||
Result CommitSaveData(const char *mount_name) {
|
||||
return CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME);
|
||||
R_RETURN(CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ namespace ams::fs::impl {
|
|||
}
|
||||
|
||||
Result Register(std::unique_ptr<FileSystemAccessor> &&fs) {
|
||||
return g_mount_table.Mount(std::move(fs));
|
||||
R_RETURN(g_mount_table.Mount(std::move(fs)));
|
||||
}
|
||||
|
||||
Result Find(FileSystemAccessor **out, const char *name) {
|
||||
return g_mount_table.Find(out, name);
|
||||
R_RETURN(g_mount_table.Find(out, name));
|
||||
}
|
||||
|
||||
void Unregister(const char *name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue