This commit is contained in:
parent
91a7129f8f
commit
125a235dd1
27
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
27
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
@ -20,7 +20,7 @@
|
||||
namespace ox {
|
||||
|
||||
namespace detail {
|
||||
static inline void fsBuffFree(char *buff) noexcept {
|
||||
inline void fsBuffFree(char *buff) noexcept {
|
||||
safeDelete(buff);
|
||||
}
|
||||
}
|
||||
@ -49,11 +49,11 @@ class FileSystem {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -69,8 +69,7 @@ class FileSystem {
|
||||
* @param path
|
||||
* @param readStart
|
||||
* @param readSize
|
||||
* @param buffer
|
||||
* @param size
|
||||
* @param buff
|
||||
* @return error or number of bytes 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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
inline Result<FileStat> stat(uint64_t inode) const noexcept {
|
||||
Result<FileStat> stat(uint64_t inode) const noexcept {
|
||||
return statInode(inode);
|
||||
}
|
||||
|
||||
inline Result<FileStat> stat(StringViewCR path) const noexcept {
|
||||
Result<FileStat> stat(StringViewCR path) const noexcept {
|
||||
return statPath(path);
|
||||
}
|
||||
|
||||
Result<FileStat> stat(const FileAddress &addr) const noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
inline bool exists(uint64_t inode) const noexcept {
|
||||
bool exists(uint64_t inode) const noexcept {
|
||||
return statInode(inode).ok();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
inline bool exists(ox::StringView path) const noexcept {
|
||||
bool exists(ox::StringView path) const noexcept {
|
||||
return statPath(path).ok();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
inline bool exists(FileAddress const&addr) const noexcept {
|
||||
bool exists(FileAddress const&addr) const noexcept {
|
||||
return stat(addr).ok();
|
||||
}
|
||||
|
||||
@ -178,11 +177,11 @@ class MemFS: public FileSystem {
|
||||
public:
|
||||
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);
|
||||
}
|
||||
|
||||
inline Result<const char*> directAccess(uint64_t inode) const noexcept {
|
||||
Result<const char*> directAccess(uint64_t inode) const noexcept {
|
||||
return directAccessInode(inode);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user