本文整理汇总了C++中Inode::HasFileCache方法的典型用法代码示例。如果您正苦于以下问题:C++ Inode::HasFileCache方法的具体用法?C++ Inode::HasFileCache怎么用?C++ Inode::HasFileCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inode
的用法示例。
在下文中一共展示了Inode::HasFileCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transaction
static status_t
ext2_create_symlink(fs_volume* _volume, fs_vnode* _directory, const char* name,
const char* path, int mode)
{
TRACE("ext2_create_symlink()\n");
Volume* volume = (Volume*)_volume->private_volume;
Inode* directory = (Inode*)_directory->private_node;
if (volume->IsReadOnly())
return B_READ_ONLY_DEVICE;
if (!directory->IsDirectory())
return B_BAD_TYPE;
status_t status = directory->CheckPermissions(W_OK);
if (status != B_OK)
return status;
TRACE("ext2_create_symlink(): Starting transaction\n");
Transaction transaction(volume->GetJournal());
Inode* link;
ino_t id;
status = Inode::Create(transaction, directory, name, S_SYMLINK | 0777,
0, (uint8)EXT2_TYPE_SYMLINK, NULL, &id, &link);
if (status != B_OK)
return status;
// TODO: We have to prepare the link before publishing?
size_t length = strlen(path);
TRACE("ext2_create_symlink(): Path (%s) length: %d\n", path, (int)length);
if (length < EXT2_SHORT_SYMLINK_LENGTH) {
strcpy(link->Node().symlink, path);
link->Node().SetSize((uint32)length);
TRACE("ext2_create_symlink(): Publishing vnode\n");
publish_vnode(volume->FSVolume(), id, link, &gExt2VnodeOps,
link->Mode(), 0);
put_vnode(volume->FSVolume(), id);
} else {
TRACE("ext2_create_symlink(): Publishing vnode\n");
publish_vnode(volume->FSVolume(), id, link, &gExt2VnodeOps,
link->Mode(), 0);
put_vnode(volume->FSVolume(), id);
if (!link->HasFileCache()) {
status = link->CreateFileCache();
if (status != B_OK)
return status;
}
size_t written = length;
status = link->WriteAt(transaction, 0, (const uint8*)path, &written);
if (status == B_OK && written != length)
status = B_IO_ERROR;
}
if (status == B_OK)
status = link->WriteBack(transaction);
entry_cache_add(volume->ID(), directory->ID(), name, id);
status = transaction.Done();
if (status != B_OK) {
entry_cache_remove(volume->ID(), directory->ID(), name);
return status;
}
notify_entry_created(volume->ID(), directory->ID(), name, id);
TRACE("ext2_create_symlink(): Done\n");
return status;
}