当前位置: 首页>>代码示例>>C++>>正文


C++ VNode::ReleaseRef方法代码示例

本文整理汇总了C++中VNode::ReleaseRef方法的典型用法代码示例。如果您正苦于以下问题:C++ VNode::ReleaseRef方法的具体用法?C++ VNode::ReleaseRef怎么用?C++ VNode::ReleaseRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VNode的用法示例。


在下文中一共展示了VNode::ReleaseRef方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
开发者ID:FFalcon,项目名称:jbushOS,代码行数:44,代码来源:SystemCall.cpp

示例2: chdir

status_t chdir(const char path[])
{
	VNode *dir;
	int error = FileSystem::WalkPath(path, strlen(path), &dir);
	if (error < 0)
		return error;

	VNode *subdir;
	error = dir->Lookup(".", 1, &subdir);
	if (error < 0) {
		dir->ReleaseRef();
		return E_NO_SUCH_FILE;
	}

	subdir->ReleaseRef();

	Thread::GetRunningThread()->SetCurrentDir(dir);
	return E_NO_ERROR;
}
开发者ID:FFalcon,项目名称:jbushOS,代码行数:19,代码来源:SystemCall.cpp

示例3: mount

status_t mount(const char device[], const char dir[], const char type[], int,
	char*)
{
	int error;
	int devfd = -1;
	if (strlen(device) > 0) {
		devfd = open(device, 0);
		if (devfd < 0) {
			printf("mount: error opening device\n");
			return E_NO_SUCH_FILE;
		}
	}
	
	VNode *node;
	error = FileSystem::WalkPath(dir, strlen(dir), &node);
	if (error < 0) {
		printf("mount: mount point does not exist\n");
		close_handle(devfd);
		return error;
	}

	if (node->GetCoveredBy() != 0) {
		// Attempting to re-mount an already mounted directory
		printf("mount: filesystem already mounted at this point\n");
		node->ReleaseRef();
		close_handle(devfd);
		return E_NOT_ALLOWED;
	}

	FileSystem *fs;
	error = FileSystem::InstantiateFsType(type, devfd, &fs);
	if (error < 0) {
		node->ReleaseRef();
		close_handle(devfd);
		return error;
	}
	
	node->CoverWith(fs);
	fs->Cover(node);
	return 0;
}
开发者ID:FFalcon,项目名称:jbushOS,代码行数:41,代码来源:SystemCall.cpp

示例4: rmdir

int rmdir(const char path[])
{
	VNode *dir;
	char entry[256];
	int error;
	
	error = FileSystem::GetDirEntry(path, strlen(path), entry, 256, &dir);
	if (error < 0)
		return error;

	error = dir->RemoveDir(entry, strlen(entry));
	dir->ReleaseRef();
	return error;
}
开发者ID:FFalcon,项目名称:jbushOS,代码行数:14,代码来源:SystemCall.cpp

示例5: open

int open(const char path[], int)
{
	VNode *node;
	int error = FileSystem::WalkPath(path, strlen(path), &node);
	if (error < 0)
		return error;

	FileDescriptor *desc;
	error = node->Open(&desc);
	if (error < 0) {
		node->ReleaseRef();
		return error;
	}

	desc->SetName(path);
	return OpenHandle(desc);
}
开发者ID:FFalcon,项目名称:jbushOS,代码行数:17,代码来源:SystemCall.cpp


注:本文中的VNode::ReleaseRef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。