Nuke the zalloci() and zfree() stuff sky-high. We no longer have
[dragonfly.git] / share / man / man9 / VOP_REMOVE.9
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 .\" $FreeBSD: src/share/man/man9/VOP_REMOVE.9,v 1.7.2.2 2001/12/17 11:30:18 ru Exp $
30 .\" $DragonFly: src/share/man/man9/VOP_REMOVE.9,v 1.3 2003/07/27 05:36:06 hmp Exp $
31 .\"
32 .Dd July 24, 1996
33 .Os
34 .Dt VOP_REMOVE 9
35 .Sh NAME
36 .Nm VOP_REMOVE ,
37 .Nm VOP_RMDIR
38 .Nd remove a file or directory
39 .Sh SYNOPSIS
40 .In sys/param.h
41 .In sys/vnode.h
42 .Ft int
43 .Fn VOP_REMOVE "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp"
44 .Ft int
45 .Fn VOP_RMDIR "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp"
46 .Sh DESCRIPTION
47 These entry points remove files and directories respectively.
48 .Pp
49 The arguments are:
50 .Bl -tag -width dvp
51 .It Fa dvp
52 the vnode of the directory
53 .It Fa vp
54 the vnode of the file to be removed
55 .It Fa cnp
56 pathname information about the file
57 .El
58 .Sh LOCKS
59 Both
60 .Fa dvp
61 and
62 .Fa vp
63 should be locked on entry and remain locked on return.
64 .Sh RETURN VALUES
65 Zero is returned on success, otherwise an error code is returned.
66 .Sh PSEUDOCODE
67 .Bd -literal
68 int
69 vop_remove(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
70 {
71     int error = 0;
72
73     if (vp is immutable) {
74         error = EPERM;
75         goto out;
76     }
77
78     /*
79      * Remove name cnp->cn_nameptr from directory and update link count
80      * of vp.
81      */
82     ...;
83
84     /*
85      * Careful about trying to remove ".".  XXX this should be handled
86      * higher up.
87      */
88     if (dvp == vp)
89         vrele(vp);
90     else
91         vput(vp);
92     vput(dvp);
93
94     return error;
95 }
96 .Ed
97 .Sh ERRORS
98 .Bl -tag -width Er
99 .It Bq Er EPERM
100 the file is immutable
101 .It Bq Er ENOTEMPTY
102 attempt to remove a directory which is not empty
103 .El
104 .Sh SEE ALSO
105 .Xr vnode 9 ,
106 .Xr VOP_LOOKUP 9
107 .Sh AUTHORS
108 This man page was written by
109 .An Doug Rabson .