[ox/fs] Cleanup
All checks were successful
Build / build (push) Successful in 1m26s

This commit is contained in:
Gary Talent 2025-04-02 01:29:02 -05:00
parent 91a7129f8f
commit 125a235dd1

View File

@ -20,7 +20,7 @@
namespace ox { namespace ox {
namespace detail { namespace detail {
static inline void fsBuffFree(char *buff) noexcept { inline void fsBuffFree(char *buff) noexcept {
safeDelete(buff); safeDelete(buff);
} }
} }
@ -49,11 +49,11 @@ class FileSystem {
Result<Buffer> read(StringViewCR path) noexcept; Result<Buffer> read(StringViewCR path) noexcept;
inline Error read(StringViewCR path, void *buffer, std::size_t buffSize) noexcept { Error read(StringViewCR path, void *buffer, std::size_t buffSize) noexcept {
return readFilePath(path, buffer, buffSize); return readFilePath(path, buffer, buffSize);
} }
inline Error read(uint64_t inode, void *buffer, std::size_t buffSize) noexcept { Error read(uint64_t inode, void *buffer, std::size_t buffSize) noexcept {
return readFileInode(inode, buffer, buffSize); return readFileInode(inode, buffer, buffSize);
} }
@ -69,8 +69,7 @@ class FileSystem {
* @param path * @param path
* @param readStart * @param readStart
* @param readSize * @param readSize
* @param buffer * @param buff
* @param size
* @return error or number of bytes read * @return error or number of bytes read
*/ */
Result<size_t> read( Result<size_t> read(
@ -102,36 +101,36 @@ class FileSystem {
Error write(const FileAddress &addr, const void *buffer, uint64_t size, FileType fileType = FileType::NormalFile) noexcept; Error write(const FileAddress &addr, const void *buffer, uint64_t size, FileType fileType = FileType::NormalFile) noexcept;
inline Error write(StringViewCR path, const void *buffer, uint64_t size, FileType fileType) noexcept { Error write(StringViewCR path, const void *buffer, uint64_t size, FileType fileType) noexcept {
return writeFilePath(path, buffer, size, fileType); return writeFilePath(path, buffer, size, fileType);
} }
inline Error write(uint64_t inode, const void *buffer, uint64_t size, FileType fileType) noexcept { Error write(uint64_t inode, const void *buffer, uint64_t size, FileType fileType) noexcept {
return writeFileInode(inode, buffer, size, fileType); return writeFileInode(inode, buffer, size, fileType);
} }
inline Result<FileStat> stat(uint64_t inode) const noexcept { Result<FileStat> stat(uint64_t inode) const noexcept {
return statInode(inode); return statInode(inode);
} }
inline Result<FileStat> stat(StringViewCR path) const noexcept { Result<FileStat> stat(StringViewCR path) const noexcept {
return statPath(path); return statPath(path);
} }
Result<FileStat> stat(const FileAddress &addr) const noexcept; Result<FileStat> stat(const FileAddress &addr) const noexcept;
[[nodiscard]] [[nodiscard]]
inline bool exists(uint64_t inode) const noexcept { bool exists(uint64_t inode) const noexcept {
return statInode(inode).ok(); return statInode(inode).ok();
} }
[[nodiscard]] [[nodiscard]]
inline bool exists(ox::StringView path) const noexcept { bool exists(ox::StringView path) const noexcept {
return statPath(path).ok(); return statPath(path).ok();
} }
[[nodiscard]] [[nodiscard]]
inline bool exists(FileAddress const&addr) const noexcept { bool exists(FileAddress const&addr) const noexcept {
return stat(addr).ok(); return stat(addr).ok();
} }
@ -178,11 +177,11 @@ class MemFS: public FileSystem {
public: public:
Result<const char*> directAccess(const FileAddress &addr) const noexcept; Result<const char*> directAccess(const FileAddress &addr) const noexcept;
inline Result<const char*> directAccess(StringViewCR path) const noexcept { Result<const char*> directAccess(StringViewCR path) const noexcept {
return directAccessPath(path); return directAccessPath(path);
} }
inline Result<const char*> directAccess(uint64_t inode) const noexcept { Result<const char*> directAccess(uint64_t inode) const noexcept {
return directAccessInode(inode); return directAccessInode(inode);
} }