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


C++ FileSystem::Root方法代码示例

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


在下文中一共展示了FileSystem::Root方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

static status_t
nfs4_read_fs_info(fs_volume* volume, struct fs_info* info)
{
	TRACE("volume = %p", volume);

	FileSystem* fs = reinterpret_cast<FileSystem*>(volume->private_volume);
	RootInode* inode = reinterpret_cast<RootInode*>(fs->Root());
	return inode->ReadInfo(info);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: locker

static status_t
nfs4_mount(fs_volume* volume, const char* device, uint32 flags,
			const char* args, ino_t* _rootVnodeID)
{
	TRACE("volume = %p, device = %s, flags = %" B_PRIu32 ", args = %s", volume,
		device, flags, args);

	status_t result;

	/* prepare idmapper server */
	MutexLocker locker(gIdMapperLock);
	gIdMapper = new(std::nothrow) IdMap;
	if (gIdMapper == NULL)
		return B_NO_MEMORY;

	result = gIdMapper->InitStatus();
	if (result != B_OK) {
		delete gIdMapper;
		gIdMapper = NULL;
		return result;
	}
	locker.Unlock();

	AddressResolver* resolver;
	MountConfiguration config;
	char* path;
	result = ParseArguments(args, &resolver, &path, &config);
	if (result != B_OK)
		return result;
	MemoryDeleter pathDeleter(path);

	RPC::Server* server;
	result = gRPCServerManager->Acquire(&server, resolver, CreateNFS4Server);
	delete resolver;
	if (result != B_OK)
		return result;
	
	FileSystem* fs;
	result = FileSystem::Mount(&fs, server, path, volume->id, config);
	if (result != B_OK) {
		gRPCServerManager->Release(server);
		return result;
	}

	Inode* inode = fs->Root();
	if (inode == NULL) {
		delete fs;
		gRPCServerManager->Release(server);

		return B_IO_ERROR;
	}

	volume->private_volume = fs;
	volume->ops = &gNFSv4VolumeOps;

	VnodeToInode* vti = new VnodeToInode(inode->ID(), fs);
	if (vti == NULL) {
		delete fs;
		gRPCServerManager->Release(server);
		return B_NO_MEMORY;
	}

	vti->Replace(inode);
	result = publish_vnode(volume, inode->ID(), vti, &gNFSv4VnodeOps,
							inode->Type(), 0);
	if (result != B_OK)
		return result;

	*_rootVnodeID = inode->ID();

	TRACE("*_rootVnodeID = %" B_PRIi64, inode->ID());

	return B_OK;
}
开发者ID:,项目名称:,代码行数:74,代码来源:


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