xref: /freebsd/share/man/man9/VOP_RENAME.9 (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 1996 Doug Rabson
4.\"
5.\" All rights reserved.
6.\"
7.\" This program is free software.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.Dd July 24, 1996
30.Dt VOP_RENAME 9
31.Os
32.Sh NAME
33.Nm VOP_RENAME
34.Nd rename a file
35.Sh SYNOPSIS
36.In sys/param.h
37.In sys/vnode.h
38.Ft int
39.Fn VOP_RENAME "struct vnode *fdvp" "struct vnode *fvp" "struct componentname *fcnp" "struct vnode *tdvp" "struct vnode *tvp" "struct componentname *tcnp"
40.Sh DESCRIPTION
41This renames a file and possibly changes its parent directory.
42If the destination object exists, it will be removed first.
43.Pp
44Its arguments are:
45.Bl -tag -width fdvp
46.It Fa fdvp
47The vnode of the old parent directory.
48.It Fa fvp
49The vnode of the file to be renamed.
50.It Fa fcnp
51Pathname information about the file's current name.
52.It Fa tdvp
53The vnode of the new parent directory.
54.It Fa tvp
55The vnode of the target file (if it exists).
56.It Fa tcnp
57Pathname information about the file's new name.
58.El
59.Sh LOCKS
60The source directory and file are unlocked but are expected to have their
61ref count bumped on entry.
62The VOP routine is expected to
63.Xr vrele 9
64both prior
65to returning.
66.Pp
67The destination directory and file are locked as well as having their ref
68count bumped.
69The VOP routine is expected to
70.Xr vput 9
71both prior to
72returning.
73.Sh ERRORS
74.Bl -tag -width Er
75.It Bq Er EPERM
76The file is immutable.
77.It Bq Er EXDEV
78It is not possible to rename a file between different file systems.
79.It Bq Er EINVAL
80An attempt was made to rename
81.Pa \&.
82or
83.Pa .. ,
84or to perform an operation which would break the directory tree structure.
85.It Bq Er ENOTDIR
86An attempt was made to rename a directory to a file or vice versa.
87.It Bq Er ENOTEMPTY
88An attempt was made to remove a directory which is not empty.
89.El
90.Sh SEE ALSO
91.Xr vnode 9
92.Sh AUTHORS
93This manual page was written by
94.An Doug Rabson .
95