本文整理汇总了C++中DirectoryIterator::RemoveEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ DirectoryIterator::RemoveEntry方法的具体用法?C++ DirectoryIterator::RemoveEntry怎么用?C++ DirectoryIterator::RemoveEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DirectoryIterator
的用法示例。
在下文中一共展示了DirectoryIterator::RemoveEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transaction
static status_t
ext2_unlink(fs_volume* _volume, fs_vnode* _directory, const char* name)
{
TRACE("ext2_unlink()\n");
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
return B_NOT_ALLOWED;
Volume* volume = (Volume*)_volume->private_volume;
Inode* directory = (Inode*)_directory->private_node;
status_t status = directory->CheckPermissions(W_OK);
if (status != B_OK)
return status;
TRACE("ext2_unlink(): Starting transaction\n");
Transaction transaction(volume->GetJournal());
directory->WriteLockInTransaction(transaction);
TRACE("ext2_unlink(): Looking up for directory entry\n");
HTree htree(volume, directory);
DirectoryIterator* directoryIterator;
status = htree.Lookup(name, &directoryIterator);
if (status != B_OK)
return status;
ino_t id;
status = directoryIterator->FindEntry(name, &id);
if (status != B_OK)
return status;
Vnode vnode(volume, id);
Inode* inode;
status = vnode.Get(&inode);
if (status != B_OK)
return status;
inode->WriteLockInTransaction(transaction);
status = inode->Unlink(transaction);
if (status != B_OK)
return status;
status = directoryIterator->RemoveEntry(transaction);
if (status != B_OK)
return status;
entry_cache_remove(volume->ID(), directory->ID(), name);
status = transaction.Done();
if (status != B_OK)
entry_cache_add(volume->ID(), directory->ID(), name, id);
else
notify_entry_removed(volume->ID(), directory->ID(), name, id);
return status;
}