[ox/fs] More cleanup and bug fix from previous cleanup

This commit is contained in:
2024-09-13 23:32:13 -05:00
parent 702b166b8d
commit 2a58490521
7 changed files with 21 additions and 15 deletions

View File

@ -44,6 +44,7 @@ struct OX_PACKED DirectoryEntry {
constexpr DirectoryEntry() noexcept = default;
Error init(InodeId_t inode, ox::CRStringView name, size_t bufferSize) noexcept {
oxTracef("ox.fs.DirectoryEntry.init", "inode: {}, name: {}, bufferSize: {}", inode, name, bufferSize);
m_bufferSize = static_cast<InodeId_t>(bufferSize);
auto d = data();
if (d.valid()) {
@ -190,10 +191,10 @@ template<typename FileStore, typename InodeId_t>
Error Directory<FileStore, InodeId_t>::write(PathIterator path, uint64_t inode64) noexcept {
const auto inode = static_cast<InodeId_t>(inode64);
ox::StringView name;
oxReturnError(path.next(name));
if (path.next().hasNext()) { // not yet at target directory, recurse to next one
oxTracef("ox.fs.Directory.write", "Attempting to write to next sub-Directory: {} of {}",
name, path.fullPath());
oxReturnError(path.get(name));
oxRequire(nextChild, findEntry(name));
oxTracef("ox.fs.Directory.write", "{}: {}", name, nextChild);
if (nextChild) {
@ -204,6 +205,7 @@ Error Directory<FileStore, InodeId_t>::write(PathIterator path, uint64_t inode64
}
} else {
oxTrace("ox.fs.Directory.write", path.fullPath());
oxReturnError(path.next(name));
// insert the new entry on this directory
// get the name
// find existing version of directory