fsa: *Impl -> Do*
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user