xref: /freebsd/share/man/man9/VOP_RENAME.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1fab63cc4SDoug Rabson.\" -*- nroff -*-
2fab63cc4SDoug Rabson.\"
3fab63cc4SDoug Rabson.\" Copyright (c) 1996 Doug Rabson
4fab63cc4SDoug Rabson.\"
5fab63cc4SDoug Rabson.\" All rights reserved.
6fab63cc4SDoug Rabson.\"
7fab63cc4SDoug Rabson.\" This program is free software.
8fab63cc4SDoug Rabson.\"
9fab63cc4SDoug Rabson.\" Redistribution and use in source and binary forms, with or without
10fab63cc4SDoug Rabson.\" modification, are permitted provided that the following conditions
11fab63cc4SDoug Rabson.\" are met:
12fab63cc4SDoug Rabson.\" 1. Redistributions of source code must retain the above copyright
13fab63cc4SDoug Rabson.\"    notice, this list of conditions and the following disclaimer.
14fab63cc4SDoug Rabson.\" 2. Redistributions in binary form must reproduce the above copyright
15fab63cc4SDoug Rabson.\"    notice, this list of conditions and the following disclaimer in the
16fab63cc4SDoug Rabson.\"    documentation and/or other materials provided with the distribution.
17fab63cc4SDoug Rabson.\"
18fab63cc4SDoug Rabson.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19fab63cc4SDoug Rabson.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20fab63cc4SDoug Rabson.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21fab63cc4SDoug Rabson.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22fab63cc4SDoug Rabson.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23fab63cc4SDoug Rabson.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24fab63cc4SDoug Rabson.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25fab63cc4SDoug Rabson.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26fab63cc4SDoug Rabson.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27fab63cc4SDoug Rabson.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28fab63cc4SDoug Rabson.\"
29fab63cc4SDoug Rabson.Dd July 24, 1996
30fab63cc4SDoug Rabson.Dt VOP_RENAME 9
31*aa12cea2SUlrich Spörlein.Os
32fab63cc4SDoug Rabson.Sh NAME
33fab63cc4SDoug Rabson.Nm VOP_RENAME
34fab63cc4SDoug Rabson.Nd rename a file
35fab63cc4SDoug Rabson.Sh SYNOPSIS
3632eef9aeSRuslan Ermilov.In sys/param.h
3732eef9aeSRuslan Ermilov.In sys/vnode.h
38fab63cc4SDoug Rabson.Ft int
39fab63cc4SDoug Rabson.Fn VOP_RENAME "struct vnode *fdvp" "struct vnode *fvp" "struct componentname *fcnp" "struct vnode *tdvp" "struct vnode *tvp" "struct componentname *tcnp"
40fab63cc4SDoug Rabson.Sh DESCRIPTION
41fab63cc4SDoug RabsonThis renames a file and possibly changes its parent directory.
42fab63cc4SDoug RabsonIf the destination object exists, it will be removed first.
43fab63cc4SDoug Rabson.Pp
44fab63cc4SDoug RabsonIts arguments are:
45fab63cc4SDoug Rabson.Bl -tag -width fdvp
460640e9e0SHiten Pandya.It Fa fdvp
470a57ea7dSRuslan ErmilovThe vnode of the old parent directory.
480640e9e0SHiten Pandya.It Fa fvp
490a57ea7dSRuslan ErmilovThe vnode of the file to be renamed.
500640e9e0SHiten Pandya.It Fa fcnp
510a57ea7dSRuslan ErmilovPathname information about the file's current name.
520640e9e0SHiten Pandya.It Fa tdvp
530a57ea7dSRuslan ErmilovThe vnode of the new parent directory.
540640e9e0SHiten Pandya.It Fa tvp
550a57ea7dSRuslan ErmilovThe vnode of the target file (if it exists).
560640e9e0SHiten Pandya.It Fa tcnp
570a57ea7dSRuslan ErmilovPathname information about the file's new name.
58fab63cc4SDoug Rabson.El
59fab63cc4SDoug Rabson.Sh LOCKS
6037af2883SMatthew DillonThe source directory and file are unlocked but are expected to have their
61c1c03d49SHiten Pandyaref count bumped on entry.
62c1c03d49SHiten PandyaThe VOP routine is expected to
632cb869e0SHiten Pandya.Xr vrele 9
6487b0140cSMatthew Dillonboth prior
6537af2883SMatthew Dillonto returning.
6637af2883SMatthew Dillon.Pp
6737af2883SMatthew DillonThe destination directory and file are locked as well as having their ref
68c1c03d49SHiten Pandyacount bumped.
69c1c03d49SHiten PandyaThe VOP routine is expected to
702cb869e0SHiten Pandya.Xr vput 9
7187b0140cSMatthew Dillonboth prior to
7237af2883SMatthew Dillonreturning.
73fab63cc4SDoug Rabson.Sh ERRORS
74eaa8b244SMike Pritchard.Bl -tag -width Er
75fab63cc4SDoug Rabson.It Bq Er EPERM
76cc258457SDon LewisThe file is immutable.
77fab63cc4SDoug Rabson.It Bq Er EXDEV
7881f8d226SDon LewisIt is not possible to rename a file between different file systems.
79fab63cc4SDoug Rabson.It Bq Er EINVAL
8081f8d226SDon LewisAn attempt was made to rename
81d962d52aSRuslan Ermilov.Pa \&.
8281f8d226SDon Lewisor
83d962d52aSRuslan Ermilov.Pa .. ,
84d962d52aSRuslan Ermilovor to perform an operation which would break the directory tree structure.
85fab63cc4SDoug Rabson.It Bq Er ENOTDIR
8681f8d226SDon LewisAn attempt was made to rename a directory to a file or vice versa.
87fab63cc4SDoug Rabson.It Bq Er ENOTEMPTY
8881f8d226SDon LewisAn attempt was made to remove a directory which is not empty.
89fab63cc4SDoug Rabson.El
90fab63cc4SDoug Rabson.Sh SEE ALSO
91fab63cc4SDoug Rabson.Xr vnode 9
92fab63cc4SDoug Rabson.Sh AUTHORS
932cb869e0SHiten PandyaThis manual page was written by
94aaf1f16eSPhilippe Charnier.An Doug Rabson .
95