1 .\" Copyright (c) 1996 Doug Rabson
3 .\" All rights reserved.
5 .\" This program is free software.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\" $FreeBSD: src/share/man/man9/VOP_CREATE.9,v 1.9.2.1 2001/12/17 11:30:18 ru Exp $
28 .\" $DragonFly: src/share/man/man9/VOP_CREATE.9,v 1.4 2004/06/01 11:36:53 hmp Exp $
38 .Nd create a file, socket, fifo, device, directory or symlink
44 .Fn VOP_CREATE "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
46 .Fn VOP_MKNOD "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
48 .Fn VOP_MKDIR "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
50 .Fn VOP_SYMLINK "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" "char *target"
52 These entry points create a new file, socket, fifo, device, directory or symlink
56 .Bl -tag -width target
58 the locked vnode of the directory
60 the address of a variable where the resulting locked vnode should be stored
62 the pathname component created
64 the attributes that the new object should be created with
66 the pathname of the target of the symlink
69 These entry points are called after
71 when an object is being created.
78 to keep the memory pointed to by
81 If an error is detected when creating the file,
82 then this memory will be freed.
83 If the file is created successfully, then it will be freed unless the
90 will be locked on entry and must remain locked on return.
91 If the call is successful, the new object will be returned locked.
93 If successful, the vnode for the new object is placed in
95 and zero is returned. Otherwise, an appropriate error is returned.
99 vop_create(struct vnode *dvp,
101 struct componentname *cnp
104 int mode = MAKEIMODE(vap->va_type, vap->va_mode);
109 if ((mode & IFMT) == 0)
112 error = SOMEFS_VALLOC(dvp, mode, cnp->cn_cred, &vp);
114 free(cnp->cn_pnbuf, M_NAMEI);
120 * Update the permissions for the new vnode, including
121 * copying the group from the directory.
127 * Possibly check quota information.
133 * Enter new vnode in directory, taking care that the vnode
134 * hits the disk before the directory contents are changed.
141 if ((cnp->cn_flags & SAVESTART) == 0)
142 free(cnp->cn_pnbuf, M_NAMEI);
150 * Write error occurred trying to update the inode
151 * or the directory so must deallocate the inode.
153 free(cnp->cn_pnbuf, M_NAMEI);
157 * Deallocate filesystem resources for vp.
169 The filesystem is full.
183 This man page was written by