ams: use R_SUCCEED, R_THROW globally

This commit is contained in:
Michael Scire
2022-03-26 00:14:36 -07:00
parent e5b1739f65
commit dd78ede99f
370 changed files with 2107 additions and 2107 deletions

View File

@@ -42,7 +42,7 @@ namespace ams::fs {
R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size)));
R_TRY(FileEntryMapTable::Format(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size)));
return ResultSuccess();
R_SUCCEED();
}
HierarchicalRomFileTable::HierarchicalRomFileTable() { /* ... */ }
@@ -56,7 +56,7 @@ namespace ams::fs {
R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size)));
R_TRY(m_file_table.Initialize(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size), file_entry));
return ResultSuccess();
R_SUCCEED();
}
void HierarchicalRomFileTable::Finalize() {
@@ -123,7 +123,7 @@ namespace ams::fs {
}
}
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::CreateFile(RomFileId *out, const RomPathChar *path, const FileInfo &info) {
@@ -170,7 +170,7 @@ namespace ams::fs {
}
}
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::ConvertPathToDirectoryId(RomDirectoryId *out, const RomPathChar *path) {
@@ -186,7 +186,7 @@ namespace ams::fs {
R_TRY(this->GetDirectoryEntry(std::addressof(pos), std::addressof(entry), key));
*out = PositionToDirectoryId(pos);
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::ConvertPathToFileId(RomFileId *out, const RomPathChar *path) {
@@ -202,7 +202,7 @@ namespace ams::fs {
R_TRY(this->GetFileEntry(std::addressof(pos), std::addressof(entry), key));
*out = PositionToFileId(pos);
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::GetDirectoryInformation(DirectoryInfo *out, const RomPathChar *path) {
@@ -224,7 +224,7 @@ namespace ams::fs {
AMS_UNUSED(out);
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::OpenFile(FileInfo *out, const RomPathChar *path) {
@@ -245,7 +245,7 @@ namespace ams::fs {
R_TRY(this->GetFileEntry(std::addressof(entry), id));
*out = entry.info;
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::FindOpen(FindPosition *out, const RomPathChar *path) {
@@ -271,7 +271,7 @@ namespace ams::fs {
out->next_dir = entry.dir;
out->next_file = entry.file;
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::FindNextDirectory(RomPathChar *out, FindPosition *find, size_t length) {
@@ -291,7 +291,7 @@ namespace ams::fs {
out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator;
find->next_dir = entry.next;
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::FindNextFile(RomPathChar *out, FindPosition *find, size_t length) {
@@ -311,7 +311,7 @@ namespace ams::fs {
out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator;
find->next_file = entry.next;
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::QueryRomFileSystemSize(s64 *out_dir_entry_size, s64 *out_file_entry_size) {
@@ -320,7 +320,7 @@ namespace ams::fs {
*out_dir_entry_size = m_dir_table.GetTotalEntrySize();
*out_file_entry_size = m_file_table.GetTotalEntrySize();
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::GetGrandParent(Position *out_pos, EntryKey *out_dir_key, RomDirectoryEntry *out_dir_entry, Position pos, RomPathTool::RomEntryName name, const RomPathChar *path) {
@@ -338,7 +338,7 @@ namespace ams::fs {
R_TRY(this->GetDirectoryEntry(out_pos, out_dir_entry, *out_dir_key));
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::FindParentDirectoryRecursive(Position *out_pos, EntryKey *out_dir_key, RomDirectoryEntry *out_dir_entry, RomPathTool::PathParser *parser, const RomPathChar *path) {
@@ -382,7 +382,7 @@ namespace ams::fs {
*out_pos = parent_pos;
*out_dir_key = dir_key;
*out_dir_entry = dir_entry;
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::FindPathRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, bool is_dir, const RomPathChar *path) {
@@ -434,7 +434,7 @@ namespace ams::fs {
R_TRY(parser.GetAsFileName(std::addressof(out_key->name)));
}
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::FindDirectoryRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, const RomPathChar *path) {
@@ -475,7 +475,7 @@ namespace ams::fs {
return if_exists;
}
}
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::GetDirectoryEntry(Position *out_pos, RomDirectoryEntry *out_entry, const EntryKey &key) {
@@ -551,7 +551,7 @@ namespace ams::fs {
AMS_UNUSED(out);
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::OpenFile(FileInfo *out, const EntryKey &key) {
@@ -562,7 +562,7 @@ namespace ams::fs {
R_TRY(this->GetFileEntry(std::addressof(pos), std::addressof(entry), key));
*out = entry.info;
return ResultSuccess();
R_SUCCEED();
}
Result HierarchicalRomFileTable::FindOpen(FindPosition *out, const EntryKey &key) {
@@ -578,7 +578,7 @@ namespace ams::fs {
out->next_dir = entry.dir;
out->next_file = entry.file;
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -32,7 +32,7 @@ namespace ams::fs::RomPathTool {
/* ... */
}
return ResultSuccess();
R_SUCCEED();
}
void PathParser::Finalize() {
@@ -97,7 +97,7 @@ namespace ams::fs::RomPathTool {
}
}
return ResultSuccess();
R_SUCCEED();
}
Result PathParser::GetAsDirectoryName(RomEntryName *out) const {
@@ -111,7 +111,7 @@ namespace ams::fs::RomPathTool {
out->length = len;
out->path = m_prev_path_start;
return ResultSuccess();
R_SUCCEED();
}
Result PathParser::GetAsFileName(RomEntryName *out) const {
@@ -125,7 +125,7 @@ namespace ams::fs::RomPathTool {
out->length = len;
out->path = m_prev_path_start;
return ResultSuccess();
R_SUCCEED();
}
Result GetParentDirectoryName(RomEntryName *out, const RomEntryName &cur, const RomPathChar *p) {
@@ -186,7 +186,7 @@ namespace ams::fs::RomPathTool {
out->length = end - start + 1;
}
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -62,7 +62,7 @@ namespace ams::fs {
Result FileStorage::GetSize(s64 *out_size) {
R_TRY(this->UpdateSize());
*out_size = m_size;
return ResultSuccess();
R_SUCCEED();
}
Result FileStorage::SetSize(s64 size) {
@@ -100,7 +100,7 @@ namespace ams::fs {
this->SetFile(std::move(base_file));
m_base_file_system = std::move(base_file_system);
return ResultSuccess();
R_SUCCEED();
}
Result FileHandleStorage::UpdateSize() {
@@ -153,7 +153,7 @@ namespace ams::fs {
Result FileHandleStorage::GetSize(s64 *out_size) {
R_TRY(this->UpdateSize());
*out_size = m_size;
return ResultSuccess();
R_SUCCEED();
}
Result FileHandleStorage::SetSize(s64 size) {
@@ -172,7 +172,7 @@ namespace ams::fs {
return QueryRange(static_cast<QueryRangeInfo *>(dst), m_handle, offset, size);
default:
return fs::ResultUnsupportedOperateRangeForFileHandleStorage();
R_THROW(fs::ResultUnsupportedOperateRangeForFileHandleStorage());
}
}

View File

@@ -40,7 +40,7 @@ namespace ams::fs {
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
AMS_UNUSED(size);
return ResultSuccess();
R_SUCCEED();
}
};

View File

@@ -38,7 +38,7 @@ namespace ams::fs {
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
AMS_UNUSED(size);
return ResultSuccess();
R_SUCCEED();
}
};

View File

@@ -39,7 +39,7 @@ namespace ams::fs::impl {
R_UNLESS(storage != nullptr, fs::ResultAllocationMemoryFailedInDataA());
*out = std::move(storage);
return ResultSuccess();
R_SUCCEED();
}
Result MountDataImpl(const char *name, ncm::DataId data_id, ncm::StorageId storage_id, void *cache_buffer, size_t cache_size, bool use_cache, bool use_data_cache, bool use_path_cache) {
@@ -66,7 +66,7 @@ namespace ams::fs::impl {
constexpr size_t MinimumCacheSize = 32;
*out = std::max(size, MinimumCacheSize);
return ResultSuccess();
R_SUCCEED();
}
Result MountData(const char *name, ncm::DataId data_id, ncm::StorageId storage_id) {

View File

@@ -48,7 +48,7 @@ namespace ams::fs {
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
AMS_UNUSED(size);
return ResultSuccess();
R_SUCCEED();
}
};

View File

@@ -48,7 +48,7 @@ namespace ams::fs {
/* Set allocators. */
g_allocate_func = allocator;
g_deallocate_func = deallocator;
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -64,7 +64,7 @@ namespace ams::fs {
/* Set output. */
*out = priority_raw;
return ResultSuccess();
R_SUCCEED();
}
Result GetPriorityImpl(fs::Priority *out, os::ThreadType *thread) {
@@ -77,7 +77,7 @@ namespace ams::fs {
/* Set output. */
*out = ConvertPriorityRawToPriority(priority_raw);
return ResultSuccess();
R_SUCCEED();
}
Result SetPriorityRawImpl(os::ThreadType *thread, fs::PriorityRaw priority_raw) {
@@ -91,7 +91,7 @@ namespace ams::fs {
/* Update the priority. */
UpdateTlsIoPriority(thread, tls_io);
return ResultSuccess();
R_SUCCEED();
}
Result SetPriorityImpl(os::ThreadType *thread, fs::Priority priority) {
@@ -105,7 +105,7 @@ namespace ams::fs {
/* Update the priority. */
UpdateTlsIoPriority(thread, tls_io);
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -43,7 +43,7 @@ namespace ams::fs {
} R_END_TRY_CATCH;
AMS_ASSERT(false);
return fs::ResultNcaCorrupted();
R_THROW(fs::ResultNcaCorrupted());
}
Result ConvertIntegrityVerificationStorageCorruptedResult(Result res) {
@@ -60,7 +60,7 @@ namespace ams::fs {
} R_END_TRY_CATCH;
AMS_ASSERT(false);
return fs::ResultIntegrityVerificationStorageCorrupted();
R_THROW(fs::ResultIntegrityVerificationStorageCorrupted());
}
Result ConvertBuiltInStorageCorruptedResult(Result res) {
@@ -72,7 +72,7 @@ namespace ams::fs {
} R_END_TRY_CATCH;
AMS_ASSERT(false);
return fs::ResultBuiltInStorageCorrupted();
R_THROW(fs::ResultBuiltInStorageCorrupted());
}
Result ConvertPartitionFileSystemCorruptedResult(Result res) {
@@ -89,7 +89,7 @@ namespace ams::fs {
} R_END_TRY_CATCH;
AMS_ASSERT(false);
return fs::ResultPartitionFileSystemCorrupted();
R_THROW(fs::ResultPartitionFileSystemCorrupted());
}
Result ConvertFatFileSystemCorruptedResult(Result res) {
@@ -110,7 +110,7 @@ namespace ams::fs {
} R_END_TRY_CATCH;
AMS_ASSERT(false);
return fs::ResultHostFileSystemCorrupted();
R_THROW(fs::ResultHostFileSystemCorrupted());
}
Result ConvertDatabaseCorruptedResult(Result res) {
@@ -123,7 +123,7 @@ namespace ams::fs {
} R_END_TRY_CATCH;
AMS_ASSERT(false);
return fs::ResultDatabaseCorrupted();
R_THROW(fs::ResultDatabaseCorrupted());
}
Result ConvertRomFsResult(Result res) {
@@ -141,7 +141,7 @@ namespace ams::fs {
R_CONVERT(fs::ResultIncompatiblePath, fs::ResultPathNotFound())
} R_END_TRY_CATCH;
return ResultSuccess();
R_SUCCEED();
}
Result ReadFile(IStorage *storage, s64 offset, void *buffer, size_t size) {
@@ -181,7 +181,7 @@ namespace ams::fs {
AMS_ASSERT(buf != nullptr || size == 0);
AMS_UNUSED(buf);
return ResultSuccess();
R_SUCCEED();
}
Result ConvertResult(Result res) const {
@@ -207,26 +207,26 @@ namespace ams::fs {
R_TRY(this->ConvertResult(this->GetStorage()->Read(offset + m_start, buffer, size)));
*out = read_size;
return ResultSuccess();
R_SUCCEED();
}
virtual Result DoGetSize(s64 *out) override {
*out = this->GetSize();
return ResultSuccess();
R_SUCCEED();
}
virtual Result DoFlush() override {
return ResultSuccess();
R_SUCCEED();
}
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override {
AMS_UNUSED(offset, buffer, size, option);
return fs::ResultUnsupportedWriteForRomFsFile();
R_THROW(fs::ResultUnsupportedWriteForRomFsFile());
}
virtual Result DoSetSize(s64 size) override {
AMS_UNUSED(size);
return fs::ResultUnsupportedWriteForRomFsFile();
R_THROW(fs::ResultUnsupportedWriteForRomFsFile());
}
virtual Result DoOperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
@@ -245,7 +245,7 @@ namespace ams::fs {
return this->GetStorage()->OperateRange(dst, dst_size, op_id, m_start + offset, operate_size, src, src_size);
}
default:
return fs::ResultUnsupportedOperateRangeForRomFsFile();
R_THROW(fs::ResultUnsupportedOperateRangeForRomFsFile());
}
}
public:
@@ -330,7 +330,7 @@ namespace ams::fs {
}
*out_count = i;
return ResultSuccess();
R_SUCCEED();
}
public:
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override {
@@ -354,7 +354,7 @@ namespace ams::fs {
R_TRY(ReadFileHeader(storage, std::addressof(header)));
*out = CalculateRequiredWorkingMemorySize(header);
return ResultSuccess();
R_SUCCEED();
}
Result RomFsFileSystem::Initialize(IStorage *base, void *work, size_t work_size, bool use_cache) {
@@ -411,7 +411,7 @@ namespace ams::fs {
/* Set members. */
m_entry_size = header.body_offset;
m_base_storage = base;
return ResultSuccess();
R_SUCCEED();
}
Result RomFsFileSystem::Initialize(std::unique_ptr<IStorage>&& base, void *work, size_t work_size, bool use_cache) {
@@ -424,7 +424,7 @@ namespace ams::fs {
R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound());
R_CONVERT(fs::ResultDbmInvalidOperation, fs::ResultPathNotFound());
} R_END_TRY_CATCH;
return ResultSuccess();
R_SUCCEED();
}
IStorage *RomFsFileSystem::GetBaseStorage() {
@@ -442,42 +442,42 @@ namespace ams::fs {
RomFileTable::FileInfo info;
R_TRY(this->GetFileInfo(std::addressof(info), path));
*out = m_entry_size + info.offset.Get();
return ResultSuccess();
R_SUCCEED();
}
Result RomFsFileSystem::DoCreateFile(const fs::Path &path, s64 size, int flags) {
AMS_UNUSED(path, size, flags);
return fs::ResultUnsupportedWriteForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
}
Result RomFsFileSystem::DoDeleteFile(const fs::Path &path) {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
}
Result RomFsFileSystem::DoCreateDirectory(const fs::Path &path) {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
}
Result RomFsFileSystem::DoDeleteDirectory(const fs::Path &path) {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
}
Result RomFsFileSystem::DoDeleteDirectoryRecursively(const fs::Path &path) {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
}
Result RomFsFileSystem::DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) {
AMS_UNUSED(old_path, new_path);
return fs::ResultUnsupportedWriteForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
}
Result RomFsFileSystem::DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) {
AMS_UNUSED(old_path, new_path);
return fs::ResultUnsupportedWriteForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
}
Result RomFsFileSystem::DoGetEntryType(fs::DirectoryEntryType *out, const fs::Path &path) {
@@ -488,12 +488,12 @@ namespace ams::fs {
RomFileTable::FileInfo file_info;
R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString()));
*out = fs::DirectoryEntryType_File;
return ResultSuccess();
R_SUCCEED();
}
} R_END_TRY_CATCH;
*out = fs::DirectoryEntryType_Directory;
return ResultSuccess();
R_SUCCEED();
}
Result RomFsFileSystem::DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const fs::Path &path, fs::OpenMode mode) {
@@ -508,7 +508,7 @@ namespace ams::fs {
R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB());
*out_file = std::move(file);
return ResultSuccess();
R_SUCCEED();
}
Result RomFsFileSystem::DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const fs::Path &path, fs::OpenDirectoryMode mode) {
@@ -524,36 +524,36 @@ namespace ams::fs {
R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemC());
*out_dir = std::move(dir);
return ResultSuccess();
R_SUCCEED();
}
Result RomFsFileSystem::DoCommit() {
return ResultSuccess();
R_SUCCEED();
}
Result RomFsFileSystem::DoGetFreeSpaceSize(s64 *out, const fs::Path &path) {
AMS_UNUSED(path);
*out = 0;
return ResultSuccess();
R_SUCCEED();
}
Result RomFsFileSystem::DoGetTotalSpaceSize(s64 *out, const fs::Path &path) {
AMS_UNUSED(out, path);
return fs::ResultUnsupportedGetTotalSpaceSizeForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedGetTotalSpaceSizeForRomFsFileSystem());
}
Result RomFsFileSystem::DoCleanDirectoryRecursively(const fs::Path &path) {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
}
Result RomFsFileSystem::DoCommitProvisionally(s64 counter) {
AMS_UNUSED(counter);
return fs::ResultUnsupportedCommitProvisionallyForRomFsFileSystem();
R_THROW(fs::ResultUnsupportedCommitProvisionallyForRomFsFileSystem());
}
Result RomFsFileSystem::DoRollback() {
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -124,7 +124,7 @@ namespace ams::fs {
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
*out = extra_data.flags;
return ResultSuccess();
R_SUCCEED();
}
Result GetSaveDataFlags(u32 *out, SaveDataSpaceId space_id, SaveDataId id) {
@@ -132,7 +132,7 @@ namespace ams::fs {
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), space_id, id));
*out = extra_data.flags;
return ResultSuccess();
R_SUCCEED();
}
Result SetSaveDataFlags(SaveDataId id, SaveDataSpaceId space_id, u32 flags) {
@@ -147,7 +147,7 @@ namespace ams::fs {
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
*out = extra_data.available_size;
return ResultSuccess();
R_SUCCEED();
}
Result GetSaveDataJournalSize(s64 *out, SaveDataId id) {
@@ -155,7 +155,7 @@ namespace ams::fs {
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
*out = extra_data.journal_size;
return ResultSuccess();
R_SUCCEED();
}
Result ExtendSaveData(SaveDataSpaceId space_id, SaveDataId id, s64 available_size, s64 journal_size) {

View File

@@ -41,7 +41,7 @@ namespace ams::fs {
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
AMS_UNUSED(size);
return ResultSuccess();
R_SUCCEED();
}
};
@@ -107,7 +107,7 @@ namespace ams::fs {
AMS_FS_R_UNLESS(adapter != nullptr, fs::ResultAllocationMemoryFailedInSdCardB());
*out = std::move(adapter);
return ResultSuccess();
R_SUCCEED();
}
bool IsSdCardInserted() {

View File

@@ -82,7 +82,7 @@ namespace ams::fs::impl {
setter.Set(option.HasFlushFlag() ? WriteState::None : WriteState::NeedsFlush);
return ResultSuccess();
R_SUCCEED();
}
Result FileAccessor::Flush() {
@@ -93,7 +93,7 @@ namespace ams::fs::impl {
R_TRY(this->UpdateLastResult(m_impl->Flush()));
setter.Set(WriteState::None);
return ResultSuccess();
R_SUCCEED();
}
Result FileAccessor::SetSize(s64 size) {
@@ -110,7 +110,7 @@ namespace ams::fs::impl {
}
setter.Set(old_write_state);
return ResultSuccess();
R_SUCCEED();
}
Result FileAccessor::GetSize(s64 *out) {

View File

@@ -41,7 +41,7 @@ namespace ams::fs::impl {
R_UNLESS(this->CanAcceptMountName(fs->GetName()), fs::ResultMountNameAlreadyExists());
m_fs_list.push_back(*fs.release());
return ResultSuccess();
R_SUCCEED();
}
Result MountTable::Find(FileSystemAccessor **out, const char *name) {
@@ -50,11 +50,11 @@ namespace ams::fs::impl {
for (auto &fs : m_fs_list) {
if (MatchesName(fs, name)) {
*out = std::addressof(fs);
return ResultSuccess();
R_SUCCEED();
}
}
return fs::ResultNotMounted();
R_THROW(fs::ResultNotMounted());
}
void MountTable::Unmount(const char *name) {

View File

@@ -106,13 +106,13 @@ namespace ams::fs::impl {
Result CheckMountName(const char *name) {
R_TRY(CheckMountNameAllowingReserved(name));
R_UNLESS(!impl::IsReservedMountName(name), fs::ResultInvalidMountName());
return ResultSuccess();
R_SUCCEED();
}
Result CheckMountNameAllowingReserved(const char *name) {
R_UNLESS(name != nullptr, fs::ResultInvalidMountName());
R_UNLESS(impl::IsValidMountName(name), fs::ResultInvalidMountName());
return ResultSuccess();
R_SUCCEED();
}
Result FindFileSystem(FileSystemAccessor **out_accessor, const char **out_sub_path, const char *path) {
@@ -137,7 +137,7 @@ namespace ams::fs::impl {
}
impl::Unregister(name);
return ResultSuccess();
R_SUCCEED();
}
}
@@ -162,7 +162,7 @@ namespace ams::fs {
const auto common_path_len = util::SNPrintf(dst + mount_name_len, dst_size - mount_name_len, "%s", sub_path);
AMS_FS_R_UNLESS(static_cast<size_t>(common_path_len) < dst_size - mount_name_len, fs::ResultTooLongPath());
return ResultSuccess();
R_SUCCEED();
}
void Unmount(const char *mount_name) {

View File

@@ -29,12 +29,12 @@ namespace ams::fs {
Result ReadDirectory(s64 *out_count, DirectoryEntry *out_entries, DirectoryHandle handle, s64 max_entries) {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Read(out_count, out_entries, max_entries), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_DIRECTORY(out_count, max_entries)));
return ResultSuccess();
R_SUCCEED();
}
Result GetDirectoryEntryCount(s64 *out, DirectoryHandle handle) {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->GetEntryCount(out), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_DIRECTORY_ENTRY_COUNT(out)));
return ResultSuccess();
R_SUCCEED();
}
void CloseDirectory(DirectoryHandle handle) {

View File

@@ -27,7 +27,7 @@ namespace ams::fs {
Result ReadFileImpl(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
R_TRY(Get(handle)->Read(out, offset, buffer, size, option));
return ResultSuccess();
R_SUCCEED();
}
}
@@ -36,44 +36,44 @@ namespace ams::fs {
size_t read_size;
AMS_FS_R_TRY(ReadFileImpl(std::addressof(read_size), handle, offset, buffer, size, option));
AMS_FS_R_UNLESS(read_size == size, fs::ResultOutOfRange());
return ResultSuccess();
R_SUCCEED();
}
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
size_t read_size;
AMS_FS_R_TRY(ReadFileImpl(std::addressof(read_size), handle, offset, buffer, size, ReadOption()));
AMS_FS_R_UNLESS(read_size == size, fs::ResultOutOfRange());
return ResultSuccess();
R_SUCCEED();
}
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
AMS_FS_R_TRY(ReadFileImpl(out, handle, offset, buffer, size, option));
return ResultSuccess();
R_SUCCEED();
}
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
AMS_FS_R_TRY(ReadFileImpl(out, handle, offset, buffer, size, ReadOption()));
return ResultSuccess();
R_SUCCEED();
}
Result GetFileSize(s64 *out, FileHandle handle) {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->GetSize(out), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_FILE_SIZE(out)));
return ResultSuccess();
R_SUCCEED();
}
Result FlushFile(FileHandle handle) {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Flush(), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_NONE));
return ResultSuccess();
R_SUCCEED();
}
Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Write(offset, buffer, size, option), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_WRITE_FILE(option), offset, size));
return ResultSuccess();
R_SUCCEED();
}
Result SetFileSize(FileHandle handle, s64 size) {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->SetSize(size), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_SIZE, size));
return ResultSuccess();
R_SUCCEED();
}
int GetFileOpenMode(FileHandle handle) {
@@ -88,7 +88,7 @@ namespace ams::fs {
Result QueryRange(QueryRangeInfo *out, FileHandle handle, s64 offset, s64 size) {
AMS_FS_R_TRY(Get(handle)->OperateRange(out, sizeof(*out), OperationId::QueryRange, offset, size, nullptr, 0));
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -32,7 +32,7 @@ namespace ams::fs {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CreateFile(sub_path, size, option), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_SIZE, path, size));
return ResultSuccess();
R_SUCCEED();
}
Result DeleteFile(const char *path) {
@@ -41,7 +41,7 @@ namespace ams::fs {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteFile(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
return ResultSuccess();
R_SUCCEED();
}
Result CreateDirectory(const char *path) {
@@ -50,7 +50,7 @@ namespace ams::fs {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CreateDirectory(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
return ResultSuccess();
R_SUCCEED();
}
Result DeleteDirectory(const char *path) {
@@ -59,7 +59,7 @@ namespace ams::fs {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteDirectory(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
return ResultSuccess();
R_SUCCEED();
}
Result DeleteDirectoryRecursively(const char *path) {
@@ -68,7 +68,7 @@ namespace ams::fs {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteDirectoryRecursively(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
return ResultSuccess();
R_SUCCEED();
}
Result RenameFile(const char *old_path, const char *new_path) {
@@ -82,11 +82,11 @@ namespace ams::fs {
auto rename_impl = [=]() -> Result {
R_UNLESS(old_accessor == new_accessor, fs::ResultRenameToOtherFileSystem());
R_TRY(old_accessor->RenameFile(old_sub_path, new_sub_path));
return ResultSuccess();
R_SUCCEED();
};
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(rename_impl(), nullptr, old_accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_RENAME, old_path, new_path));
return ResultSuccess();
R_SUCCEED();
}
Result RenameDirectory(const char *old_path, const char *new_path) {
@@ -100,11 +100,11 @@ namespace ams::fs {
auto rename_impl = [=]() -> Result {
R_UNLESS(old_accessor == new_accessor, fs::ResultRenameToOtherFileSystem());
R_TRY(old_accessor->RenameDirectory(old_sub_path, new_sub_path));
return ResultSuccess();
R_SUCCEED();
};
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(rename_impl(), nullptr, old_accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_RENAME, old_path, new_path));
return ResultSuccess();
R_SUCCEED();
}
Result GetEntryType(DirectoryEntryType *out, const char *path) {
@@ -113,7 +113,7 @@ namespace ams::fs {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->GetEntryType(out, sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_ENTRY_TYPE(out, path)));
return ResultSuccess();
R_SUCCEED();
}
Result OpenFile(FileHandle *out_file, const char *path, int mode) {
@@ -126,13 +126,13 @@ namespace ams::fs {
auto open_impl = [&]() -> Result {
R_UNLESS(out_file != nullptr, fs::ResultNullptrArgument());
R_TRY(accessor->OpenFile(std::addressof(file_accessor), sub_path, static_cast<OpenMode>(mode)));
return ResultSuccess();
R_SUCCEED();
};
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(open_impl(), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_OPEN_MODE, path, static_cast<u32>(mode)));
out_file->handle = file_accessor.release();
return ResultSuccess();
R_SUCCEED();
}
Result OpenDirectory(DirectoryHandle *out_dir, const char *path, int mode) {
@@ -145,13 +145,13 @@ namespace ams::fs {
auto open_impl = [&]() -> Result {
R_UNLESS(out_dir != nullptr, fs::ResultNullptrArgument());
R_TRY(accessor->OpenDirectory(std::addressof(dir_accessor), sub_path, static_cast<OpenDirectoryMode>(mode)));
return ResultSuccess();
R_SUCCEED();
};
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(open_impl(), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_OPEN_MODE, path, static_cast<u32>(mode)));
out_dir->handle = dir_accessor.release();
return ResultSuccess();
R_SUCCEED();
}
Result CleanDirectoryRecursively(const char *path) {
@@ -160,7 +160,7 @@ namespace ams::fs {
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CleanDirectoryRecursively(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
return ResultSuccess();
R_SUCCEED();
}
Result GetFreeSpaceSize(s64 *out, const char *path) {

View File

@@ -31,7 +31,7 @@ namespace ams::fs {
R_TRY(accessor->GetFileTimeStampRaw(out, sub_path));
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -34,7 +34,7 @@ namespace ams::fs::impl {
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), clear_mode);
handle.Detach();
return ResultSuccess();
R_SUCCEED();
}
};