本文整理汇总了C++中Volume::FreeInode方法的典型用法代码示例。如果您正苦于以下问题:C++ Volume::FreeInode方法的具体用法?C++ Volume::FreeInode怎么用?C++ Volume::FreeInode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Volume
的用法示例。
在下文中一共展示了Volume::FreeInode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transaction
static status_t
ext2_remove_vnode(fs_volume* _volume, fs_vnode* _node, bool reenter)
{
TRACE("ext2_remove_vnode()\n");
Volume* volume = (Volume*)_volume->private_volume;
Inode* inode = (Inode*)_node->private_node;
ObjectDeleter<Inode> inodeDeleter(inode);
if (!inode->IsDeleted())
return B_OK;
TRACE("ext2_remove_vnode(): Starting transaction\n");
Transaction transaction(volume->GetJournal());
if (!inode->IsSymLink() || inode->Size() >= EXT2_SHORT_SYMLINK_LENGTH) {
TRACE("ext2_remove_vnode(): Truncating\n");
status_t status = inode->Resize(transaction, 0);
if (status != B_OK)
return status;
}
TRACE("ext2_remove_vnode(): Removing from orphan list\n");
status_t status = volume->RemoveOrphan(transaction, inode->ID());
if (status != B_OK)
return status;
TRACE("ext2_remove_vnode(): Setting deletion time\n");
inode->Node().SetDeletionTime(real_time_clock());
status = inode->WriteBack(transaction);
if (status != B_OK)
return status;
TRACE("ext2_remove_vnode(): Freeing inode\n");
status = volume->FreeInode(transaction, inode->ID(), inode->IsDirectory());
// TODO: When Transaction::Done() fails, do we have to re-add the vnode?
if (status == B_OK)
status = transaction.Done();
return status;
}