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

@ -33,27 +33,27 @@ namespace ams::fs {
explicit ReadOnlyFile(std::unique_ptr<fsa::IFile> &&f) : base_file(std::move(f)) { /* ... */ }
virtual ~ReadOnlyFile() { /* ... */ }
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 {
return this->base_file->Read(out, offset, buffer, size, option);
}
virtual Result GetSizeImpl(s64 *out) override final {
virtual Result DoGetSize(s64 *out) override final {
return this->base_file->GetSize(out);
}
virtual Result FlushImpl() override final {
virtual Result DoFlush() override final {
return ResultSuccess();
}
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 {
return fs::ResultUnsupportedOperationInReadOnlyFileA();
}
virtual Result SetSizeImpl(s64 size) override final {
virtual Result DoSetSize(s64 size) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileA();
}
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 {
switch (op_id) {
case OperationId::InvalidateCache:
case OperationId::QueryRange:
@ -80,7 +80,7 @@ namespace ams::fs {
explicit ReadOnlyFileSystemTemplate(T &&fs) : base_fs(std::move(fs)) { /* ... */ }
virtual ~ReadOnlyFileSystemTemplate() { /* ... */ }
private:
virtual Result OpenFileImpl(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final {
virtual Result DoOpenFile(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final {
/* Only allow opening files with mode = read. */
R_UNLESS((mode & fs::OpenMode_All) == fs::OpenMode_Read, fs::ResultInvalidOpenMode());
@ -94,59 +94,59 @@ namespace ams::fs {
return ResultSuccess();
}
virtual Result OpenDirectoryImpl(std::unique_ptr<fsa::IDirectory> *out_dir, const char *path, OpenDirectoryMode mode) override final {
virtual Result DoOpenDirectory(std::unique_ptr<fsa::IDirectory> *out_dir, const char *path, OpenDirectoryMode mode) override final {
return this->base_fs->OpenDirectory(out_dir, path, mode);
}
virtual Result GetEntryTypeImpl(DirectoryEntryType *out, const char *path) override final {
virtual Result DoGetEntryType(DirectoryEntryType *out, const char *path) override final {
return this->base_fs->GetEntryType(out, path);
}
virtual Result CommitImpl() override final {
virtual Result DoCommit() override final {
return ResultSuccess();
}
virtual Result CreateFileImpl(const char *path, s64 size, int flags) override final {
virtual Result DoCreateFile(const char *path, s64 size, int flags) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateA();
}
virtual Result DeleteFileImpl(const char *path) override final {
virtual Result DoDeleteFile(const char *path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateA();
}
virtual Result CreateDirectoryImpl(const char *path) override final {
virtual Result DoCreateDirectory(const char *path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateA();
}
virtual Result DeleteDirectoryImpl(const char *path) override final {
virtual Result DoDeleteDirectory(const char *path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateA();
}
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override final {
virtual Result DoDeleteDirectoryRecursively(const char *path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateA();
}
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override final {
virtual Result DoRenameFile(const char *old_path, const char *new_path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateA();
}
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override final {
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateA();
}
virtual Result CleanDirectoryRecursivelyImpl(const char *path) override final {
virtual Result DoCleanDirectoryRecursively(const char *path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateA();
}
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) override final {
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateB();
}
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) override final {
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateB();
}
virtual Result CommitProvisionallyImpl(s64 counter) override final {
virtual Result DoCommitProvisionally(s64 counter) override final {
return fs::ResultUnsupportedOperationInReadOnlyFileSystemTemplateC();
}
};

View file

@ -33,27 +33,27 @@ namespace ams::fs {
virtual ~RemoteFile() { fsFileClose(std::addressof(this->base_file)); }
public:
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 {
return fsFileRead(std::addressof(this->base_file), offset, buffer, size, option.value, out);
}
virtual Result GetSizeImpl(s64 *out) override final {
virtual Result DoGetSize(s64 *out) override final {
return fsFileGetSize(std::addressof(this->base_file), out);
}
virtual Result FlushImpl() override final {
virtual Result DoFlush() override final {
return fsFileFlush(std::addressof(this->base_file));
}
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 {
return fsFileWrite(std::addressof(this->base_file), offset, buffer, size, option.value);
}
virtual Result SetSizeImpl(s64 size) override final {
virtual Result DoSetSize(s64 size) override final {
return fsFileSetSize(std::addressof(this->base_file), 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 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 {
R_UNLESS(op_id == OperationId::QueryRange, fs::ResultUnsupportedOperationInFileServiceObjectAdapterA());
R_UNLESS(dst_size == sizeof(FileQueryRangeInfo), fs::ResultInvalidSize());
@ -73,11 +73,11 @@ namespace ams::fs {
virtual ~RemoteDirectory() { fsDirClose(std::addressof(this->base_dir)); }
public:
virtual Result ReadImpl(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) override final {
virtual Result DoRead(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) override final {
return fsDirRead(std::addressof(this->base_dir), out_count, max_entries, out_entries);
}
virtual Result GetEntryCountImpl(s64 *out) override final {
virtual Result DoGetEntryCount(s64 *out) override final {
return fsDirGetEntryCount(std::addressof(this->base_dir), out);
}
public:
@ -109,37 +109,37 @@ namespace ams::fs {
return VerifyPath(rel_path, max_len, max_len);
}
public:
virtual Result CreateFileImpl(const char *path, s64 size, int flags) override final {
virtual Result DoCreateFile(const char *path, s64 size, int flags) override final {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsCreateFile(std::addressof(this->base_fs), sf_path.str, size, flags);
}
virtual Result DeleteFileImpl(const char *path) override final {
virtual Result DoDeleteFile(const char *path) override final {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsDeleteFile(std::addressof(this->base_fs), sf_path.str);
}
virtual Result CreateDirectoryImpl(const char *path) override final {
virtual Result DoCreateDirectory(const char *path) override final {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsCreateDirectory(std::addressof(this->base_fs), sf_path.str);
}
virtual Result DeleteDirectoryImpl(const char *path) override final {
virtual Result DoDeleteDirectory(const char *path) override final {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsDeleteDirectory(std::addressof(this->base_fs), sf_path.str);
}
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override final {
virtual Result DoDeleteDirectoryRecursively(const char *path) override final {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsDeleteDirectoryRecursively(std::addressof(this->base_fs), sf_path.str);
}
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override final {
virtual Result DoRenameFile(const char *old_path, const char *new_path) override final {
fssrv::sf::Path old_sf_path;
fssrv::sf::Path new_sf_path;
R_TRY(GetPathForServiceObject(std::addressof(old_sf_path), old_path));
@ -147,7 +147,7 @@ namespace ams::fs {
return fsFsRenameFile(std::addressof(this->base_fs), old_sf_path.str, new_sf_path.str);
}
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override final {
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override final {
fssrv::sf::Path old_sf_path;
fssrv::sf::Path new_sf_path;
R_TRY(GetPathForServiceObject(std::addressof(old_sf_path), old_path));
@ -155,7 +155,7 @@ namespace ams::fs {
return fsFsRenameDirectory(std::addressof(this->base_fs), old_sf_path.str, new_sf_path.str);
}
virtual Result GetEntryTypeImpl(DirectoryEntryType *out, const char *path) override final {
virtual Result DoGetEntryType(DirectoryEntryType *out, const char *path) override final {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
@ -163,7 +163,7 @@ namespace ams::fs {
return fsFsGetEntryType(std::addressof(this->base_fs), sf_path.str, reinterpret_cast<::FsDirEntryType *>(out));
}
virtual Result OpenFileImpl(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final {
virtual Result DoOpenFile(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
@ -177,7 +177,7 @@ namespace ams::fs {
return ResultSuccess();
}
virtual Result OpenDirectoryImpl(std::unique_ptr<fsa::IDirectory> *out_dir, const char *path, OpenDirectoryMode mode) override final {
virtual Result DoOpenDirectory(std::unique_ptr<fsa::IDirectory> *out_dir, const char *path, OpenDirectoryMode mode) override final {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
@ -191,37 +191,37 @@ namespace ams::fs {
return ResultSuccess();
}
virtual Result CommitImpl() override final {
virtual Result DoCommit() override final {
return fsFsCommit(std::addressof(this->base_fs));
}
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) {
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsGetFreeSpace(std::addressof(this->base_fs), sf_path.str, out);
}
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) {
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsGetTotalSpace(std::addressof(this->base_fs), sf_path.str, out);
}
virtual Result CleanDirectoryRecursivelyImpl(const char *path) {
virtual Result DoCleanDirectoryRecursively(const char *path) {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsCleanDirectoryRecursively(std::addressof(this->base_fs), sf_path.str);
}
virtual Result GetFileTimeStampRawImpl(FileTimeStampRaw *out, const char *path) {
virtual Result DoGetFileTimeStampRaw(FileTimeStampRaw *out, const char *path) {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
static_assert(sizeof(FileTimeStampRaw) == sizeof(::FsTimeStampRaw));
return fsFsGetFileTimeStampRaw(std::addressof(this->base_fs), sf_path.str, reinterpret_cast<::FsTimeStampRaw *>(out));
}
virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, fsa::QueryId query, const char *path) {
virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fsa::QueryId query, const char *path) {
fssrv::sf::Path sf_path;
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
return fsFsQueryEntry(std::addressof(this->base_fs), dst, dst_size, src, src_size, sf_path.str, static_cast<FsFileSystemQueryId>(query));

View file

@ -51,24 +51,24 @@ namespace ams::fs {
RomFileTable *GetRomFileTable();
Result GetFileBaseOffset(s64 *out, const char *path);
public:
virtual Result CreateFileImpl(const char *path, s64 size, int flags) override;
virtual Result DeleteFileImpl(const char *path) override;
virtual Result CreateDirectoryImpl(const char *path) override;
virtual Result DeleteDirectoryImpl(const char *path) override;
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override;
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override;
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override;
virtual Result GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) override;
virtual Result OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override;
virtual Result OpenDirectoryImpl(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override;
virtual Result CommitImpl() override;
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) override;
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) override;
virtual Result CleanDirectoryRecursivelyImpl(const char *path) override;
virtual Result DoCreateFile(const char *path, s64 size, int flags) override;
virtual Result DoDeleteFile(const char *path) override;
virtual Result DoCreateDirectory(const char *path) override;
virtual Result DoDeleteDirectory(const char *path) override;
virtual Result DoDeleteDirectoryRecursively(const char *path) override;
virtual Result DoRenameFile(const char *old_path, const char *new_path) override;
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override;
virtual Result DoGetEntryType(fs::DirectoryEntryType *out, const char *path) override;
virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override;
virtual Result DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override;
virtual Result DoCommit() override;
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) override;
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) override;
virtual Result DoCleanDirectoryRecursively(const char *path) override;
/* These aren't accessible as commands. */
virtual Result CommitProvisionallyImpl(s64 counter) override;
virtual Result RollbackImpl() override;
virtual Result DoCommitProvisionally(s64 counter) override;
virtual Result DoRollback() override;
};
}

View file

@ -30,25 +30,25 @@ namespace ams::fs {
public:
SharedFileSystemHolder(std::shared_ptr<fsa::IFileSystem> f) : fs(std::move(f)) { /* ... */ }
public:
virtual Result CreateFileImpl(const char *path, s64 size, int flags) override { return this->fs->CreateFile(path, size, flags); }
virtual Result DeleteFileImpl(const char *path) override { return this->fs->DeleteFile(path); }
virtual Result CreateDirectoryImpl(const char *path) override { return this->fs->CreateDirectory(path); }
virtual Result DeleteDirectoryImpl(const char *path) override { return this->fs->DeleteDirectory(path); }
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override { return this->fs->DeleteDirectoryRecursively(path); }
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override { return this->fs->RenameFile(old_path, new_path); }
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override { return this->fs->RenameDirectory(old_path, new_path); }
virtual Result GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) override { return this->fs->GetEntryType(out, path); }
virtual Result OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override { return this->fs->OpenFile(out_file, path, mode); }
virtual Result OpenDirectoryImpl(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override { return this->fs->OpenDirectory(out_dir, path, mode); }
virtual Result CommitImpl() override { return this->fs->Commit(); }
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) override { return this->fs->GetFreeSpaceSize(out, path); }
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) override { return this->fs->GetTotalSpaceSize(out, path); }
virtual Result CleanDirectoryRecursivelyImpl(const char *path) override { return this->fs->CleanDirectoryRecursively(path); }
virtual Result DoCreateFile(const char *path, s64 size, int flags) override { return this->fs->CreateFile(path, size, flags); }
virtual Result DoDeleteFile(const char *path) override { return this->fs->DeleteFile(path); }
virtual Result DoCreateDirectory(const char *path) override { return this->fs->CreateDirectory(path); }
virtual Result DoDeleteDirectory(const char *path) override { return this->fs->DeleteDirectory(path); }
virtual Result DoDeleteDirectoryRecursively(const char *path) override { return this->fs->DeleteDirectoryRecursively(path); }
virtual Result DoRenameFile(const char *old_path, const char *new_path) override { return this->fs->RenameFile(old_path, new_path); }
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override { return this->fs->RenameDirectory(old_path, new_path); }
virtual Result DoGetEntryType(fs::DirectoryEntryType *out, const char *path) override { return this->fs->GetEntryType(out, path); }
virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override { return this->fs->OpenFile(out_file, path, mode); }
virtual Result DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override { return this->fs->OpenDirectory(out_dir, path, mode); }
virtual Result DoCommit() override { return this->fs->Commit(); }
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) override { return this->fs->GetFreeSpaceSize(out, path); }
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) override { return this->fs->GetTotalSpaceSize(out, path); }
virtual Result DoCleanDirectoryRecursively(const char *path) override { return this->fs->CleanDirectoryRecursively(path); }
/* These aren't accessible as commands. */
virtual Result CommitProvisionallyImpl(s64 counter) override { return this->fs->CommitProvisionally(counter); }
virtual Result RollbackImpl() override { return this->fs->Rollback(); }
virtual Result FlushImpl() override { return this->fs->Flush(); }
virtual Result DoCommitProvisionally(s64 counter) override { return this->fs->CommitProvisionally(counter); }
virtual Result DoRollback() override { return this->fs->Rollback(); }
virtual Result DoFlush() override { return this->fs->Flush(); }
};
}

View file

@ -32,12 +32,12 @@ namespace ams::fs::fsa {
}
R_UNLESS(out_entries != nullptr, fs::ResultNullptrArgument());
R_UNLESS(max_entries > 0, fs::ResultInvalidArgument());
return this->ReadImpl(out_count, out_entries, max_entries);
return this->DoRead(out_count, out_entries, max_entries);
}
Result GetEntryCount(s64 *out) {
R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
return this->GetEntryCountImpl(out);
return this->DoGetEntryCount(out);
}
public:
/* TODO: This is a hack to allow the mitm API to work. Find a better way? */
@ -45,8 +45,8 @@ namespace ams::fs::fsa {
protected:
/* ...? */
private:
virtual Result ReadImpl(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) = 0;
virtual Result GetEntryCountImpl(s64 *out) = 0;
virtual Result DoRead(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) = 0;
virtual Result DoGetEntryCount(s64 *out) = 0;
};
}

View file

@ -36,7 +36,7 @@ namespace ams::fs::fsa {
const s64 signed_size = static_cast<s64>(size);
R_UNLESS(signed_size >= 0, fs::ResultOutOfRange());
R_UNLESS((std::numeric_limits<s64>::max() - offset) >= signed_size, fs::ResultOutOfRange());
return this->ReadImpl(out, offset, buffer, size, option);
return this->DoRead(out, offset, buffer, size, option);
}
Result Read(size_t *out, s64 offset, void *buffer, size_t size) {
@ -45,11 +45,11 @@ namespace ams::fs::fsa {
Result GetSize(s64 *out) {
R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
return this->GetSizeImpl(out);
return this->DoGetSize(out);
}
Result Flush() {
return this->FlushImpl();
return this->DoFlush();
}
Result Write(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) {
@ -64,20 +64,20 @@ namespace ams::fs::fsa {
const s64 signed_size = static_cast<s64>(size);
R_UNLESS(signed_size >= 0, fs::ResultOutOfRange());
R_UNLESS((std::numeric_limits<s64>::max() - offset) >= signed_size, fs::ResultOutOfRange());
return this->WriteImpl(offset, buffer, size, option);
return this->DoWrite(offset, buffer, size, option);
}
Result SetSize(s64 size) {
R_UNLESS(size >= 0, fs::ResultOutOfRange());
return this->SetSizeImpl(size);
return this->DoSetSize(size);
}
Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
return this->OperateRangeImpl(dst, dst_size, op_id, offset, size, src, src_size);
return this->DoOperateRange(dst, dst_size, op_id, offset, size, src, src_size);
}
Result OperateRange(fs::OperationId op_id, s64 offset, s64 size) {
return this->OperateRangeImpl(nullptr, 0, op_id, offset, size, nullptr, 0);
return this->DoOperateRange(nullptr, 0, op_id, offset, size, nullptr, 0);
}
public:
/* TODO: This is a hack to allow the mitm API to work. Find a better way? */
@ -124,12 +124,12 @@ namespace ams::fs::fsa {
return ResultSuccess();
}
private:
virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) = 0;
virtual Result GetSizeImpl(s64 *out) = 0;
virtual Result FlushImpl() = 0;
virtual Result WriteImpl(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) = 0;
virtual Result SetSizeImpl(s64 size) = 0;
virtual Result OperateRangeImpl(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) = 0;
virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) = 0;
virtual Result DoGetSize(s64 *out) = 0;
virtual Result DoFlush() = 0;
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) = 0;
virtual Result DoSetSize(s64 size) = 0;
virtual Result DoOperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) = 0;
};
}

View file

@ -36,7 +36,7 @@ namespace ams::fs::fsa {
Result CreateFile(const char *path, s64 size, int option) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
R_UNLESS(size >= 0, fs::ResultOutOfRange());
return this->CreateFileImpl(path, size, option);
return this->DoCreateFile(path, size, option);
}
Result CreateFile(const char *path, s64 size) {
@ -45,40 +45,40 @@ namespace ams::fs::fsa {
Result DeleteFile(const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
return this->DeleteFileImpl(path);
return this->DoDeleteFile(path);
}
Result CreateDirectory(const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
return this->CreateDirectoryImpl(path);
return this->DoCreateDirectory(path);
}
Result DeleteDirectory(const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
return this->DeleteDirectoryImpl(path);
return this->DoDeleteDirectory(path);
}
Result DeleteDirectoryRecursively(const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
return this->DeleteDirectoryRecursivelyImpl(path);
return this->DoDeleteDirectoryRecursively(path);
}
Result RenameFile(const char *old_path, const char *new_path) {
R_UNLESS(old_path != nullptr, fs::ResultInvalidPath());
R_UNLESS(new_path != nullptr, fs::ResultInvalidPath());
return this->RenameFileImpl(old_path, new_path);
return this->DoRenameFile(old_path, new_path);
}
Result RenameDirectory(const char *old_path, const char *new_path) {
R_UNLESS(old_path != nullptr, fs::ResultInvalidPath());
R_UNLESS(new_path != nullptr, fs::ResultInvalidPath());
return this->RenameDirectoryImpl(old_path, new_path);
return this->DoRenameDirectory(old_path, new_path);
}
Result GetEntryType(DirectoryEntryType *out, const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
return this->GetEntryTypeImpl(out, path);
return this->DoGetEntryType(out, path);
}
Result OpenFile(std::unique_ptr<IFile> *out_file, const char *path, OpenMode mode) {
@ -86,7 +86,7 @@ namespace ams::fs::fsa {
R_UNLESS(out_file != nullptr, fs::ResultNullptrArgument());
R_UNLESS((mode & OpenMode_ReadWrite) != 0, fs::ResultInvalidOpenMode());
R_UNLESS((mode & ~OpenMode_All) == 0, fs::ResultInvalidOpenMode());
return this->OpenFileImpl(out_file, path, mode);
return this->DoOpenFile(out_file, path, mode);
}
Result OpenDirectory(std::unique_ptr<IDirectory> *out_dir, const char *path, OpenDirectoryMode mode) {
@ -94,98 +94,98 @@ namespace ams::fs::fsa {
R_UNLESS(out_dir != nullptr, fs::ResultNullptrArgument());
R_UNLESS((mode & OpenDirectoryMode_All) != 0, fs::ResultInvalidOpenMode());
R_UNLESS((mode & ~(OpenDirectoryMode_All | OpenDirectoryMode_NotRequireFileSize)) == 0, fs::ResultInvalidOpenMode());
return this->OpenDirectoryImpl(out_dir, path, mode);
return this->DoOpenDirectory(out_dir, path, mode);
}
Result Commit() {
return this->CommitImpl();
return this->DoCommit();
}
Result GetFreeSpaceSize(s64 *out, const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
return this->GetFreeSpaceSizeImpl(out, path);
return this->DoGetFreeSpaceSize(out, path);
}
Result GetTotalSpaceSize(s64 *out, const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
return this->GetTotalSpaceSizeImpl(out, path);
return this->DoGetTotalSpaceSize(out, path);
}
Result CleanDirectoryRecursively(const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
return this->CleanDirectoryRecursivelyImpl(path);
return this->DoCleanDirectoryRecursively(path);
}
Result GetFileTimeStampRaw(FileTimeStampRaw *out, const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
return this->GetFileTimeStampRawImpl(out, path);
return this->DoGetFileTimeStampRaw(out, path);
}
Result QueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, QueryId query, const char *path) {
R_UNLESS(path != nullptr, fs::ResultInvalidPath());
return this->QueryEntryImpl(dst, dst_size, src, src_size, query, path);
return this->DoQueryEntry(dst, dst_size, src, src_size, query, path);
}
/* These aren't accessible as commands. */
Result CommitProvisionally(s64 counter) {
return this->CommitProvisionallyImpl(counter);
return this->DoCommitProvisionally(counter);
}
Result Rollback() {
return this->RollbackImpl();
return this->DoRollback();
}
Result Flush() {
return this->FlushImpl();
return this->DoFlush();
}
protected:
/* ...? */
private:
virtual Result CreateFileImpl(const char *path, s64 size, int flags) = 0;
virtual Result DeleteFileImpl(const char *path) = 0;
virtual Result CreateDirectoryImpl(const char *path) = 0;
virtual Result DeleteDirectoryImpl(const char *path) = 0;
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) = 0;
virtual Result RenameFileImpl(const char *old_path, const char *new_path) = 0;
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) = 0;
virtual Result GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) = 0;
virtual Result OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) = 0;
virtual Result OpenDirectoryImpl(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) = 0;
virtual Result CommitImpl() = 0;
virtual Result DoCreateFile(const char *path, s64 size, int flags) = 0;
virtual Result DoDeleteFile(const char *path) = 0;
virtual Result DoCreateDirectory(const char *path) = 0;
virtual Result DoDeleteDirectory(const char *path) = 0;
virtual Result DoDeleteDirectoryRecursively(const char *path) = 0;
virtual Result DoRenameFile(const char *old_path, const char *new_path) = 0;
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) = 0;
virtual Result DoGetEntryType(fs::DirectoryEntryType *out, const char *path) = 0;
virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) = 0;
virtual Result DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) = 0;
virtual Result DoCommit() = 0;
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) {
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) {
return fs::ResultNotImplemented();
}
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) {
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) {
return fs::ResultNotImplemented();
}
virtual Result CleanDirectoryRecursivelyImpl(const char *path) = 0;
virtual Result DoCleanDirectoryRecursively(const char *path) = 0;
virtual Result GetFileTimeStampRawImpl(fs::FileTimeStampRaw *out, const char *path) {
virtual Result DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const char *path) {
return fs::ResultNotImplemented();
}
virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) {
virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) {
return fs::ResultNotImplemented();
}
/* These aren't accessible as commands. */
virtual Result CommitProvisionallyImpl(s64 counter) {
virtual Result DoCommitProvisionally(s64 counter) {
return fs::ResultNotImplemented();
}
virtual Result RollbackImpl() {
virtual Result DoRollback() {
return fs::ResultNotImplemented();
}
virtual Result FlushImpl() {
virtual Result DoFlush() {
return fs::ResultNotImplemented();
}
};

View file

@ -46,19 +46,19 @@ namespace ams::fssystem {
Result CopySaveFromFileSystem(fs::fsa::IFileSystem *save_fs);
public:
/* Overridden from IPathResolutionFileSystem */
virtual Result OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override;
virtual Result CommitImpl() override;
virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override;
virtual Result DoCommit() override;
/* Overridden from IPathResolutionFileSystem but not commands. */
virtual Result CommitProvisionallyImpl(s64 counter) override;
virtual Result RollbackImpl() override;
virtual Result DoCommitProvisionally(s64 counter) override;
virtual Result DoRollback() override;
/* Explicitly overridden to be not implemented. */
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) override;
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) override;
virtual Result GetFileTimeStampRawImpl(fs::FileTimeStampRaw *out, const char *path) override;
virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) override;
virtual Result FlushImpl() override;
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) override;
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) override;
virtual Result DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const char *path) override;
virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) override;
virtual Result DoFlush() override;
};
}

View file

@ -49,21 +49,21 @@ namespace ams::fssystem {
Result GetFileBaseOffset(s64 *out_offset, const char *path);
virtual Result CreateFileImpl(const char *path, s64 size, int option) override;
virtual Result DeleteFileImpl(const char *path) override;
virtual Result CreateDirectoryImpl(const char *path) override;
virtual Result DeleteDirectoryImpl(const char *path) override;
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override;
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override;
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override;
virtual Result GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) override;
virtual Result OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override;
virtual Result OpenDirectoryImpl(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override;
virtual Result CommitImpl() override;
virtual Result CleanDirectoryRecursivelyImpl(const char *path) override;
virtual Result DoCreateFile(const char *path, s64 size, int option) override;
virtual Result DoDeleteFile(const char *path) override;
virtual Result DoCreateDirectory(const char *path) override;
virtual Result DoDeleteDirectory(const char *path) override;
virtual Result DoDeleteDirectoryRecursively(const char *path) override;
virtual Result DoRenameFile(const char *old_path, const char *new_path) override;
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override;
virtual Result DoGetEntryType(fs::DirectoryEntryType *out, const char *path) override;
virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override;
virtual Result DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override;
virtual Result DoCommit() override;
virtual Result DoCleanDirectoryRecursively(const char *path) override;
/* These aren't accessible as commands. */
virtual Result CommitProvisionallyImpl(s64 counter) override;
virtual Result DoCommitProvisionally(s64 counter) override;
};
using PartitionFileSystem = PartitionFileSystemCore<PartitionFileSystemMeta>;

View file

@ -50,22 +50,22 @@ namespace ams::fssystem {
RomFileTable *GetRomFileTable();
Result GetFileBaseOffset(s64 *out, const char *path);
public:
virtual Result CreateFileImpl(const char *path, s64 size, int flags) override;
virtual Result DeleteFileImpl(const char *path) override;
virtual Result CreateDirectoryImpl(const char *path) override;
virtual Result DeleteDirectoryImpl(const char *path) override;
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override;
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override;
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override;
virtual Result GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) override;
virtual Result OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override;
virtual Result OpenDirectoryImpl(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override;
virtual Result CommitImpl() override;
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) override;
virtual Result CleanDirectoryRecursivelyImpl(const char *path) override;
virtual Result DoCreateFile(const char *path, s64 size, int flags) override;
virtual Result DoDeleteFile(const char *path) override;
virtual Result DoCreateDirectory(const char *path) override;
virtual Result DoDeleteDirectory(const char *path) override;
virtual Result DoDeleteDirectoryRecursively(const char *path) override;
virtual Result DoRenameFile(const char *old_path, const char *new_path) override;
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override;
virtual Result DoGetEntryType(fs::DirectoryEntryType *out, const char *path) override;
virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override;
virtual Result DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override;
virtual Result DoCommit() override;
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) override;
virtual Result DoCleanDirectoryRecursively(const char *path) override;
/* These aren't accessible as commands. */
virtual Result CommitProvisionallyImpl(s64 counter) override;
virtual Result DoCommitProvisionally(s64 counter) override;
};
}

View file

@ -46,7 +46,7 @@ namespace ams::fssystem::impl {
return this->unc_preserved;
}
public:
virtual Result CreateFileImpl(const char *path, s64 size, int option) override {
virtual Result DoCreateFile(const char *path, s64 size, int option) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -54,7 +54,7 @@ namespace ams::fssystem::impl {
return this->base_fs->CreateFile(full_path, size, option);
}
virtual Result DeleteFileImpl(const char *path) override {
virtual Result DoDeleteFile(const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -62,7 +62,7 @@ namespace ams::fssystem::impl {
return this->base_fs->DeleteFile(full_path);
}
virtual Result CreateDirectoryImpl(const char *path) override {
virtual Result DoCreateDirectory(const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -70,7 +70,7 @@ namespace ams::fssystem::impl {
return this->base_fs->CreateDirectory(full_path);
}
virtual Result DeleteDirectoryImpl(const char *path) override {
virtual Result DoDeleteDirectory(const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -78,7 +78,7 @@ namespace ams::fssystem::impl {
return this->base_fs->DeleteDirectory(full_path);
}
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override {
virtual Result DoDeleteDirectoryRecursively(const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -86,7 +86,7 @@ namespace ams::fssystem::impl {
return this->base_fs->DeleteDirectoryRecursively(full_path);
}
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override {
virtual Result DoRenameFile(const char *old_path, const char *new_path) override {
char old_full_path[fs::EntryNameLengthMax + 1];
char new_full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(old_full_path, sizeof(old_full_path), old_path));
@ -96,7 +96,7 @@ namespace ams::fssystem::impl {
return this->base_fs->RenameFile(old_full_path, new_full_path);
}
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override {
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override {
char old_full_path[fs::EntryNameLengthMax + 1];
char new_full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(old_full_path, sizeof(old_full_path), old_path));
@ -106,7 +106,7 @@ namespace ams::fssystem::impl {
return this->base_fs->RenameDirectory(old_full_path, new_full_path);
}
virtual Result GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) override {
virtual Result DoGetEntryType(fs::DirectoryEntryType *out, const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -114,7 +114,7 @@ namespace ams::fssystem::impl {
return this->base_fs->GetEntryType(out, full_path);
}
virtual Result OpenFileImpl(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override {
virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const char *path, fs::OpenMode mode) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -122,7 +122,7 @@ namespace ams::fssystem::impl {
return this->base_fs->OpenFile(out_file, full_path, mode);
}
virtual Result OpenDirectoryImpl(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override {
virtual Result DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const char *path, fs::OpenDirectoryMode mode) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -130,12 +130,12 @@ namespace ams::fssystem::impl {
return this->base_fs->OpenDirectory(out_dir, full_path, mode);
}
virtual Result CommitImpl() override {
virtual Result DoCommit() override {
std::optional optional_lock = static_cast<Impl*>(this)->GetAccessorLock();
return this->base_fs->Commit();
}
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) override {
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -143,7 +143,7 @@ namespace ams::fssystem::impl {
return this->base_fs->GetFreeSpaceSize(out, full_path);
}
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) override {
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -151,7 +151,7 @@ namespace ams::fssystem::impl {
return this->base_fs->GetTotalSpaceSize(out, full_path);
}
virtual Result CleanDirectoryRecursivelyImpl(const char *path) override {
virtual Result DoCleanDirectoryRecursively(const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -159,7 +159,7 @@ namespace ams::fssystem::impl {
return this->base_fs->CleanDirectoryRecursively(full_path);
}
virtual Result GetFileTimeStampRawImpl(fs::FileTimeStampRaw *out, const char *path) override {
virtual Result DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -167,7 +167,7 @@ namespace ams::fssystem::impl {
return this->base_fs->GetFileTimeStampRaw(out, full_path);
}
virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) override {
virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) override {
char full_path[fs::EntryNameLengthMax + 1];
R_TRY(static_cast<Impl*>(this)->ResolveFullPath(full_path, sizeof(full_path), path));
@ -176,17 +176,17 @@ namespace ams::fssystem::impl {
}
/* These aren't accessible as commands. */
virtual Result CommitProvisionallyImpl(s64 counter) override {
virtual Result DoCommitProvisionally(s64 counter) override {
std::optional optional_lock = static_cast<Impl*>(this)->GetAccessorLock();
return this->base_fs->CommitProvisionally(counter);
}
virtual Result RollbackImpl() override {
virtual Result DoRollback() override {
std::optional optional_lock = static_cast<Impl*>(this)->GetAccessorLock();
return this->base_fs->Rollback();
}
virtual Result FlushImpl() override {
virtual Result DoFlush() override {
std::optional optional_lock = static_cast<Impl*>(this)->GetAccessorLock();
return this->base_fs->Flush();
}

View file

@ -96,59 +96,59 @@ namespace ams::fs {
class OpenFileOnlyFileSystem : public fsa::IFileSystem, public impl::Newable {
private:
virtual Result CommitImpl() override final {
virtual Result DoCommit() override final {
return ResultSuccess();
}
virtual Result OpenDirectoryImpl(std::unique_ptr<fsa::IDirectory> *out_dir, const char *path, OpenDirectoryMode mode) override final {
virtual Result DoOpenDirectory(std::unique_ptr<fsa::IDirectory> *out_dir, const char *path, OpenDirectoryMode mode) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result GetEntryTypeImpl(DirectoryEntryType *out, const char *path) override final {
virtual Result DoGetEntryType(DirectoryEntryType *out, const char *path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result CreateFileImpl(const char *path, s64 size, int flags) override final {
virtual Result DoCreateFile(const char *path, s64 size, int flags) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result DeleteFileImpl(const char *path) override final {
virtual Result DoDeleteFile(const char *path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result CreateDirectoryImpl(const char *path) override final {
virtual Result DoCreateDirectory(const char *path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result DeleteDirectoryImpl(const char *path) override final {
virtual Result DoDeleteDirectory(const char *path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override final {
virtual Result DoDeleteDirectoryRecursively(const char *path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override final {
virtual Result DoRenameFile(const char *old_path, const char *new_path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override final {
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result CleanDirectoryRecursivelyImpl(const char *path) override final {
virtual Result DoCleanDirectoryRecursively(const char *path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) override final {
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) override final {
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) override final {
return fs::ResultUnsupportedOperation();
}
virtual Result CommitProvisionallyImpl(s64 counter) override final {
virtual Result DoCommitProvisionally(s64 counter) override final {
return fs::ResultUnsupportedOperation();
}
};
@ -201,7 +201,7 @@ namespace ams::fs {
return has_file;
}
virtual Result OpenFileImpl(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final {
virtual Result DoOpenFile(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final {
/* Only allow opening files with mode = read. */
R_UNLESS((mode & fs::OpenMode_All) == fs::OpenMode_Read, fs::ResultInvalidOpenMode());
@ -248,7 +248,7 @@ namespace ams::fs {
return ResultSuccess();
}
private:
virtual Result OpenFileImpl(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final {
virtual Result DoOpenFile(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final {
/* Ensure that we're initialized. */
R_UNLESS(this->initialized, fs::ResultNotInitialized());

View file

@ -199,7 +199,7 @@ namespace ams::fs {
return this->parent->GetBaseStorage();
}
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 {
size_t read_size = 0;
R_TRY(this->VerifyArguments(std::addressof(read_size), offset, buffer, size, option));
@ -209,24 +209,24 @@ namespace ams::fs {
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 {
return fs::ResultUnsupportedOperationInRomFsFileA();
}
virtual Result SetSizeImpl(s64 size) override {
virtual Result DoSetSize(s64 size) override {
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 OperationId::InvalidateCache:
case OperationId::QueryRange:
@ -263,16 +263,16 @@ namespace ams::fs {
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, DirectoryEntry *out_entries, s64 max_entries) {
return this->ReadImpl(out_count, std::addressof(this->current_find), out_entries, max_entries);
virtual Result DoRead(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) {
return this->ReadInternal(out_count, std::addressof(this->current_find), out_entries, max_entries);
}
virtual Result GetEntryCountImpl(s64 *out) {
virtual Result DoGetEntryCount(s64 *out) {
FindPosition find = this->first_find;
return this->ReadImpl(out, std::addressof(find), nullptr, 0);
return this->ReadInternal(out, std::addressof(find), nullptr, 0);
}
private:
Result ReadImpl(s64 *out_count, FindPosition *find, DirectoryEntry *out_entries, s64 max_entries) {
Result ReadInternal(s64 *out_count, FindPosition *find, DirectoryEntry *out_entries, s64 max_entries) {
AMS_ASSERT(out_count != nullptr);
AMS_ASSERT(find != nullptr);
@ -440,35 +440,35 @@ namespace ams::fs {
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) {
RomDirectoryInfo dir_info;
R_TRY_CATCH(this->rom_file_table.GetDirectoryInformation(std::addressof(dir_info), path)) {
R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound())
@ -484,7 +484,7 @@ namespace ams::fs {
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) {
AMS_ASSERT(out_file != nullptr);
AMS_ASSERT(path != nullptr);
@ -500,7 +500,7 @@ namespace ams::fs {
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) {
AMS_ASSERT(out_dir != nullptr);
AMS_ASSERT(path != nullptr);
@ -517,28 +517,28 @@ namespace ams::fs {
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::GetTotalSpaceSizeImpl(s64 *out, const char *path) {
Result RomFsFileSystem::DoGetTotalSpaceSize(s64 *out, const char *path) {
return fs::ResultUnsupportedOperationInRomFsFileSystemC();
}
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();
}
Result RomFsFileSystem::RollbackImpl() {
Result RomFsFileSystem::DoRollback() {
return ResultSuccess();
}
}

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();
}

View file

@ -27,66 +27,66 @@ namespace ams::mitm::fs {
virtual ~ReadOnlyLayeredFileSystem() { /* ... */ }
private:
virtual Result CreateFileImpl(const char *path, s64 size, int flags) override final {
virtual Result DoCreateFile(const char *path, s64 size, int flags) override final {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DeleteFileImpl(const char *path) override final {
virtual Result DoDeleteFile(const char *path) override final {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result CreateDirectoryImpl(const char *path) override final {
virtual Result DoCreateDirectory(const char *path) override final {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DeleteDirectoryImpl(const char *path) override final {
virtual Result DoDeleteDirectory(const char *path) override final {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override final {
virtual Result DoDeleteDirectoryRecursively(const char *path) override final {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result RenameFileImpl(const char *old_path, const char *new_path) override final {
virtual Result DoRenameFile(const char *old_path, const char *new_path) override final {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override final {
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override final {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result GetEntryTypeImpl(ams::fs::DirectoryEntryType *out, const char *path) override final {
virtual Result DoGetEntryType(ams::fs::DirectoryEntryType *out, const char *path) override final {
R_UNLESS(R_FAILED(this->fs_1.GetEntryType(out, path)), ResultSuccess());
return this->fs_2.GetEntryType(out, path);
}
virtual Result OpenFileImpl(std::unique_ptr<ams::fs::fsa::IFile> *out_file, const char *path, ams::fs::OpenMode mode) override final {
virtual Result DoOpenFile(std::unique_ptr<ams::fs::fsa::IFile> *out_file, const char *path, ams::fs::OpenMode mode) override final {
R_UNLESS(R_FAILED(this->fs_1.OpenFile(out_file, path, mode)), ResultSuccess());
return this->fs_2.OpenFile(out_file, path, mode);
}
virtual Result OpenDirectoryImpl(std::unique_ptr<ams::fs::fsa::IDirectory> *out_dir, const char *path, ams::fs::OpenDirectoryMode mode) override final {
virtual Result DoOpenDirectory(std::unique_ptr<ams::fs::fsa::IDirectory> *out_dir, const char *path, ams::fs::OpenDirectoryMode mode) override final {
R_UNLESS(R_FAILED(this->fs_1.OpenDirectory(out_dir, path, mode)), ResultSuccess());
return this->fs_2.OpenDirectory(out_dir, path, mode);
}
virtual Result CommitImpl() override final {
virtual Result DoCommit() override final {
return ResultSuccess();
}
virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) {
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) {
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result CleanDirectoryRecursivelyImpl(const char *path) {
virtual Result DoCleanDirectoryRecursively(const char *path) {
return ams::fs::ResultUnsupportedOperation();
}
virtual Result GetFileTimeStampRawImpl(ams::fs::FileTimeStampRaw *out, const char *path) {
virtual Result DoGetFileTimeStampRaw(ams::fs::FileTimeStampRaw *out, const char *path) {
R_UNLESS(R_FAILED(this->fs_1.GetFileTimeStampRaw(out, path)), ResultSuccess());
return this->fs_2.GetFileTimeStampRaw(out, path);
}