status_t SymLink::WriteSymLink(const char* buffer, size_t toWrite, Transaction& transaction) { uint64 size = Size(); if (size > kMaxSymLinkSize) RETURN_ERROR(B_BAD_DATA); if (toWrite > kMaxSymLinkSize) RETURN_ERROR(B_NAME_TOO_LONG); if (toWrite == 0) { SetSize(0); return B_OK; } Block block; if (!block.GetWritable(GetVolume(), BlockIndex(), transaction)) return B_ERROR; char* data = (char*)block.Data() + kSymLinkDataOffset; memcpy(data, buffer, toWrite); SetSize(toWrite); return B_OK; }
status_t DirEntryTree::_InitWritable(Transaction& transaction) { if (!fRootBlock.GetWritable(fDirectory->GetVolume(), fDirectory->BlockIndex(), transaction)) { RETURN_ERROR(B_ERROR); } return _InitCommon(); }
status_t Node::Flush() { if (!fNodeDataDirty) return B_OK; Block block; if (!block.GetWritable(fVolume, fBlockIndex)) return B_ERROR; memcpy(block.Data(), &fNode, sizeof(fNode)); fNodeDataDirty = false; return B_OK; }