[ox] Change macro names to comply with broader conventions
This commit is contained in:
@@ -228,17 +228,17 @@ Error FileStoreTemplate<size_t>::setSize(std::size_t size) {
|
||||
|
||||
template<typename size_t>
|
||||
Error FileStoreTemplate<size_t>::incLinks(uint64_t id) {
|
||||
oxRequireM(item, find(static_cast<size_t>(id)).validate());
|
||||
OX_REQUIRE_M(item, find(static_cast<size_t>(id)).validate());
|
||||
++item->links;
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
template<typename size_t>
|
||||
Error FileStoreTemplate<size_t>::decLinks(uint64_t id) {
|
||||
oxRequireM(item, find(static_cast<size_t>(id)).validate());
|
||||
OX_REQUIRE_M(item, find(static_cast<size_t>(id)).validate());
|
||||
--item->links;
|
||||
if (item->links == 0) {
|
||||
oxReturnError(remove(item));
|
||||
OX_RETURN_ERROR(remove(item));
|
||||
}
|
||||
return ox::Error(0);
|
||||
}
|
||||
@@ -249,7 +249,7 @@ Error FileStoreTemplate<size_t>::write(uint64_t id64, const void *data, FsSize_t
|
||||
oxTracef("ox.fs.FileStoreTemplate.write", "Attempting to write to inode {}", id);
|
||||
auto existing = find(id);
|
||||
if (!canWrite(existing, dataSize)) {
|
||||
oxReturnError(compact());
|
||||
OX_RETURN_ERROR(compact());
|
||||
existing = find(id);
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ Error FileStoreTemplate<size_t>::write(uint64_t id64, const void *data, FsSize_t
|
||||
// if first malloc failed, compact and try again
|
||||
if (!dest.valid()) {
|
||||
oxTrace("ox.fs.FileStoreTemplate.write", "Allocation failed, compacting");
|
||||
oxReturnError(compact());
|
||||
OX_RETURN_ERROR(compact());
|
||||
dest = m_buffer->malloc(dataSize).value;
|
||||
}
|
||||
if (dest.valid()) {
|
||||
@@ -305,7 +305,7 @@ Error FileStoreTemplate<size_t>::write(uint64_t id64, const void *data, FsSize_t
|
||||
}
|
||||
}
|
||||
}
|
||||
oxReturnError(m_buffer->free(dest));
|
||||
OX_RETURN_ERROR(m_buffer->free(dest));
|
||||
}
|
||||
return ox::Error(1);
|
||||
}
|
||||
@@ -422,10 +422,10 @@ ptrarith::Ptr<uint8_t, std::size_t> FileStoreTemplate<size_t>::read(uint64_t id)
|
||||
|
||||
template<typename size_t>
|
||||
Error FileStoreTemplate<size_t>::resize() {
|
||||
oxReturnError(compact());
|
||||
OX_RETURN_ERROR(compact());
|
||||
const auto newSize = static_cast<std::size_t>(size() - available());
|
||||
oxTracef("ox.fs.FileStoreTemplate.resize", "resize to: {}", newSize);
|
||||
oxReturnError(m_buffer->setSize(newSize));
|
||||
OX_RETURN_ERROR(m_buffer->setSize(newSize));
|
||||
oxTracef("ox.fs.FileStoreTemplate.resize", "resized to: {}", m_buffer->size());
|
||||
return ox::Error(0);
|
||||
}
|
||||
@@ -438,14 +438,14 @@ Error FileStoreTemplate<size_t>::resize(std::size_t size, void *newBuff) {
|
||||
m_buffSize = static_cast<size_t>(size);
|
||||
if (newBuff) {
|
||||
m_buffer = reinterpret_cast<Buffer*>(newBuff);
|
||||
oxReturnError(m_buffer->setSize(static_cast<size_t>(size)));
|
||||
OX_RETURN_ERROR(m_buffer->setSize(static_cast<size_t>(size)));
|
||||
}
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
template<typename size_t>
|
||||
Result<StatInfo> FileStoreTemplate<size_t>::stat(uint64_t id) const {
|
||||
oxRequire(inode, find(static_cast<size_t>(id)).validate());
|
||||
OX_REQUIRE(inode, find(static_cast<size_t>(id)).validate());
|
||||
return StatInfo {
|
||||
id,
|
||||
inode->links,
|
||||
@@ -477,7 +477,7 @@ char *FileStoreTemplate<size_t>::buff() {
|
||||
template<typename size_t>
|
||||
Error FileStoreTemplate<size_t>::walk(Error(*cb)(uint8_t, uint64_t, uint64_t)) {
|
||||
for (auto i = m_buffer->iterator(); i.valid(); i.next()) {
|
||||
oxReturnError(cb(i->fileType, i.ptr().offset(), i.ptr().end()));
|
||||
OX_RETURN_ERROR(cb(i->fileType, i.ptr().offset(), i.ptr().end()));
|
||||
}
|
||||
return ox::Error(0);
|
||||
}
|
||||
@@ -546,7 +546,7 @@ Error FileStoreTemplate<size_t>::placeItem(ItemPtr item) {
|
||||
if (!fsData) {
|
||||
return ox::Error(1);
|
||||
}
|
||||
oxRequireM(root, m_buffer->ptr(fsData->rootNode).validate());
|
||||
OX_REQUIRE_M(root, m_buffer->ptr(fsData->rootNode).validate());
|
||||
if (root->id == item->id) {
|
||||
fsData->rootNode = item;
|
||||
item->left = root->left;
|
||||
@@ -602,7 +602,7 @@ Error FileStoreTemplate<size_t>::unplaceItem(ItemPtr item) {
|
||||
if (!fsData) {
|
||||
return ox::Error(1);
|
||||
}
|
||||
oxRequireM(root, m_buffer->ptr(fsData->rootNode).validate());
|
||||
OX_REQUIRE_M(root, m_buffer->ptr(fsData->rootNode).validate());
|
||||
if (root->id == item->id) {
|
||||
item->left = root->left;
|
||||
item->right = root->right;
|
||||
@@ -656,10 +656,10 @@ Error FileStoreTemplate<size_t>::unplaceItem(ItemPtr root, ItemPtr item, int dep
|
||||
return ox::Error(1);
|
||||
}
|
||||
if (item->right) {
|
||||
oxReturnError(placeItem(m_buffer->ptr(item->right)));
|
||||
OX_RETURN_ERROR(placeItem(m_buffer->ptr(item->right)));
|
||||
}
|
||||
if (item->left) {
|
||||
oxReturnError(placeItem(m_buffer->ptr(item->left)));
|
||||
OX_RETURN_ERROR(placeItem(m_buffer->ptr(item->left)));
|
||||
}
|
||||
return ox::Error(0);
|
||||
}
|
||||
@@ -667,8 +667,8 @@ Error FileStoreTemplate<size_t>::unplaceItem(ItemPtr root, ItemPtr item, int dep
|
||||
template<typename size_t>
|
||||
Error FileStoreTemplate<size_t>::remove(ItemPtr item) {
|
||||
if (item.valid()) {
|
||||
oxReturnError(unplaceItem(item));
|
||||
oxReturnError(m_buffer->free(item));
|
||||
OX_RETURN_ERROR(unplaceItem(item));
|
||||
OX_RETURN_ERROR(m_buffer->free(item));
|
||||
return ox::Error(0);
|
||||
}
|
||||
return ox::Error(1);
|
||||
|
||||
Reference in New Issue
Block a user