Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

vn_fullpath(9) [freebsd man page]

VN_FULLPATH(9)						   BSD Kernel Developer's Manual					    VN_FULLPATH(9)

NAME
vn_fullpath -- convert a vnode reference to a full pathname, given a process context SYNOPSIS
#include <sys/param.h> #include <sys/vnode.h> int vn_fullpath(struct thread *td, struct vnode *vp, char **retbuf, char **freebuf); DESCRIPTION
The vn_fullpath() function makes a ``best effort'' attempt to generate a string pathname for the passed vnode; the resulting path, if any, will be relative to the root directory of the process associated with the passed thread pointer. The vn_fullpath() function is implemented by inspecting the VFS name cache, and attempting to reconstruct a path from the process root to the object. This process is necessarily unreliable for several reasons: intermediate entries in the path may not be found in the cache; files may have more than one name (hard links), not all file systems use the name cache (specifically, most synthetic file systems do not); a single name may be used for more than one file (in the context of file systems covering other file systems); a file may have no name (if deleted but still open or referenced). However, the resulting string may still be more useable to a user than a vnode pointer value, or a device number and inode number. Code consuming the results of this function should anticipate (and properly handle) failure. Its arguments are: td The thread performing the call; this pointer will be dereferenced to find the process and its file descriptor structure, in order to identify the root vnode to use. vp The vnode to search for. No need to be locked by the caller. retbuf Pointer to a char * that vn_fullpath() may (on success) point at a newly allocated buffer containing the resulting pathname. freebuf Pointer to a char * that vn_fullpath() may (on success) point at a buffer to be freed, when the caller is done with retbuf. Typical consumers will declare two character pointers: fullpath and freepath; they will set freepath to NULL, and fullpath to a name to use in the event that the call to vn_fullpath() fails. After done with the value of fullpath, the caller will check if freepath is non-NULL, and if so, invoke free(9) with a pool type of M_TEMP. RETURN VALUES
If the vnode is successfully converted to a pathname, 0 is returned; otherwise, an error number is returned. SEE ALSO
free(9) AUTHORS
This manual page was written by Robert Watson <rwatson@FreeBSD.org>. BSD
November 23, 2008 BSD

Check Out this Related Man Page

VOP_CREATEVOBJECT(9)					   BSD Kernel Developer's Manual				      VOP_CREATEVOBJECT(9)

NAME
VOP_CREATEVOBJECT, VOP_DESTROYVOBJECT, VOP_GETVOBJECT -- VM object interaction SYNOPSIS
#include <sys/param.h> #include <sys/vnode.h> int VOP_CREATEVOBJECT(struct vnode *vp, struct ucred *cred, struct thread *td); int VOP_DESTROYVOBJECT(struct vnode *vp); int VOP_GETVOBJECT(struct vnode *vp, struct vm_object **objpp); DESCRIPTION
These calls are used to control the association of a VM object with a particular vnode. The arguments specific to these functions are: vp The vnode of the file. objpp The VM object being returned, or NULL if the caller wants to test for the existence of the VM object). VFS(9) invokes VOP_CREATEVOBJECT() when it needs to create a VM object for the given vnode(9). File system code may pass this call down to the underlying file system. This VOP can be called multiple times, and file system code should ignore any additional calls, exiting with a zero return code. VOP_DESTROYVOBJECT() is called when a vnode(9) is recycled. VOP_GETVOBJECT() should be used by all kernel code to get a VM object. The returned VM object may belong to a different file system in the case of stacked mounts. VFS(9) has three functions which perform standard operations by creating and destroying VM objects. These functions are: vop_stdcreatevobject(), vop_stddestroyvobject() and vop_stdgetvobject(). Note: a vnode(9) should be locked on entry and must be left locked on exit. RETURN VALUES
The VOP_CREATEVOBJECT(), VOP_DESTROYVOBJECT() and VOP_GETVOBJECT() functions return zero on success, or a non-zero value on failure. Zero is returned on success, otherwise an error is returned. EXAMPLES
By default, file systems leave VM object handling to the vop_std*() functions. SEE ALSO
vnode(9), VOP_GETPAGES(9), VOP_PUTPAGES(9) AUTHORS
This manual page was written by Boris Popov. BSD
September 10, 2000 BSD
Man Page