Exemplo n.º 1
0
static status_t
get_new_vnode(fs_volume* volume, ino_t id, VnodeToInode** _vti)
{
	FileSystem* fs = reinterpret_cast<FileSystem*>(volume->private_volume);
	Inode* inode;
	VnodeToInode* vti;

	status_t result = acquire_vnode(volume, id);
	if (result == B_OK) {
		ASSERT(get_vnode(volume, id, reinterpret_cast<void**>(_vti)) == B_OK);
		unremove_vnode(volume, id);

		// Release after acquire
		put_vnode(volume, id);

		vti = *_vti;

		if (vti->Get() == NULL) {
			result = fs->GetInode(id, &inode);
			if (result != B_OK) {
				put_vnode(volume, id);
				return result;
			}

			vti->Replace(inode);
		}
		return B_OK;
	}

	return get_vnode(volume, id, reinterpret_cast<void**>(_vti));
}
Exemplo n.º 2
0
static status_t
nfs4_get_vnode(fs_volume* volume, ino_t id, fs_vnode* vnode, int* _type,
	uint32* _flags, bool reenter)
{
	FileSystem* fs = reinterpret_cast<FileSystem*>(volume->private_volume);
	TRACE("volume = %p, id = %" B_PRIi64, volume, id);

	VnodeToInode* vnodeToInode = new VnodeToInode(id, fs);
	if (vnodeToInode == NULL)
		return B_NO_MEMORY;

	Inode* inode;	
	status_t result = fs->GetInode(id, &inode);
	if (result != B_OK) {
		delete vnodeToInode;
		return result;
	}

	vnodeToInode->Replace(inode);
	vnode->ops = &gNFSv4VnodeOps;
	vnode->private_node = vnodeToInode;

	*_type = inode->Type();
	*_flags = 0;

	return B_OK;
}