vnop_create Entry Point

Purpose

Creates a new file.

Syntax

int vnop_create (dp, vpp, flag, pname, mode, vinfop, crp)
struct vnode * dp;
struct vnode ** vpp;
int  flag;
char * pname;
int  mode;
caddr_t * vinfop;
struct ucred * crp;

Parameters

Item Description
dp Points to the virtual node (v-node) of the parent directory.
vpp Points to the place in which the pointer to a v-node for the newly created file is returned.
flag Specifies an integer flag word. The vnop_create entry point uses this parameter to open the file.
pname Points to the name of the new file.
mode Specifies the mode for the new file.
vinfop This parameter is unused.
crp Points to the cred structure. This structure contains data that the file system can use to validate access permission.

Description

The vnop_create entry point is invoked by the logical file system to create a regular (v-node type VREG) file in the directory specified by the dp parameter. (Other v-node operations create directories and special files.) Virtual node types are defined in the /usr/include/sys/vnode.h file. The v-node of the parent directory is held during the processing of the vnop_create entry point.

To create a file, the vnop_create entry point does the following:

Execution Environment

The vnop_create entry point can be called from the process environment only.

Return Values

Item Description
0 Indicates success.

Nonzero return values are returned from the /usr/include/sys/errno.h file to indicate failure.