3 .\" Copyright (c) 1996 Doug Rabson
5 .\" All rights reserved.
7 .\" This program is free software.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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.
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.
29 .\" $FreeBSD: src/share/man/man9/VOP_CREATE.9,v 1.9.2.1 2001/12/17 11:30:18 ru Exp $
30 .\" $DragonFly: src/share/man/man9/VOP_CREATE.9,v 1.3 2003/07/27 05:36:06 hmp Exp $
40 .Nd create a file, socket, fifo, device, directory or symlink
46 .Fn VOP_CREATE "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
48 .Fn VOP_MKNOD "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
50 .Fn VOP_MKDIR "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
52 .Fn VOP_SYMLINK "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" "char *target"
54 These entry points create a new file, socket, fifo, device, directory or symlink
58 .Bl -tag -width target
60 the locked vnode of the directory
62 the address of a variable where the resulting locked vnode should be stored
64 the pathname component created
66 the attributes that the new object should be created with
68 the pathname of the target of the symlink
71 These entry points are called after
73 when an object is being created.
80 to keep the memory pointed to by
83 If an error is detected when creating the file,
84 then this memory will be freed.
85 If the file is created successfully, then it will be freed unless the
92 will be locked on entry and must remain locked on return.
93 If the call is successful, the new object will be returned locked.
95 If successful, the vnode for the new object is placed in
97 and zero is returned. Otherwise, an appropriate error is returned.
101 vop_create(struct vnode *dvp,
103 struct componentname *cnp
106 int mode = MAKEIMODE(vap->va_type, vap->va_mode);
111 if ((mode & IFMT) == 0)
114 error = SOMEFS_VALLOC(dvp, mode, cnp->cn_cred, &vp);
116 free(cnp->cn_pnbuf, M_NAMEI);
122 * Update the permissions for the new vnode, including
123 * copying the group from the directory.
129 * Possibly check quota information.
135 * Enter new vnode in directory, taking care that the vnode
136 * hits the disk before the directory contents are changed.
143 if ((cnp->cn_flags & SAVESTART) == 0)
144 free(cnp->cn_pnbuf, M_NAMEI);
152 * Write error occurred trying to update the inode
153 * or the directory so must deallocate the inode.
155 free(cnp->cn_pnbuf, M_NAMEI);
159 * Deallocate filesystem resources for vp.
171 The filesystem is full.
185 This man page was written by