[ox/fs] Enforce error checking of FS function calls

This commit is contained in:
2019-06-22 02:07:20 -05:00
parent 6a5b16c644
commit 74fe0c55cc
6 changed files with 89 additions and 89 deletions

View File

@ -31,30 +31,30 @@ class PassThroughFS: public FileSystem {
[[nodiscard]] std::string basePath();
Error mkdir(const char *path, bool recursive = false) override;
ox::Error mkdir(const char *path, bool recursive = false) override;
Error move(const char *src, const char *dest) override;
ox::Error move(const char *src, const char *dest) override;
Error read(const char *path, void *buffer, std::size_t buffSize) override;
ox::Error read(const char *path, void *buffer, std::size_t buffSize) override;
Error read(uint64_t inode, void *buffer, std::size_t size) override;
ox::Error read(uint64_t inode, void *buffer, std::size_t size) override;
Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) override;
ox::Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) override;
template<typename F>
Error ls(const char *dir, F cb);
ox::Error ls(const char *dir, F cb);
Error remove(const char *path, bool recursive = false) override;
ox::Error remove(const char *path, bool recursive = false) override;
void resize(uint64_t size, void *buffer = nullptr) override;
ox::Error resize(uint64_t size, void *buffer = nullptr) override;
Error write(const char *path, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override;
ox::Error write(const char *path, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override;
Error write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override;
ox::Error write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override;
ValErr<FileStat> stat(uint64_t inode) override;
ox::ValErr<FileStat> stat(uint64_t inode) override;
ValErr<FileStat> stat(const char *path) override;
ox::ValErr<FileStat> stat(const char *path) override;
uint64_t spaceNeeded(uint64_t size) override;
@ -64,7 +64,7 @@ class PassThroughFS: public FileSystem {
uint8_t *buff() override;
Error walk(Error(*cb)(uint8_t, uint64_t, uint64_t)) override;
ox::Error walk(Error(*cb)(uint8_t, uint64_t, uint64_t)) override;
bool valid() const override;
@ -77,7 +77,7 @@ class PassThroughFS: public FileSystem {
};
template<typename F>
Error PassThroughFS::ls(const char *dir, F cb) {
ox::Error PassThroughFS::ls(const char *dir, F cb) {
for (auto &p : std::filesystem::directory_iterator(m_path / stripSlash(dir))) {
if (auto err = cb(p.path().filename().c_str(), 0); err) {
return err;