These entry points create a new file, socket, fifo, device, directory or symlink
in a given directory.
The arguments are:
The locked vnode of the directory.
The address of a variable where the resulting locked vnode should be stored.
The pathname component created.
The attributes that the new object should be created with.
The pathname of the target of the symlink.
These entry points are called after
when an object is being created.
will be locked on entry and must remain locked on return.
If the call is successful, the new object will be returned locked.
If successful, the vnode for the new object is placed in
and zero is returned.
Otherwise, an appropriate error is returned.
vop_create(struct vnode *dvp,
struct vnode **vpp,
struct componentname *cnp
struct vattr *vap)
int mode = MAKEIMODE(vap->va_type, vap->va_mode);
struct vnode *vp;
*vpp = NULL;
if ((mode & IFMT) == 0)
mode |= IFREG;
error = SOMEFS_VALLOC(dvp, mode, cnp->cn_cred, &vp);
* Update the permissions for the new vnode, including
* copying the group from the directory.
* Possibly check quota information.
* Enter new vnode in directory, taking care that the vnode
* hits the disk before the directory contents are changed.
error = ...;
*vpp = vp;
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
* Deallocate file system resources for vp.
Bq Er ENOSPC
The file system is full.
Bq Er EDQUOT
The user's file system space or inode quota would be exceeded.