Retrieves the v-node that corresponds to the named path.
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/uio.h>
int lookupvp ( namep, flags, compvpp, crp)
char *namep;
int flags;
struct vnode **compvpp;
struct ucred *crp;
int lookupname ( namep, seg, flags, dirvpp, compvpp, crp)
char *namep;
int seg;
int flags;
struct vnode **dirvpp;
struct vnode **compvpp;
struct cred *crp;
int lookupname_cur ( namep, seg, flags, dirvpp, compvpp, curdvp, crp)
char *namep;
int seg;
int flags;
struct vnode **dirvpp;
struct vnode **compvpp;
struct vnode **curdvp;
struct cred *crp;
Item | Description |
---|---|
crp | Points to the cred structure. This structure contains data that the file system can use to validate access permission. |
namep | Points to a character string path name. |
flags | Specifies lookup directives, including these six flags:
|
seg | Specifies whether the namep buffer is in user space (UIO_USERSPACE) or kernel space (UIO_SYSSPACE). |
compvpp | Points to the location where the vnode pointer for the named object is to be returned to the calling routine. |
dirvpp | Points to the location where the vnode pointer for the directory containing the named object is to be returned. |
curdvp | Points to the vnode for a current directory to be used instead of u_cdir. |
The lookupvp kernel service provides translation of the path name provided by the namep parameter into a virtual file system node. The lookupvp service provides a flexible interface to path-name resolution by regarding the flags parameter values as directives to the lookup process. The lookup process is a cooperative effort between the logical file system and underlying virtual file systems (VFS). Several v-node and VFS operations are employed to:
The lookupvp kernel service determines the process's current and root directories by consulting the u_cdir and u_rdir fields in the u structure. Information about the virtual file system and file system installation for transient v-nodes is obtained from each name component's vfs or gfs structure. The lookupvp kernel service assumes that the named path is in kernel address space.
The lookupname kernel service provides the same service as the lookupvp kernel service, but allows the caller to specify whether the path name is in kernel or user space. It also provides the ability to retrieve the vnode for the directory containing the named object. The lookupname_cur kernel service further extends the interface by allowing the lookup to proceed relative to the given curdvp directory.
The vnodes returned by the lookup services are held. The calling routine is responsible for releasing the hold by calling the vnop_rele entry point when it completes its operation.
The lookup kernel services can be called from the process environment only.
Item | Description |
---|---|
0 | Indicates a successful operation. |
errno | Indicates an error. This number is defined in the /usr/include/sys/errno.h file. |