These entry points remove files and directories respectively.
The arguments are:
Fa dvp
The vnode of the directory.
Fa vp
The vnode of the file to be removed.
Fa cnp
Pathname information about the file.
LOCKS
Both
Fa dvp
and
Fa vp
should be locked on entry and remain locked on return.
RETURN VALUES
Zero is returned on success, otherwise an error code is returned.
PSEUDOCODE
int
vop_remove(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
{
int error = 0;
if (vp is immutable) {
error = EPERM;
goto out;
}
/*
* Remove name cnp->cn_nameptr from directory and update link count
* of vp.
*/
...;
return error;
}
ERRORS
Bq Er EPERM
The file is immutable.
Bq Er ENOTEMPTY
An attempt was made to remove a directory which is not empty.