[ox] Add a new oxfs tool
This commit is contained in:
6
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
6
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
@@ -41,9 +41,9 @@ struct OX_PACKED DirectoryEntry {
|
||||
LittleEndian<InodeId_t> m_bufferSize = sizeof(DirectoryEntry);
|
||||
|
||||
public:
|
||||
DirectoryEntry() = default;
|
||||
constexpr DirectoryEntry() noexcept = default;
|
||||
|
||||
Error init(InodeId_t inode, const char *name, InodeId_t bufferSize) {
|
||||
Error init(InodeId_t inode, const char *name, InodeId_t bufferSize) noexcept {
|
||||
m_bufferSize = bufferSize;
|
||||
auto d = data();
|
||||
if (d.valid()) {
|
||||
@@ -54,7 +54,7 @@ struct OX_PACKED DirectoryEntry {
|
||||
return OxError(1);
|
||||
}
|
||||
|
||||
ptrarith::Ptr<DirectoryEntryData, InodeId_t> data() {
|
||||
ptrarith::Ptr<DirectoryEntryData, InodeId_t> data() noexcept {
|
||||
oxTracef("ox::fs::DirectoryEntry::data", "{} {} {}", this->fullSize(), sizeof(*this), this->size());
|
||||
return ptrarith::Ptr<DirectoryEntryData, InodeId_t>(this, this->fullSize(), sizeof(*this), this->size(), this->size());
|
||||
}
|
||||
|
@@ -28,11 +28,9 @@ class FileAddress {
|
||||
|
||||
public:
|
||||
static constexpr auto TypeName = "net.drinkingtea.ox.FileAddress";
|
||||
static constexpr auto Fields = 2;
|
||||
|
||||
union Data {
|
||||
static constexpr auto TypeName = "net.drinkingtea.ox.FileAddress.Data";
|
||||
static constexpr auto Fields = 3;
|
||||
char *path = nullptr;
|
||||
const char *constPath;
|
||||
uint64_t inode;
|
||||
|
8
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
8
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
@@ -18,6 +18,12 @@
|
||||
|
||||
namespace ox {
|
||||
|
||||
namespace detail {
|
||||
static inline void fsBuffFree(char *buff) noexcept {
|
||||
delete buff;
|
||||
}
|
||||
}
|
||||
|
||||
class FileSystem {
|
||||
|
||||
public:
|
||||
@@ -111,7 +117,7 @@ class FileSystemTemplate: public FileSystem {
|
||||
public:
|
||||
FileSystemTemplate() noexcept = default;
|
||||
|
||||
FileSystemTemplate(void *buffer, uint64_t bufferSize, void(*freeBuffer)(char*) = [](const char *buff) { delete buff; }) noexcept;
|
||||
FileSystemTemplate(void *buffer, uint64_t bufferSize, void(*freeBuffer)(char*) = detail::fsBuffFree) noexcept;
|
||||
|
||||
explicit FileSystemTemplate(FileStore fs) noexcept;
|
||||
|
||||
|
Reference in New Issue
Block a user