vnop_rename Entry Point

Purpose

Renames a file or directory.

Syntax

int vnop_rename (srcvp, srcdvp, oldname, destvp, destdvp, newname, crp)
struct vnode * srcvp;
struct vnode * srcdvp;
char * oldname;
struct vnode * destvp;
struct vnode * destdvp;
char * newname;
struct ucred * crp;

Parameters

Item Description
srcvp Points to the virtual node (v-node) of the object to rename.
srcdvp Points to the v-node of the directory where the srcvp parameter resides. The parent directory for the old and new object can be the same.
oldname Identifies the old name of the object.
destvp Points to the v-node of the new object. This pointer is used only if the new object exists. Otherwise, this parameter is the null character.
destdvp Points to the parent directory of the new object. The parent directory for the new and old objects can be the same.
newname Points to the new name of the object.
crp Points to the cred structure. This structure contains data that applications can use to validate access permission.

Description

The vnop_rename entry point is invoked by the logical file system to rename a file or directory. This entry point provides the following renaming actions:

To ensure that this entry point routine executes correctly, the logical file system guarantees the following:

Execution Environment

The vnop_rename entry point can be called from the process environment only.

Return Values

Item Description
0 Indicates success.

Nonzero return values are returned from the /usr/include/sys/errno.h file to indicate failure.