fsa: *Impl -> Do*

This commit is contained in:
Michael Scire
2020-12-05 03:05:06 -08:00
parent 73167448cc
commit bf55776241
17 changed files with 306 additions and 306 deletions

View File

@@ -42,27 +42,27 @@ namespace ams::fssystem {
}
}
public:
virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override {
virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override {
return this->base_file->Read(out, offset, buffer, size, option);
}
virtual Result GetSizeImpl(s64 *out) override {
virtual Result DoGetSize(s64 *out) override {
return this->base_file->GetSize(out);
}
virtual Result FlushImpl() override {
virtual Result DoFlush() override {
return this->base_file->Flush();
}
virtual Result WriteImpl(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override {
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override {
return this->base_file->Write(offset, buffer, size, option);
}
virtual Result SetSizeImpl(s64 size) override {
virtual Result DoSetSize(s64 size) override {
return this->base_file->SetSize(size);
}
virtual Result OperateRangeImpl(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
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 {
return this->base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
}
public:
@@ -192,7 +192,7 @@ namespace ams::fssystem {
}
/* Overridden from IPathResolutionFileSystem */
Result DirectorySaveDataFileSystem::OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) {
Result DirectorySaveDataFileSystem::DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(this->ResolveFullPath(full_path, sizeof(full_path), path));
@@ -211,7 +211,7 @@ namespace ams::fssystem {
return ResultSuccess();
}
Result DirectorySaveDataFileSystem::CommitImpl() {
Result DirectorySaveDataFileSystem::DoCommit() {
/* Here, Nintendo does the following (with retries): */
/* - Rename Committed -> Synchronizing. */
/* - Synchronize Working -> Synchronizing (deleting Synchronizing). */
@@ -238,34 +238,34 @@ namespace ams::fssystem {
}
/* Overridden from IPathResolutionFileSystem but not commands. */
Result DirectorySaveDataFileSystem::CommitProvisionallyImpl(s64 counter) {
Result DirectorySaveDataFileSystem::DoCommitProvisionally(s64 counter) {
/* Nintendo does nothing here. */
return ResultSuccess();
}
Result DirectorySaveDataFileSystem::RollbackImpl() {
Result DirectorySaveDataFileSystem::DoRollback() {
/* Initialize overwrites the working directory with the committed directory. */
return this->Initialize();
}
/* Explicitly overridden to be not implemented. */
Result DirectorySaveDataFileSystem::GetFreeSpaceSizeImpl(s64 *out, const char *path) {
Result DirectorySaveDataFileSystem::DoGetFreeSpaceSize(s64 *out, const char *path) {
return fs::ResultNotImplemented();
}
Result DirectorySaveDataFileSystem::GetTotalSpaceSizeImpl(s64 *out, const char *path) {
Result DirectorySaveDataFileSystem::DoGetTotalSpaceSize(s64 *out, const char *path) {
return fs::ResultNotImplemented();
}
Result DirectorySaveDataFileSystem::GetFileTimeStampRawImpl(fs::FileTimeStampRaw *out, const char *path) {
Result DirectorySaveDataFileSystem::DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const char *path) {
return fs::ResultNotImplemented();
}
Result DirectorySaveDataFileSystem::QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) {
Result DirectorySaveDataFileSystem::DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) {
return fs::ResultNotImplemented();
}
Result DirectorySaveDataFileSystem::FlushImpl() {
Result DirectorySaveDataFileSystem::DoFlush() {
return fs::ResultNotImplemented();
}

View File

@@ -47,14 +47,14 @@ namespace ams::fssystem {
public:
PartitionFile(PartitionFileSystemCore<MetaType> *parent, const typename MetaType::PartitionEntry *partition_entry, fs::OpenMode mode) : partition_entry(partition_entry), parent(parent), mode(mode) { /* ... */ }
private:
virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override final;
virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override final;
virtual Result GetSizeImpl(s64 *out) override final {
virtual Result DoGetSize(s64 *out) override final {
*out = this->partition_entry->size;
return ResultSuccess();
}
virtual Result FlushImpl() override final {
virtual Result DoFlush() override final {
/* Nothing to do if writing disallowed. */
R_SUCCEED_IF((this->mode & fs::OpenMode_Write) == 0);
@@ -62,7 +62,7 @@ namespace ams::fssystem {
return this->parent->base_storage->Flush();
}
virtual Result WriteImpl(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final {
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final {
/* Ensure appending is not required. */
bool needs_append;
R_TRY(this->DryWrite(std::addressof(needs_append), offset, size, option, this->mode));
@@ -79,12 +79,12 @@ namespace ams::fssystem {
return this->parent->base_storage->Write(this->parent->meta_data_size + this->partition_entry->offset + offset, buffer, size);
}
virtual Result SetSizeImpl(s64 size) override final {
virtual Result DoSetSize(s64 size) override final {
R_TRY(this->DrySetSize(size, this->mode));
return fs::ResultUnsupportedOperationInPartitionFileA();
}
virtual Result OperateRangeImpl(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override final {
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 final {
/* Validate preconditions for operation. */
switch (op_id) {
case fs::OperationId::InvalidateCache:
@@ -113,7 +113,7 @@ namespace ams::fssystem {
};
template<>
Result PartitionFileSystemCore<PartitionFileSystemMeta>::PartitionFile::ReadImpl(size_t *out, s64 offset, void *dst, size_t dst_size, const fs::ReadOption &option) {
Result PartitionFileSystemCore<PartitionFileSystemMeta>::PartitionFile::DoRead(size_t *out, s64 offset, void *dst, size_t dst_size, const fs::ReadOption &option) {
/* Perform a dry read. */
size_t read_size = 0;
R_TRY(this->DryRead(std::addressof(read_size), offset, dst_size, option, this->mode));
@@ -127,7 +127,7 @@ namespace ams::fssystem {
}
template<>
Result PartitionFileSystemCore<Sha256PartitionFileSystemMeta>::PartitionFile::ReadImpl(size_t *out, s64 offset, void *dst, size_t dst_size, const fs::ReadOption &option) {
Result PartitionFileSystemCore<Sha256PartitionFileSystemMeta>::PartitionFile::DoRead(size_t *out, s64 offset, void *dst, size_t dst_size, const fs::ReadOption &option) {
/* Perform a dry read. */
size_t read_size = 0;
R_TRY(this->DryRead(std::addressof(read_size), offset, dst_size, option, this->mode));
@@ -223,7 +223,7 @@ namespace ams::fssystem {
public:
PartitionDirectory(PartitionFileSystemCore<MetaType> *parent, fs::OpenDirectoryMode mode) : cur_index(0), parent(parent), mode(mode) { /* ... */ }
public:
virtual Result ReadImpl(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) override final {
virtual Result DoRead(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) override final {
/* There are no subdirectories. */
if ((this->mode & fs::OpenDirectoryMode_File) == 0) {
*out_count = 0;
@@ -248,7 +248,7 @@ namespace ams::fssystem {
return ResultSuccess();
}
virtual Result GetEntryCountImpl(s64 *out) override final {
virtual Result DoGetEntryCount(s64 *out) override final {
/* Output the parent meta data entry count for files, otherwise 0. */
if (this->mode & fs::OpenDirectoryMode_File) {
*out = this->parent->meta_data->GetEntryCount();
@@ -347,7 +347,7 @@ namespace ams::fssystem {
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) {
Result PartitionFileSystemCore<MetaType>::DoGetEntryType(fs::DirectoryEntryType *out, const char *path) {
/* Validate preconditions. */
R_UNLESS(this->initialized, fs::ResultPreconditionViolation());
R_UNLESS(PathTool::IsSeparator(path[0]), fs::ResultInvalidPathFormat());
@@ -366,7 +366,7 @@ namespace ams::fssystem {
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) {
Result PartitionFileSystemCore<MetaType>::DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) {
/* Validate preconditions. */
R_UNLESS(this->initialized, fs::ResultPreconditionViolation());
@@ -382,7 +382,7 @@ namespace ams::fssystem {
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::OpenDirectoryImpl(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) {
Result PartitionFileSystemCore<MetaType>::DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) {
/* Validate preconditions. */
R_UNLESS(this->initialized, fs::ResultPreconditionViolation());
R_UNLESS(std::strncmp(path, PathTool::RootPath, sizeof(PathTool::RootPath)) == 0, fs::ResultPathNotFound());
@@ -395,52 +395,52 @@ namespace ams::fssystem {
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::CommitImpl() {
Result PartitionFileSystemCore<MetaType>::DoCommit() {
return ResultSuccess();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::CleanDirectoryRecursivelyImpl(const char *path) {
Result PartitionFileSystemCore<MetaType>::DoCleanDirectoryRecursively(const char *path) {
return fs::ResultUnsupportedOperationInPartitionFileSystemA();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::CreateDirectoryImpl(const char *path) {
Result PartitionFileSystemCore<MetaType>::DoCreateDirectory(const char *path) {
return fs::ResultUnsupportedOperationInPartitionFileSystemA();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::CreateFileImpl(const char *path, s64 size, int option) {
Result PartitionFileSystemCore<MetaType>::DoCreateFile(const char *path, s64 size, int option) {
return fs::ResultUnsupportedOperationInPartitionFileSystemA();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::DeleteDirectoryImpl(const char *path) {
Result PartitionFileSystemCore<MetaType>::DoDeleteDirectory(const char *path) {
return fs::ResultUnsupportedOperationInPartitionFileSystemA();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::DeleteDirectoryRecursivelyImpl(const char *path) {
Result PartitionFileSystemCore<MetaType>::DoDeleteDirectoryRecursively(const char *path) {
return fs::ResultUnsupportedOperationInPartitionFileSystemA();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::DeleteFileImpl(const char *path) {
Result PartitionFileSystemCore<MetaType>::DoDeleteFile(const char *path) {
return fs::ResultUnsupportedOperationInPartitionFileSystemA();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::RenameDirectoryImpl(const char *old_path, const char *new_path) {
Result PartitionFileSystemCore<MetaType>::DoRenameDirectory(const char *old_path, const char *new_path) {
return fs::ResultUnsupportedOperationInPartitionFileSystemA();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::RenameFileImpl(const char *old_path, const char *new_path) {
Result PartitionFileSystemCore<MetaType>::DoRenameFile(const char *old_path, const char *new_path) {
return fs::ResultUnsupportedOperationInPartitionFileSystemA();
}
template <typename MetaType>
Result PartitionFileSystemCore<MetaType>::CommitProvisionallyImpl(s64 counter) {
Result PartitionFileSystemCore<MetaType>::DoCommitProvisionally(s64 counter) {
return fs::ResultUnsupportedOperationInPartitionFileSystemB();
}

View File

@@ -36,7 +36,7 @@ namespace ams::fssystem {
RomFsFile(RomFsFileSystem *p, s64 s, s64 e) : parent(p), start(s), end(e) { /* ... */ }
virtual ~RomFsFile() { /* ... */ }
public:
virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override {
virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
size_t read_size = 0;
R_TRY(this->DryRead(std::addressof(read_size), offset, size, option, fs::OpenMode_Read));
@@ -50,28 +50,28 @@ namespace ams::fssystem {
return ResultSuccess();
}
virtual Result GetSizeImpl(s64 *out) override {
virtual Result DoGetSize(s64 *out) override {
*out = this->GetSize();
return ResultSuccess();
}
virtual Result FlushImpl() override {
virtual Result DoFlush() override {
return ResultSuccess();
}
virtual Result WriteImpl(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override {
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override {
bool needs_append;
R_TRY(this->DryWrite(std::addressof(needs_append), offset, size, option, fs::OpenMode_Read));
AMS_ASSERT(needs_append == false);
return fs::ResultUnsupportedOperationInRomFsFileA();
}
virtual Result SetSizeImpl(s64 size) override {
virtual Result DoSetSize(s64 size) override {
R_TRY(this->DrySetSize(size, fs::OpenMode_Read));
return fs::ResultUnsupportedOperationInRomFsFileA();
}
virtual Result OperateRangeImpl(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
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 {
switch (op_id) {
case fs::OperationId::InvalidateCache:
case fs::OperationId::QueryRange:
@@ -112,14 +112,14 @@ namespace ams::fssystem {
RomFsDirectory(RomFsFileSystem *p, const FindPosition &f, fs::OpenDirectoryMode m) : parent(p), current_find(f), first_find(f), mode(m) { /* ... */ }
virtual ~RomFsDirectory() override { /* ... */ }
public:
virtual Result ReadImpl(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) {
virtual Result DoRead(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
return this->ReadInternal(out_count, std::addressof(this->current_find), out_entries, max_entries);
}, AMS_CURRENT_FUNCTION_NAME));
return ResultSuccess();
}
virtual Result GetEntryCountImpl(s64 *out) {
virtual Result DoGetEntryCount(s64 *out) {
FindPosition find = this->first_find;
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([&]() -> Result {
@@ -296,35 +296,35 @@ namespace ams::fssystem {
return ResultSuccess();
}
Result RomFsFileSystem::CreateFileImpl(const char *path, s64 size, int flags) {
Result RomFsFileSystem::DoCreateFile(const char *path, s64 size, int flags) {
return fs::ResultUnsupportedOperationInRomFsFileSystemA();
}
Result RomFsFileSystem::DeleteFileImpl(const char *path) {
Result RomFsFileSystem::DoDeleteFile(const char *path) {
return fs::ResultUnsupportedOperationInRomFsFileSystemA();
}
Result RomFsFileSystem::CreateDirectoryImpl(const char *path) {
Result RomFsFileSystem::DoCreateDirectory(const char *path) {
return fs::ResultUnsupportedOperationInRomFsFileSystemA();
}
Result RomFsFileSystem::DeleteDirectoryImpl(const char *path) {
Result RomFsFileSystem::DoDeleteDirectory(const char *path) {
return fs::ResultUnsupportedOperationInRomFsFileSystemA();
}
Result RomFsFileSystem::DeleteDirectoryRecursivelyImpl(const char *path) {
Result RomFsFileSystem::DoDeleteDirectoryRecursively(const char *path) {
return fs::ResultUnsupportedOperationInRomFsFileSystemA();
}
Result RomFsFileSystem::RenameFileImpl(const char *old_path, const char *new_path) {
Result RomFsFileSystem::DoRenameFile(const char *old_path, const char *new_path) {
return fs::ResultUnsupportedOperationInRomFsFileSystemA();
}
Result RomFsFileSystem::RenameDirectoryImpl(const char *old_path, const char *new_path) {
Result RomFsFileSystem::DoRenameDirectory(const char *old_path, const char *new_path) {
return fs::ResultUnsupportedOperationInRomFsFileSystemA();
}
Result RomFsFileSystem::GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) {
Result RomFsFileSystem::DoGetEntryType(fs::DirectoryEntryType *out, const char *path) {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
fs::RomDirectoryInfo dir_info;
@@ -346,7 +346,7 @@ namespace ams::fssystem {
return ResultSuccess();
}
Result RomFsFileSystem::OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) {
Result RomFsFileSystem::DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) {
R_UNLESS(mode == fs::OpenMode_Read, fs::ResultInvalidOpenMode());
RomFileTable::FileInfo file_info;
@@ -359,7 +359,7 @@ namespace ams::fssystem {
return ResultSuccess();
}
Result RomFsFileSystem::OpenDirectoryImpl(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) {
Result RomFsFileSystem::DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) {
RomFileTable::FindPosition find;
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([&]() -> Result {
R_TRY_CATCH(this->rom_file_table.FindOpen(std::addressof(find), path)) {
@@ -376,20 +376,20 @@ namespace ams::fssystem {
return ResultSuccess();
}
Result RomFsFileSystem::CommitImpl() {
Result RomFsFileSystem::DoCommit() {
return ResultSuccess();
}
Result RomFsFileSystem::GetFreeSpaceSizeImpl(s64 *out, const char *path) {
Result RomFsFileSystem::DoGetFreeSpaceSize(s64 *out, const char *path) {
*out = 0;
return ResultSuccess();
}
Result RomFsFileSystem::CleanDirectoryRecursivelyImpl(const char *path) {
Result RomFsFileSystem::DoCleanDirectoryRecursively(const char *path) {
return fs::ResultUnsupportedOperationInRomFsFileSystemA();
}
Result RomFsFileSystem::CommitProvisionallyImpl(s64 counter) {
Result RomFsFileSystem::DoCommitProvisionally(s64 counter) {
return fs::ResultUnsupportedOperationInRomFsFileSystemB();
}