* Added acquire_vnode() call that you can use to get another reference to an

inode - unlike get_vnode() the busy flag won't prevent you from getting that
  reference.
* Changed put_vnode() to return an error in case the vnode couldn't be found.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26713 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-08-01 09:59:19 +00:00
parent aaad303e67
commit 9f6ae76f02
5 changed files with 44 additions and 4 deletions
+20 -2
View File
@@ -2017,6 +2017,23 @@ fssh_get_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID, void **fsNode)
}
extern "C" fssh_status_t
fssh_acquire_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
{
struct vnode *vnode;
fssh_mutex_lock(&sVnodeMutex);
vnode = lookup_vnode(volume->id, vnodeID);
fssh_mutex_unlock(&sVnodeMutex);
if (vnode == NULL)
return FSSH_B_BAD_VALUE;
inc_vnode_ref_count(vnode);
return FSSH_B_OK;
}
extern "C" fssh_status_t
fssh_put_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
{
@@ -2026,9 +2043,10 @@ fssh_put_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
vnode = lookup_vnode(volume->id, vnodeID);
fssh_mutex_unlock(&sVnodeMutex);
if (vnode)
dec_vnode_ref_count(vnode, true);
if (vnode == NULL)
return FSSH_B_BAD_VALUE;
dec_vnode_ref_count(vnode, true);
return FSSH_B_OK;
}