本文整理汇总了C++中VNode::GetPageCache方法的典型用法代码示例。如果您正苦于以下问题:C++ VNode::GetPageCache方法的具体用法?C++ VNode::GetPageCache怎么用?C++ VNode::GetPageCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VNode
的用法示例。
在下文中一共展示了VNode::GetPageCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateFileArea
int CreateFileArea(const char name[], const char path[], unsigned int va, off_t offset,
size_t size, int flags, PageProtection prot, Team &team)
{
VNode *node;
int error;
if (offset % PAGE_SIZE) {
printf("Unaligned file offset for area\n");
return E_INVALID_OPERATION; // File offset must be page aligned
}
error = FileSystem::WalkPath(path, strlen(path), &node);
if (error < 0) {
printf("map_file: file not found\n");
return error;
}
PageCache *cache = node->GetPageCache();
// If this is a private area, construct a copy cache
if ((flags & MAP_PRIVATE) != 0) {
cache = new PageCache(0, cache);
if (cache == 0) {
node->ReleaseRef();
return E_NO_MEMORY;
}
}
// It is important that CreateArea not incur a fault!
char nameCopy[OS_NAME_LENGTH];
if (!CopyUser(nameCopy, name, OS_NAME_LENGTH))
return E_BAD_ADDRESS;
Area *area = team.GetAddressSpace()->CreateArea(nameCopy, size, AREA_NOT_WIRED,
prot, cache, offset, va, flags);
if (area == 0) {
printf("CreateArea failed\n");
node->ReleaseRef();
return E_ERROR;
}
return team.GetHandleTable()->Open(area);
}