From 324e28e5f288815171abf2947eeff0e935d6ae78 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 30 Jul 2018 21:35:36 -0500 Subject: [PATCH] [ox/fs] Update FileStore interface --- deps/ox/src/ox/fs/filestore/filestore.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/deps/ox/src/ox/fs/filestore/filestore.hpp b/deps/ox/src/ox/fs/filestore/filestore.hpp index bc12b5d9..946f78dd 100644 --- a/deps/ox/src/ox/fs/filestore/filestore.hpp +++ b/deps/ox/src/ox/fs/filestore/filestore.hpp @@ -35,16 +35,23 @@ class FileStore { virtual Error write(InodeId_t id, void *data, FsSize_t dataLen, uint8_t fileType = 0) = 0; - virtual Error read(InodeId_t id, void *data, FsSize_t dataSize, FsSize_t *size) = 0; + /** + * @return error if the inode could not be removed or did not exist + */ + virtual Error remove(InodeId_t id) = 0; - virtual Error read(InodeId_t id, FsSize_t readStart, FsSize_t readSize, void *data, FsSize_t *size) = 0; + virtual Error read(InodeId_t id, void *data, FsSize_t dataSize, FsSize_t *size = nullptr) = 0; + + virtual Error read(InodeId_t id, FsSize_t readStart, FsSize_t readSize, void *data, FsSize_t *size = nullptr) = 0; /** * @return data section of the requested file */ virtual const ptrarith::Ptr read(InodeId_t id) = 0; - virtual StatInfo stat(InodeId_t id) = 0; + virtual ValErr stat(InodeId_t id) = 0; + + virtual Error resize(std::size_t size, void *newBuff = nullptr) = 0; virtual InodeId_t spaceNeeded(FsSize_t size) = 0; @@ -52,6 +59,8 @@ class FileStore { virtual InodeId_t available() = 0; + virtual ValErr generateInodeId() = 0; + }; }