DragonFly On-Line Manual Pages
VGET(9) DragonFly Kernel Developer's Manual VGET(9)
NAME
vget -- Acquire a primary reference, lock, and reactivate a vnode
SYNOPSIS
#include <sys/param.h>
#include <sys/vnode.h>
int
vget(struct vnode *vp, int lockflag);
DESCRIPTION
Acquire a primary reference to vnode and lock it, reactivating the vnode
from the cache or free list if necessary. This kernel function must be
used if the vnode in hand is not already known to be actively referenced,
such as when obtaining the vnode pointer from a namecache or VM object
structure.
vp The vnode being acquired, typically obtained from some other
system structure.
lockflag Must be LK_SHARED or LK_EXCLUSIVE. Passing 0 is illegal.
LK_NOWAIT may be logically ORd in if you do not wish to block
and can handle the additional error codes that might be
returned.
When not in use, vnodes are kept on a free list or marked as being
cached. The vnodes still reference valid files but may be reused to
refer to a new file at any time. Often, references to these vnodes are
present in auxiliary structures related to the vnode, such as namecache
entries and VM objects.
When acquiring a vnode pointer from these auxiliary structures the vget
function must be used to both reference and, if necessary, reactivate the
vnode. The vnode will also be locked accordingly.
RETURN VALUES
0 is returned on success, ENOENT is returned if the vnode becomes unus-
able while vget is blocked trying to lock it, and other errors may be
returned as well. ENOENT is not typically considered to be a fatal error
but simply an indication that the caller needs to relookup the vnode as
related structures may be in the midst of being destroyed.
SEE ALSO
vdrop(9), vhold(9), vnode(9), vn_lock(9), vn_unlock(9), vput(9), vref(9),
vrele(9)
AUTHORS
This manual page was written by Doug Rabson.
DragonFly 3.5 May 5, 2007 DragonFly 3.5