diff --git a/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp b/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp index 0aa4d49b..1a2e2585 100644 --- a/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp +++ b/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp @@ -204,12 +204,12 @@ Error FileStoreTemplate::format(void *buffer, std::size_t bufferSize) { auto nb = new (buffer) Buffer(static_cast(bufferSize)); auto fsData = nb->malloc(sizeof(FileStoreData)).value; if (!fsData.valid()) { - oxTrace("ox::fs::FileStoreTemplate::format::fail", "Could not read data section of FileStoreData"); + oxTrace("ox.fs.FileStoreTemplate.format.fail", "Could not read data section of FileStoreData"); return OxError(1, "Could not read data section of FileStoreData"); } auto data = nb->template dataOf(fsData); if (!data.valid()) { - oxTrace("ox::fs::FileStoreTemplate::format::fail", "Could not read data section of FileStoreData"); + oxTrace("ox.fs.FileStoreTemplate.format.fail", "Could not read data section of FileStoreData"); return OxError(1, "Could not read data section of FileStoreData"); } new (data) FileStoreData; @@ -244,7 +244,7 @@ Error FileStoreTemplate::decLinks(uint64_t id) { template Error FileStoreTemplate::write(uint64_t id64, const void *data, FsSize_t dataSize, uint8_t fileType) { const auto id = static_cast(id64); - oxTracef("ox::fs::FileStoreTemplate::write", "Attempting to write to inode {}", id); + oxTracef("ox.fs.FileStoreTemplate.write", "Attempting to write to inode {}", id); auto existing = find(id); if (!canWrite(existing, dataSize)) { oxReturnError(compact()); @@ -254,10 +254,10 @@ Error FileStoreTemplate::write(uint64_t id64, const void *data, FsSize_t if (canWrite(existing, dataSize)) { // delete the old node if it exists if (existing.valid()) { - oxTracef("ox::fs::FileStoreTemplate::write", "Freeing old version of inode found at offset: {}", existing.offset()); + oxTracef("ox.fs.FileStoreTemplate.write", "Freeing old version of inode found at offset: {}", existing.offset()); auto err = m_buffer->free(existing); if (err) { - oxTrace("ox::fs::FileStoreTemplate::write::fail", "Free of old version of inode failed"); + oxTrace("ox.fs.FileStoreTemplate.write.fail", "Free of old version of inode failed"); return err; } existing = nullptr; @@ -266,12 +266,12 @@ Error FileStoreTemplate::write(uint64_t id64, const void *data, FsSize_t auto dest = m_buffer->malloc(dataSize).value; // if first malloc failed, compact and try again if (!dest.valid()) { - oxTrace("ox::fs::FileStoreTemplate::write", "Allocation failed, compacting"); + oxTrace("ox.fs.FileStoreTemplate.write", "Allocation failed, compacting"); oxReturnError(compact()); dest = m_buffer->malloc(dataSize).value; } if (dest.valid()) { - oxTrace("ox::fs::FileStoreTemplate::write", "Memory allocated"); + oxTrace("ox.fs.FileStoreTemplate.write", "Memory allocated"); dest->id = id; dest->fileType = fileType; auto destData = m_buffer->template dataOf(dest); @@ -280,26 +280,26 @@ Error FileStoreTemplate::write(uint64_t id64, const void *data, FsSize_t // write data if any was provided if (data != nullptr) { ox_memcpy(destData, data, dest->size()); - oxTrace("ox::fs::FileStoreTemplate::write", "Data written"); + oxTrace("ox.fs.FileStoreTemplate.write", "Data written"); } auto fsData = fileStoreData(); if (fsData) { - oxTracef("ox::fs::FileStoreTemplate::write", "Searching for root node at {}", fsData->rootNode.get()); + oxTracef("ox.fs.FileStoreTemplate.write", "Searching for root node at {}", fsData->rootNode.get()); auto root = m_buffer->ptr(fsData->rootNode); if (root.valid()) { - oxTracef("ox::fs::FileStoreTemplate::write", + oxTracef("ox.fs.FileStoreTemplate.write", "Placing {} on {} at {}", dest->id.get(), root->id.get(), destData.offset()); return placeItem(dest); } else { - oxTracef("ox::fs::FileStoreTemplate::write", + oxTracef("ox.fs.FileStoreTemplate.write", "Initializing root inode: {} (offset: {}, data size: {})", dest->id.get(), dest.offset(), destData.size()); fsData->rootNode = dest.offset(); - oxTracef("ox::fs::FileStoreTemplate::write", "Root inode: {}", dest->id.get()); + oxTracef("ox.fs.FileStoreTemplate.write", "Root inode: {}", dest->id.get()); return OxError(0); } } else { - oxTrace("ox::fs::FileStoreTemplate::write::fail", "Could not place item due to absence of FileStore header."); + oxTrace("ox.fs.FileStoreTemplate.write.fail", "Could not place item due to absence of FileStore header."); } } } @@ -315,23 +315,23 @@ Error FileStoreTemplate::remove(uint64_t id) { template Error FileStoreTemplate::read(uint64_t id, void *out, FsSize_t outSize, FsSize_t *size) const { - oxTracef("ox::fs::FileStoreTemplate::read", "Attempting to read from inode {}", id); + oxTracef("ox.fs.FileStoreTemplate.read", "Attempting to read from inode {}", id); auto src = find(static_cast(id)); // error check if (!src.valid()) { - oxTracef("ox::fs::FileStoreTemplate::read::fail", "Could not find requested item: {}", id); + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Could not find requested item: {}", id); return OxError(1, "Could not find requested item"); } auto srcData = m_buffer->template dataOf(src); - oxTracef("ox::fs::FileStoreTemplate::read::found", "{} found at {} with data section at {}", + oxTracef("ox.fs.FileStoreTemplate.read.found", "{} found at {} with data section at {}", id, src.offset(), srcData.offset()); - oxTracef("ox::fs::FileStoreTemplate::read::outSize", "{} {} {}", srcData.offset(), srcData.size(), outSize); + oxTracef("ox.fs.FileStoreTemplate.read.outSize", "{} {} {}", srcData.offset(), srcData.size(), outSize); // error check if (!(srcData.valid() && srcData.size() <= outSize)) { - oxTracef("ox::fs::FileStoreTemplate::read::fail", "Could not read data section of item: {}", id); - oxTracef("ox::fs::FileStoreTemplate::read::fail", + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Could not read data section of item: {}", id); + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Item data section size: {}, Expected size: {}", srcData.size(), outSize); return OxError(1); } @@ -346,23 +346,23 @@ Error FileStoreTemplate::read(uint64_t id, void *out, FsSize_t outSize, template Error FileStoreTemplate::read(uint64_t id, FsSize_t readStart, FsSize_t readSize, void *out, FsSize_t *size) const { - oxTracef("ox::fs::FileStoreTemplate::read", "Attempting to read from inode {}", id); + oxTracef("ox.fs.FileStoreTemplate.read", "Attempting to read from inode {}", id); auto src = find(static_cast(id)); // error check if (!src.valid()) { - oxTracef("ox::fs::FileStoreTemplate::read::fail", "Could not find requested item: {}", id); + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Could not find requested item: {}", id); return OxError(1); } auto srcData = m_buffer->template dataOf(src); - oxTracef("ox::fs::FileStoreTemplate::read::found", "{} found at {} with data section at {}", + oxTracef("ox.fs.FileStoreTemplate.read.found", "{} found at {} with data section at {}", id, src.offset(), srcData.offset()); - oxTracef("ox::fs::FileStoreTemplate::read::readSize", "{} {} {}", srcData.offset(), srcData.size(), readSize); + oxTracef("ox.fs.FileStoreTemplate.read.readSize", "{} {} {}", srcData.offset(), srcData.size(), readSize); // error check if (!(srcData.valid() && srcData.size() - readStart <= readSize)) { - oxTracef("ox::fs::FileStoreTemplate::read::fail", "Could not read data section of item: {}", id); - oxTracef("ox::fs::FileStoreTemplate::read::fail", + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Could not read data section of item: {}", id); + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Item data section size: {}, Expected size: {}", srcData.size(), readSize); return OxError(1); } @@ -379,23 +379,23 @@ template template Error FileStoreTemplate::read(uint64_t id, FsSize_t readStart, FsSize_t readSize, T *out, FsSize_t *size) const { - oxTracef("ox::fs::FileStoreTemplate::read", "Attempting to read from inode {}", id); + oxTracef("ox.fs.FileStoreTemplate.read", "Attempting to read from inode {}", id); auto src = find(static_cast(id)); // error check if (!src.valid()) { - oxTracef("ox::fs::FileStoreTemplate::read::fail", "Could not find requested item: {}", id); + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Could not find requested item: {}", id); return OxError(1); } auto srcData = m_buffer->template dataOf(src); - oxTracef("ox::fs::FileStoreTemplate::read::found", "{} found at {} with data section at {}", + oxTracef("ox.fs.FileStoreTemplate.read.found", "{} found at {} with data section at {}", id, src.offset(), srcData.offset()); - oxTracef("ox::fs::FileStoreTemplate::read::readSize", "{} {} {}", srcData.offset(), srcData.size(), readSize); + oxTracef("ox.fs.FileStoreTemplate.read.readSize", "{} {} {}", srcData.offset(), srcData.size(), readSize); // error check if (!(srcData.valid() && srcData.size() - readStart <= readSize)) { - oxTracef("ox::fs::FileStoreTemplate::read::fail", "Could not read data section of item: {}", id); - oxTracef("ox::fs::FileStoreTemplate::read::fail", + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Could not read data section of item: {}", id); + oxTracef("ox.fs.FileStoreTemplate.read.fail", "Item data section size: {}, Expected size: {}", srcData.size(), readSize); return OxError(1); } @@ -422,9 +422,9 @@ template Error FileStoreTemplate::resize() { oxReturnError(compact()); const auto newSize = static_cast(size() - available()); - oxTracef("ox::fs::FileStoreTemplate::resize", "resize to: {}", newSize); + oxTracef("ox.fs.FileStoreTemplate.resize", "resize to: {}", newSize); oxReturnError(m_buffer->setSize(newSize)); - oxTracef("ox::fs::FileStoreTemplate::resize", "resized to: {}", m_buffer->size()); + oxTracef("ox.fs.FileStoreTemplate.resize", "resized to: {}", m_buffer->size()); return OxError(0); } @@ -506,7 +506,7 @@ Error FileStoreTemplate::compact() { if (!item.valid()) { return OxError(1); } - oxTracef("ox::fs::FileStoreTemplate::compact::moveItem", "Moving Item: {} from {} to {}", item->id.get(), oldAddr, item.offset()); + oxTracef("ox.fs.FileStoreTemplate.compact.moveItem", "Moving Item: {} from {} to {}", item->id.get(), oldAddr, item.offset()); // update rootInode if this is it auto fsData = fileStoreData(); if (fsData && oldAddr == fsData->rootNode) { @@ -549,7 +549,7 @@ Error FileStoreTemplate::placeItem(ItemPtr item) { fsData->rootNode = item; item->left = root->left; item->right = root->right; - oxTracef("ox::fs::FileStoreTemplate::placeItem", "Overwrote Root Item: {}", item->id.get()); + oxTracef("ox.fs.FileStoreTemplate.placeItem", "Overwrote Root Item: {}", item->id.get()); return OxError(0); } else { return placeItem(root, item); @@ -559,7 +559,7 @@ Error FileStoreTemplate::placeItem(ItemPtr item) { template Error FileStoreTemplate::placeItem(ItemPtr root, ItemPtr item, int depth) { if (depth > 5000) { - oxTrace("ox::fs::FileStoreTemplate::placeItem::fail", "Excessive recursion depth, stopping before stack overflow."); + oxTrace("ox.fs.FileStoreTemplate.placeItem.fail", "Excessive recursion depth, stopping before stack overflow."); return OxError(2); } if (item->id > root->id) { @@ -570,7 +570,7 @@ Error FileStoreTemplate::placeItem(ItemPtr root, ItemPtr item, int depth item->left = right->left; item->right = right->right; } - oxTracef("ox::fs::FileStoreTemplate::placeItem", "Placed Item: {}", item->id.get()); + oxTracef("ox.fs.FileStoreTemplate.placeItem", "Placed Item: {}", item->id.get()); return OxError(0); } else { return placeItem(right, item, depth + 1); @@ -583,13 +583,13 @@ Error FileStoreTemplate::placeItem(ItemPtr root, ItemPtr item, int depth item->left = left->left; item->right = left->right; } - oxTracef("ox::fs::FileStoreTemplate::placeItem", "Placed Item: {}", item->id.get()); + oxTracef("ox.fs.FileStoreTemplate.placeItem", "Placed Item: {}", item->id.get()); return OxError(0); } else { return placeItem(left, item, depth + 1); } } else { - oxTrace("ox::fs::FileStoreTemplate::placeItem::fail", "Cannot insert an item on itself."); + oxTrace("ox.fs.FileStoreTemplate.placeItem.fail", "Cannot insert an item on itself."); return OxError(1, "Cannot insert an item on itself."); } } @@ -631,14 +631,14 @@ Error FileStoreTemplate::unplaceItem(ItemPtr item) { template Error FileStoreTemplate::unplaceItem(ItemPtr root, ItemPtr item, int depth) { if (depth >= 5000) { - oxTrace("ox::fs::FileStoreTemplate::unplaceItem::fail", "Excessive recursion depth, stopping before stack overflow."); + oxTrace("ox.fs.FileStoreTemplate.unplaceItem.fail", "Excessive recursion depth, stopping before stack overflow."); return OxError(1, "Excessive recursion depth, stopping before stack overflow."); } if (item->id > root->id) { auto right = m_buffer->ptr(root->right); if (right->id == item->id) { root->right = 0; - oxTracef("ox::fs::FileStoreTemplate::unplaceItem", "Unplaced Item: {}", item->id.get()); + oxTracef("ox.fs.FileStoreTemplate.unplaceItem", "Unplaced Item: {}", item->id.get()); } else { return unplaceItem(right, item, depth + 1); } @@ -646,7 +646,7 @@ Error FileStoreTemplate::unplaceItem(ItemPtr root, ItemPtr item, int dep auto left = m_buffer->ptr(root->left); if (left->id == item->id) { root->left = 0; - oxTracef("ox::fs::FileStoreTemplate::unplaceItem", "Unplaced Item: {}", item->id.get()); + oxTracef("ox.fs.FileStoreTemplate.unplaceItem", "Unplaced Item: {}", item->id.get()); } else { return unplaceItem(left, item, depth + 1); } @@ -701,22 +701,22 @@ typename FileStoreTemplate::ItemPtr FileStoreTemplate::findParen template typename FileStoreTemplate::ItemPtr FileStoreTemplate::find(ItemPtr item, InodeId_t id, int depth) const { if (depth > 5000) { - oxTracef("ox::fs::FileStoreTemplate::find::fail", "Excessive recursion depth, stopping before stack overflow. Search for: {}", id); + oxTracef("ox.fs.FileStoreTemplate.find.fail", "Excessive recursion depth, stopping before stack overflow. Search for: {}", id); return nullptr; } if (!item.valid()) { - oxTrace("ox::fs::FileStoreTemplate::find::fail", "item invalid"); + oxTrace("ox.fs.FileStoreTemplate.find.fail", "item invalid"); return nullptr; } // do search if (id > item->id) { - oxTracef("ox::fs::FileStoreTemplate::find", "Not a match, searching on {}", item->right.get()); + oxTracef("ox.fs.FileStoreTemplate.find", "Not a match, searching on {}", item->right.get()); return find(m_buffer->ptr(item->right), id, depth + 1); } else if (id < item->id) { - oxTracef("ox::fs::FileStoreTemplate::find", "Not a match, searching on {}", item->left.get()); + oxTracef("ox.fs.FileStoreTemplate.find", "Not a match, searching on {}", item->left.get()); return find(m_buffer->ptr(item->left), id, depth + 1); } else if (id == item->id) { - oxTracef("ox::fs::FileStoreTemplate::find", "Found {} at {}", id, item.offset()); + oxTracef("ox.fs.FileStoreTemplate.find", "Found {} at {}", id, item.offset()); return item; } return nullptr; @@ -724,7 +724,7 @@ typename FileStoreTemplate::ItemPtr FileStoreTemplate::find(Item template typename FileStoreTemplate::ItemPtr FileStoreTemplate::find(InodeId_t id) const { - oxTracef("ox::fs::FileStoreTemplate::find", "Searching for inode: {}", id); + oxTracef("ox.fs.FileStoreTemplate.find", "Searching for inode: {}", id); auto fsData = fileStoreData(); if (fsData) { auto root = m_buffer->ptr(fsData->rootNode); @@ -732,10 +732,10 @@ typename FileStoreTemplate::ItemPtr FileStoreTemplate::find(Inod auto item = find(root, id); return item; } else { - oxTrace("ox::fs::FileStoreTemplate::find::fail", "No root node"); + oxTrace("ox.fs.FileStoreTemplate.find.fail", "No root node"); } } else { - oxTrace("ox::fs::FileStoreTemplate::find::fail", "No FileStore Data"); + oxTrace("ox.fs.FileStoreTemplate.find.fail", "No FileStore Data"); } return nullptr; } diff --git a/deps/ox/src/ox/fs/filesystem/directory.hpp b/deps/ox/src/ox/fs/filesystem/directory.hpp index 703db4a4..a692ebcc 100644 --- a/deps/ox/src/ox/fs/filesystem/directory.hpp +++ b/deps/ox/src/ox/fs/filesystem/directory.hpp @@ -55,7 +55,7 @@ struct OX_PACKED DirectoryEntry { } ptrarith::Ptr data() noexcept { - oxTracef("ox::fs::DirectoryEntry::data", "{} {} {}", this->fullSize(), sizeof(*this), this->size()); + oxTracef("ox.fs.DirectoryEntry.data", "{} {} {}", this->fullSize(), sizeof(*this), this->size()); return ptrarith::Ptr(this, this->fullSize(), sizeof(*this), this->size(), this->size()); } @@ -136,7 +136,7 @@ Directory::Directory(FileStore fs, uint64_t inodeId) noexc template Error Directory::init() noexcept { constexpr auto Size = sizeof(Buffer); - oxTracef("ox::fs::Directory::init", "Initializing Directory with Inode ID: {}", m_inodeId); + oxTracef("ox.fs.Directory.init", "Initializing Directory with Inode ID: {}", m_inodeId); oxReturnError(m_fs.write(m_inodeId, nullptr, Size, static_cast(FileType::Directory))); auto buff = m_fs.read(m_inodeId).template to(); if (!buff.valid()) { @@ -151,7 +151,7 @@ Error Directory::init() noexcept { template Error Directory::mkdir(PathIterator path, bool parents, FileName *nameBuff) { if (path.valid()) { - oxTrace("ox::fs::Directory::mkdir", path.fullPath()); + oxTrace("ox.fs.Directory.mkdir", path.fullPath()); // reuse nameBuff if it has already been allocated, as it is a rather large variable if (nameBuff == nullptr) { nameBuff = new (ox_alloca(sizeof(FileName))) FileName; @@ -168,7 +168,7 @@ Error Directory::mkdir(PathIterator path, bool parents, Fi return OxError(1); } childInode = m_fs.generateInodeId(); - oxTracef("ox::fs::Directory::mkdir", "Generated Inode ID: {}", childInode.value); + oxTracef("ox.fs.Directory.mkdir", "Generated Inode ID: {}", childInode.value); oxLogError(childInode.error); oxReturnError(childInode.error); @@ -204,33 +204,33 @@ Error Directory::write(PathIterator path, uint64_t inode64 if (path.next().hasNext()) { // not yet at target directory, recurse to next one oxReturnError(path.get(name)); - oxTracef("ox::fs::Directory::write", "Attempting to write to next sub-Directory: {} of {}", + oxTracef("ox.fs.Directory.write", "Attempting to write to next sub-Directory: {} of {}", *name, path.fullPath()); oxRequire(nextChild, findEntry(*name)); - oxTracef("ox::fs::Directory::write", "{}: {}", *name, nextChild); + oxTracef("ox.fs.Directory.write", "{}: {}", *name, nextChild); if (nextChild) { // reuse name because it is a rather large variable and will not be used again // be attentive that this remains true name = nullptr; return Directory(m_fs, nextChild).write(path.next(), inode, nameBuff); } else { - oxTracef("ox::fs::Directory::write", "{} not found and not allowed to create it.", *name); + oxTracef("ox.fs.Directory.write", "{} not found and not allowed to create it.", *name); return OxError(1, "File not found and not allowed to create it."); } } else { - oxTrace("ox::fs::Directory::write", path.fullPath()); + oxTrace("ox.fs.Directory.write", path.fullPath()); // insert the new entry on this directory // get the name oxReturnError(path.next(name)); // find existing version of directory - oxTracef("ox::fs::Directory::write", "Searching for directory inode {}", m_inodeId); + oxTracef("ox.fs.Directory.write", "Searching for directory inode {}", m_inodeId); oxRequire(oldStat, m_fs.stat(m_inodeId)); - oxTracef("ox::fs::Directory::write", "Found existing directory of size {}", oldStat.size); + oxTracef("ox.fs.Directory.write", "Found existing directory of size {}", oldStat.size); auto old = m_fs.read(m_inodeId).template to(); if (!old.valid()) { - oxTrace("ox::fs::Directory::write::fail", "Could not read existing version of Directory"); + oxTrace("ox.fs.Directory.write.fail", "Could not read existing version of Directory"); return OxError(1, "Could not read existing version of Directory"); } @@ -239,18 +239,18 @@ Error Directory::write(PathIterator path, uint64_t inode64 const auto newSize = oldStat.size + Buffer::spaceNeeded(entryDataSize); auto cpy = ox_malloca(newSize, Buffer, *old, oldStat.size); if (cpy == nullptr) { - oxTrace("ox::fs::Directory::write::fail", "Could not allocate memory for copy of Directory"); + oxTrace("ox.fs.Directory.write.fail", "Could not allocate memory for copy of Directory"); return OxError(1, "Could not allocate memory for copy of Directory"); } oxReturnError(cpy->setSize(newSize)); auto val = cpy->malloc(entryDataSize).value; if (!val.valid()) { - oxTrace("ox::fs::Directory::write::fail", "Could not allocate memory for new directory entry"); + oxTrace("ox.fs.Directory.write.fail", "Could not allocate memory for new directory entry"); return OxError(1, "Could not allocate memory for new directory entry"); } - oxTracef("ox::fs::Directory::write", "Attempting to write Directory entry: {}", name->data()); + oxTracef("ox.fs.Directory.write", "Attempting to write Directory entry: {}", name->data()); oxReturnError(val->init(inode, name->data(), val.size())); return m_fs.write(m_inodeId, cpy.get(), cpy->size(), static_cast(FileType::Directory)); } @@ -265,10 +265,10 @@ Error Directory::remove(PathIterator path, FileName *nameB auto &name = *nameBuff; oxReturnError(path.get(&name)); - oxTrace("ox::fs::Directory::remove", name); + oxTrace("ox.fs.Directory.remove", name); auto buff = m_fs.read(m_inodeId).template to(); if (buff.valid()) { - oxTrace("ox::fs::Directory::remove", "Found directory buffer."); + oxTrace("ox.fs.Directory.remove", "Found directory buffer."); for (auto i = buff->iterator(); i.valid(); i.next()) { auto data = i->data(); if (data.valid()) { @@ -276,11 +276,11 @@ Error Directory::remove(PathIterator path, FileName *nameB oxReturnError(buff->free(i)); } } else { - oxTrace("ox::fs::Directory::remove", "INVALID DIRECTORY ENTRY"); + oxTrace("ox.fs.Directory.remove", "INVALID DIRECTORY ENTRY"); } } } else { - oxTrace("ox::fs::Directory::remove::fail", "Could not find directory buffer"); + oxTrace("ox.fs.Directory.remove.fail", "Could not find directory buffer"); return OxError(1, "Could not find directory buffer"); } return OxError(0); @@ -289,20 +289,20 @@ Error Directory::remove(PathIterator path, FileName *nameB template template Error Directory::ls(F cb) noexcept { - oxTrace("ox::fs::Directory::ls"); + oxTrace("ox.fs.Directory.ls"); auto buff = m_fs.read(m_inodeId).template to(); if (!buff.valid()) { - oxTrace("ox::fs::Directory::ls::fail", "Could not directory buffer"); + oxTrace("ox.fs.Directory.ls.fail", "Could not directory buffer"); return OxError(1, "Could not directory buffer"); } - oxTrace("ox::fs::Directory::ls", "Found directory buffer."); + oxTrace("ox.fs.Directory.ls", "Found directory buffer."); for (auto i = buff->iterator(); i.valid(); i.next()) { auto data = i->data(); if (data.valid()) { oxReturnError(cb(data->name, data->inode)); } else { - oxTrace("ox::fs::Directory::ls", "INVALID DIRECTORY ENTRY"); + oxTrace("ox.fs.Directory.ls", "INVALID DIRECTORY ENTRY"); } } @@ -311,26 +311,26 @@ Error Directory::ls(F cb) noexcept { template Result Directory::findEntry(const FileName &name) const noexcept { - oxTrace("ox::fs::Directory::findEntry", name); + oxTrace("ox.fs.Directory.findEntry", name); auto buff = m_fs.read(m_inodeId).template to(); if (!buff.valid()) { - oxTrace("ox::fs::Directory::findEntry::fail", "Could not findEntry directory buffer"); + oxTrace("ox.fs.Directory.findEntry.fail", "Could not findEntry directory buffer"); return OxError(2, "Could not findEntry directory buffer"); } - oxTracef("ox::fs::Directory::findEntry", "Found directory buffer, size: {}", buff.size()); + oxTracef("ox.fs.Directory.findEntry", "Found directory buffer, size: {}", buff.size()); for (auto i = buff->iterator(); i.valid(); i.next()) { auto data = i->data(); if (data.valid()) { - oxTracef("ox::fs::Directory::findEntry", "Comparing \"{}\" to \"{}\"", name, data->name); + oxTracef("ox.fs.Directory.findEntry", "Comparing \"{}\" to \"{}\"", name, data->name); if (name == data->name) { - oxTracef("ox::fs::Directory::findEntry", "\"{}\" match found.", name); + oxTracef("ox.fs.Directory.findEntry", "\"{}\" match found.", name); return static_cast(data->inode); } } else { - oxTrace("ox::fs::Directory::findEntry") << "INVALID DIRECTORY ENTRY"; + oxTrace("ox.fs.Directory.findEntry") << "INVALID DIRECTORY ENTRY"; } } - oxTrace("ox::fs::Directory::findEntry::fail", "Entry not present"); + oxTrace("ox.fs.Directory.findEntry.fail", "Entry not present"); return OxError(1, "Entry not present"); } diff --git a/deps/ox/src/ox/fs/filesystem/filesystem.hpp b/deps/ox/src/ox/fs/filesystem/filesystem.hpp index 13fc2027..168d6e00 100644 --- a/deps/ox/src/ox/fs/filesystem/filesystem.hpp +++ b/deps/ox/src/ox/fs/filesystem/filesystem.hpp @@ -269,11 +269,11 @@ Error FileSystemTemplate::format(void *buff, uint64_t buff FileSystemData fd; fd.rootDirInode = rootDirInode; - oxTracef("ox::fs::FileSystemTemplate::format", "rootDirInode: {}", fd.rootDirInode.get()); + oxTracef("ox.fs.FileSystemTemplate.format", "rootDirInode: {}", fd.rootDirInode.get()); oxReturnError(fs.write(InodeFsData, &fd, sizeof(fd))); if (!fs.read(fd.rootDirInode).valid()) { - oxTrace("ox::fs::FileSystemTemplate::format::error", "FileSystemTemplate::format did not correctly create root directory"); + oxTrace("ox.fs.FileSystemTemplate.format.error", "FileSystemTemplate::format did not correctly create root directory"); return OxError(1); } @@ -282,7 +282,7 @@ Error FileSystemTemplate::format(void *buff, uint64_t buff template Error FileSystemTemplate::mkdir(CRStringView path, bool recursive) noexcept { - oxTracef("ox::fs::FileSystemTemplate::mkdir", "path: {}, recursive: {}", path, recursive); + oxTracef("ox.fs.FileSystemTemplate.mkdir", "path: {}, recursive: {}", path, recursive); oxRequireM(rootDir, this->rootDir()); return rootDir.mkdir(path, recursive); } @@ -352,7 +352,7 @@ Result> FileSystemTemplate::ls(CRStringView template template Error FileSystemTemplate::ls(CRStringView path, F cb) const { - oxTracef("ox::fs::FileSystemTemplate::ls", "path: {}", path); + oxTracef("ox.fs.FileSystemTemplate.ls", "path: {}", path); oxRequire(s, stat(path)); Directory dir(m_fs, s.inode); return dir.ls(cb); @@ -371,7 +371,7 @@ Error FileSystemTemplate::remove(CRStringView path, bool r return err; } } else { - oxTrace("FileSystemTemplate::remove::fail", "Tried to remove directory without recursive setting."); + oxTrace("FileSystemTemplate.remove.fail", "Tried to remove directory without recursive setting."); return OxError(1); } return OxError(0); diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp index bd088481..88dd0519 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp @@ -31,7 +31,7 @@ Error PassThroughFS::mkdir(CRStringView path, bool recursive) noexcept { bool success = false; const auto p = m_path / stripSlash(path); const auto u8p = p.u8string(); - oxTrace("ox::fs::PassThroughFS::mkdir", std::bit_cast(u8p.c_str())); + oxTrace("ox.fs.PassThroughFS.mkdir", std::bit_cast(u8p.c_str())); if (recursive) { std::error_code ec; const auto isDir = std::filesystem::is_directory(p, ec); @@ -98,10 +98,10 @@ Result PassThroughFS::statPath(CRStringView path) const noexcept { const auto p = m_path / stripSlash(path); const FileType type = std::filesystem::is_directory(p, ec) ? FileType::Directory : FileType::NormalFile; - oxTracef("ox::fs::PassThroughFS::statInode", "{} {}", ec.message(), path); + oxTracef("ox.fs.PassThroughFS.statInode", "{} {}", ec.message(), path); const uint64_t size = type == FileType::Directory ? 0 : std::filesystem::file_size(p, ec); - oxTracef("ox::fs::PassThroughFS::statInode", "{} {}", ec.message(), path); - oxTracef("ox::fs::PassThroughFS::statInode::size", "{} {}", path, size); + oxTracef("ox.fs.PassThroughFS.statInode", "{} {}", ec.message(), path); + oxTracef("ox.fs.PassThroughFS.statInode::size", "{} {}", path, size); oxReturnError(OxError(static_cast(ec.value()), "PassThroughFS: stat failed")); return FileStat{0, 0, size, type}; } @@ -147,12 +147,12 @@ Error PassThroughFS::readFilePath(CRStringView path, void *buffer, std::size_t b const std::size_t size = static_cast(file.tellg()); file.seekg(0, std::ios::beg); if (size > buffSize) { - oxTracef("ox::fs::PassThroughFS::read::error", "Read failed: Buffer too small: {}", path); + oxTracef("ox.fs.PassThroughFS.read.error", "Read failed: Buffer too small: {}", path); return OxError(1); } file.read(static_cast(buffer), static_cast(buffSize)); } catch (const std::fstream::failure &f) { - oxTracef("ox::fs::PassThroughFS::read::error", "Read of {} failed: {}", path, f.what()); + oxTracef("ox.fs.PassThroughFS.read.error", "Read of {} failed: {}", path, f.what()); return OxError(2); } return OxError(0); @@ -174,7 +174,7 @@ Error PassThroughFS::writeFilePath(CRStringView path, const void *buffer, uint64 std::ofstream f(p, std::ios::binary); f.write(static_cast(buffer), static_cast(size)); } catch (const std::fstream::failure &f) { - oxTracef("ox::fs::PassThroughFS::read::error", "Write of {} failed: {}", path, f.what()); + oxTracef("ox.fs.PassThroughFS.read.error", "Write of {} failed: {}", path, f.what()); return OxError(1); } return OxError(0); diff --git a/deps/ox/src/ox/fs/filesystem/pathiterator.cpp b/deps/ox/src/ox/fs/filesystem/pathiterator.cpp index 1e40f815..06e3e3ab 100644 --- a/deps/ox/src/ox/fs/filesystem/pathiterator.cpp +++ b/deps/ox/src/ox/fs/filesystem/pathiterator.cpp @@ -64,11 +64,11 @@ Error PathIterator::fileName(char *out, std::size_t outSize) { Error PathIterator::get(char *pathOut, std::size_t pathOutSize) { std::size_t size = 0; if (m_iterator >= m_maxSize) { - oxTracef("ox::fs::PathIterator::get", "m_iterator ({}) >= m_maxSize ({})", m_iterator, m_maxSize); + oxTracef("ox.fs.PathIterator.get", "m_iterator ({}) >= m_maxSize ({})", m_iterator, m_maxSize); return OxError(1); } if (!ox_strlen(&m_path[m_iterator])) { - oxTrace("ox::fs::PathIterator::get", "!ox_strlen(&m_path[m_iterator])"); + oxTrace("ox.fs.PathIterator.get", "!ox_strlen(&m_path[m_iterator])"); return OxError(1); } auto start = m_iterator; diff --git a/deps/ox/src/ox/fs/ptrarith/nodebuffer.hpp b/deps/ox/src/ox/fs/ptrarith/nodebuffer.hpp index 1379ebab..6db0fd94 100644 --- a/deps/ox/src/ox/fs/ptrarith/nodebuffer.hpp +++ b/deps/ox/src/ox/fs/ptrarith/nodebuffer.hpp @@ -37,7 +37,7 @@ class OX_PACKED NodeBuffer { Iterator(NodeBuffer *buffer, ItemPtr current) noexcept { m_buffer = buffer; m_current = current; - oxTrace("ox::ptrarith::Iterator::start") << current.offset(); + oxTrace("ox.ptrarith.Iterator.start") << current.offset(); } operator const Item*() const noexcept { @@ -77,7 +77,7 @@ class OX_PACKED NodeBuffer { [[nodiscard]] bool hasNext() noexcept { if (m_current.valid()) { - oxTrace("ox::ptrarith::NodeBuffer::Iterator::hasNext::current") << m_current.offset(); + oxTrace("ox.ptrarith.NodeBuffer.Iterator.hasNext.current") << m_current.offset(); auto next = m_buffer->next(m_current); return next.valid() && m_buffer->firstItem() != next; } @@ -85,7 +85,7 @@ class OX_PACKED NodeBuffer { } void next() noexcept { - oxTrace("ox::ptrarith::NodeBuffer::Iterator::next") << m_it++; + oxTrace("ox.ptrarith.NodeBuffer.Iterator.next") << m_it++; if (hasNext()) { m_current = m_buffer->next(m_current); } else { @@ -174,12 +174,12 @@ template NodeBuffer::NodeBuffer(std::size_t size) noexcept { m_header.size = static_cast(size); ox_memset(this + 1, 0, size - sizeof(*this)); - oxTracef("ox::NodeBuffer::constructor", "{}", m_header.firstItem.get()); + oxTracef("ox.NodeBuffer.constructor", "{}", m_header.firstItem.get()); } template NodeBuffer::NodeBuffer(const NodeBuffer &other, std::size_t size) noexcept { - oxTracef("ox::ptrarith::NodeBuffer::copy", "other.m_header.firstItem: {}", other.m_header.firstItem.get()); + oxTracef("ox.ptrarith.NodeBuffer.copy", "other.m_header.firstItem: {}", other.m_header.firstItem.get()); ox_memset(this + 1, 0, size - sizeof(*this)); ox_memcpy(this, &other, size); } @@ -191,7 +191,7 @@ const typename NodeBuffer::Iterator NodeBuffer::iter template typename NodeBuffer::Iterator NodeBuffer::iterator() noexcept { - oxTracef("ox::ptrarith::NodeBuffer::iterator::size", "{}", m_header.size.get()); + oxTracef("ox.ptrarith.NodeBuffer.iterator.size", "{}", m_header.size.get()); return Iterator(this, firstItem()); } @@ -267,7 +267,7 @@ typename NodeBuffer::ItemPtr NodeBuffer::ptr(size_t template Result::ItemPtr> NodeBuffer::malloc(std::size_t size) noexcept { const auto sz = static_cast(size); - oxTracef("ox::ptrarith::NodeBuffer::malloc", "Size: {}", sz); + oxTracef("ox.ptrarith.NodeBuffer.malloc", "Size: {}", sz); size_t fullSize = static_cast(sz + sizeof(Item)); if (m_header.size - m_header.bytesUsed >= fullSize) { auto last = lastItem(); @@ -277,18 +277,18 @@ Result::ItemPtr> NodeBuffer::mal } else { // there is no first item, so this must be the first item if (!m_header.firstItem) { - oxTrace("ox::ptrarith::NodeBuffer::malloc", "No first item, initializing."); + oxTrace("ox.ptrarith.NodeBuffer.malloc", "No first item, initializing."); m_header.firstItem = static_cast(sizeof(m_header)); addr = m_header.firstItem; } else { - oxTrace("ox::ptrarith::NodeBuffer::malloc::fail", "NodeBuffer is in invalid state."); + oxTrace("ox.ptrarith.NodeBuffer.malloc.fail", "NodeBuffer is in invalid state."); return OxError(1, "NodeBuffer is in invalid state."); } } - oxTracef("ox::ptrarith::NodeBuffer::malloc", "buffer size: {}; addr: {}; fullSize: {}", m_header.size.get(), addr, fullSize); + oxTracef("ox.ptrarith.NodeBuffer.malloc", "buffer size: {}; addr: {}; fullSize: {}", m_header.size.get(), addr, fullSize); auto out = ItemPtr(this, m_header.size, addr, fullSize); if (!out.valid()) { - oxTrace("ox::ptrarith::NodeBuffer::malloc::fail", "Unknown"); + oxTrace("ox.ptrarith.NodeBuffer.malloc.fail", "Unknown"); return OxError(1, "NodeBuffer::malloc: unknown failure"); } ox_memset(out, 0, fullSize); @@ -301,7 +301,7 @@ Result::ItemPtr> NodeBuffer::mal if (first.valid()) { first->prev = out.offset(); } else { - oxTrace("ox::ptrarith::NodeBuffer::malloc::fail", "NodeBuffer malloc failed due to invalid first element pointer."); + oxTrace("ox.ptrarith.NodeBuffer.malloc.fail", "NodeBuffer malloc failed due to invalid first element pointer."); return OxError(1, "NodeBuffer malloc failed due to invalid first element pointer."); } @@ -311,22 +311,22 @@ Result::ItemPtr> NodeBuffer::mal } else { // check to see if this is the first allocation if (out.offset() != first.offset()) { // if this is not the first allocation, there should be an oldLast - oxTrace("ox::ptrarith::NodeBuffer::malloc::fail", "NodeBuffer malloc failed due to invalid last element pointer."); + oxTrace("ox.ptrarith.NodeBuffer.malloc.fail", "NodeBuffer malloc failed due to invalid last element pointer."); return OxError(1, "NodeBuffer malloc failed due to invalid last element pointer."); } out->prev = out.offset(); } m_header.bytesUsed += out.size(); - oxTracef("ox::ptrarith::NodeBuffer::malloc", "Offset: {}", out.offset()); + oxTracef("ox.ptrarith.NodeBuffer.malloc", "Offset: {}", out.offset()); return out; } - oxTracef("ox::ptrarith::NodeBuffer::malloc::fail", "Insufficient space: {} needed, {} available", fullSize, available()); + oxTracef("ox.ptrarith.NodeBuffer.malloc.fail", "Insufficient space: {} needed, {} available", fullSize, available()); return OxError(1); } template Error NodeBuffer::free(ItemPtr item) noexcept { - oxTracef("ox::ptrarith::NodeBuffer::free", "offset: {}", item.offset()); + oxTracef("ox.ptrarith.NodeBuffer.free", "offset: {}", item.offset()); auto prev = this->prev(item); auto next = this->next(item); if (prev.valid() && next.valid()) { @@ -338,16 +338,16 @@ Error NodeBuffer::free(ItemPtr item) noexcept { } } else { // only one item, null out first - oxTrace("ox::ptrarith::NodeBuffer::free", "Nulling out firstItem."); + oxTrace("ox.ptrarith.NodeBuffer.free", "Nulling out firstItem."); m_header.firstItem = 0; } } else { if (!prev.valid()) { - oxTracef("ox::ptrarith::NodeBuffer::free::fail", "NodeBuffer free failed due to invalid prev element pointer: {}", prev.offset()); + oxTracef("ox.ptrarith.NodeBuffer.free.fail", "NodeBuffer free failed due to invalid prev element pointer: {}", prev.offset()); return OxError(1); } if (!next.valid()) { - oxTracef("ox::ptrarith::NodeBuffer::free::fail", "NodeBuffer free failed due to invalid next element pointer: {}", next.offset()); + oxTracef("ox.ptrarith.NodeBuffer.free.fail", "NodeBuffer free failed due to invalid next element pointer: {}", next.offset()); return OxError(1); } } @@ -357,10 +357,10 @@ Error NodeBuffer::free(ItemPtr item) noexcept { template Error NodeBuffer::setSize(std::size_t size) noexcept { - oxTracef("ox::ptrarith::NodeBuffer::setSize", "{} to {}", m_header.size.get(), size); + oxTracef("ox.ptrarith.NodeBuffer.setSize", "{} to {}", m_header.size.get(), size); auto last = lastItem(); auto end = last.valid() ? last.end() : sizeof(m_header); - oxTracef("ox::ptrarith::NodeBuffer::setSize", "end: {}", end); + oxTracef("ox.ptrarith.NodeBuffer.setSize", "end: {}", end); if (end > size) { // resizing to less than buffer size return OxError(1); diff --git a/deps/ox/src/ox/fs/ptrarith/ptr.hpp b/deps/ox/src/ox/fs/ptrarith/ptr.hpp index cb09d9e1..3718e829 100644 --- a/deps/ox/src/ox/fs/ptrarith/ptr.hpp +++ b/deps/ox/src/ox/fs/ptrarith/ptr.hpp @@ -224,7 +224,7 @@ constexpr const Ptr Ptr::subPtr(s template template constexpr const Ptr Ptr::subPtr(size_t offset) const noexcept { - oxTracef("ox::fs::Ptr::subPtr", "{} {} {} {} {}", m_itemOffset, this->size(), offset, m_itemSize, (m_itemSize - offset)); + oxTracef("ox.fs.Ptr.subPtr", "{} {} {} {} {}", m_itemOffset, this->size(), offset, m_itemSize, (m_itemSize - offset)); return subPtr(offset, m_itemSize - offset); } @@ -237,7 +237,7 @@ constexpr Ptr Ptr::subPtr(size_t template template constexpr Ptr Ptr::subPtr(size_t offset) noexcept { - oxTracef("ox::fs::Ptr::subPtr", "{} {} {} {} {}", m_itemOffset, this->size(), offset, m_itemSize, (m_itemSize - offset)); + oxTracef("ox.fs.Ptr.subPtr", "{} {} {} {} {}", m_itemOffset, this->size(), offset, m_itemSize, (m_itemSize - offset)); return subPtr(offset, m_itemSize - offset); } diff --git a/deps/ox/src/ox/fs/test/tests.cpp b/deps/ox/src/ox/fs/test/tests.cpp index 5320130d..e817f9a2 100644 --- a/deps/ox/src/ox/fs/test/tests.cpp +++ b/deps/ox/src/ox/fs/test/tests.cpp @@ -195,20 +195,20 @@ const std::map> tes ox::FileStore32 fileStore(fsBuff.data(), fsBuff.size()); ox::Directory32 dir(fileStore, 105); - oxTrace("ox::fs::test::Directory") << "Init"; + oxTrace("ox.fs.test.Directory") << "Init"; oxAssert(dir.init(), "Init failed"); - oxTrace("ox::fs::test::Directory") << "write 1"; + oxTrace("ox.fs.test.Directory") << "write 1"; oxAssert(dir.write("/file1", 1), "Directory write of file1 failed"); - oxTrace("ox::fs::test::Directory") << "find"; + oxTrace("ox.fs.test.Directory") << "find"; oxAssert(dir.find("file1").error, "Could not find file1"); oxAssert(dir.find("file1").value == 1, "Could not find file1"); - oxTrace("ox::fs::test::Directory") << "write 2"; + oxTrace("ox.fs.test.Directory") << "write 2"; oxAssert(dir.write("/file3", 3), "Directory write of file3 failed"); - oxTrace("ox::fs::test::Directory") << "write 3"; + oxTrace("ox.fs.test.Directory") << "write 3"; oxAssert(dir.write("/file2", 2), "Directory write of file2 failed"); return OxError(0); @@ -218,11 +218,11 @@ const std::map> tes "FileSystem", [](std::string_view) { ox::Vector fsBuff(5000); - oxTrace("ox::fs::test::FileSystem") << "format"; + oxTrace("ox.fs.test.FileSystem") << "format"; oxAssert(ox::FileSystem32::format(fsBuff.data(), fsBuff.size()), "FileSystem format failed"); ox::FileSystem32 fs(ox::FileStore32(fsBuff.data(), fsBuff.size())); - oxTrace("ox::fs::test::FileSystem") << "mkdir"; + oxTrace("ox.fs.test.FileSystem") << "mkdir"; oxAssert(fs.mkdir("/dir", true), "mkdir failed"); oxAssert(fs.stat("/dir").error, "mkdir failed"); oxAssert(fs.mkdir("/l1d1/l2d1/l3d1", true), "mkdir failed"); diff --git a/deps/ox/src/ox/mc/read.hpp b/deps/ox/src/ox/mc/read.hpp index ab3c82fd..80de4469 100644 --- a/deps/ox/src/ox/mc/read.hpp +++ b/deps/ox/src/ox/mc/read.hpp @@ -152,7 +152,7 @@ constexpr MetalClawReaderTemplate::MetalClawReaderTemplate( template constexpr MetalClawReaderTemplate::~MetalClawReaderTemplate() noexcept { if (m_field != m_fields) { - oxTrace("ox::mc::MetalClawReader::error") << "MetalClawReader: incorrect fields number given"; + oxTrace("ox.mc.MetalClawReader.error") << "MetalClawReader: incorrect fields number given"; } } @@ -225,7 +225,7 @@ constexpr Error MetalClawReaderTemplate::field(const char *name, auto *v oxReturnError(handler.field({}, &val[i])); } } else { - oxTracef("ox::mc::read::field(T)", "{}, length: {}", name, valLen); + oxTracef("ox.mc.read.field(T)", "{}, length: {}", name, valLen); return OxError(McOutputBuffEnded); } } diff --git a/deps/ox/src/ox/std/assert.hpp b/deps/ox/src/ox/std/assert.hpp index f2669c3a..bacdedef 100644 --- a/deps/ox/src/ox/std/assert.hpp +++ b/deps/ox/src/ox/std/assert.hpp @@ -82,7 +82,7 @@ constexpr void expect(CRStringView file, int line, const auto &actual, const aut oxErrf("\n\033[31;1;1mASSERT FAILURE:\033[0m [{}:{}]: {}\n", file, line, "Value incorrect"); oxErrf("expected: {}\nactual: {}\n", detail::toStringView(expected), detail::toStringView(actual)); printStackTrace(2); - oxTracef("assert::expect", "Failed assert: {} == {} [{}:{}]", detail::toStringView(actual), detail::toStringView(expected), file, line); + oxTracef("assert.expect", "Failed assert: {} == {} [{}:{}]", detail::toStringView(actual), detail::toStringView(expected), file, line); std::abort(); #else constexprPanic(file, line, "Comparison failed");