vnop_open Entry Point

Purpose

Requests that a file be opened for reading or writing.

Syntax

int vnop_open (vp, flag, ext, vinfop, crp)
struct vnode * vp;
int  flag;
caddr_t  ext;
caddr_t  vinfop;
struct ucred * crp;

Parameters

Item Description
vp Points to the virtual node (v-node) associated with the desired file. The v-node is held for the duration of the open process.
flag Specifies the type of access. Access modes are defined in the /usr/include/sys/fcntl.h file.
Note: The vnop_open entry point does not use the FCREAT mode.
ext Points to external data. This parameter is used if the subroutine is opening a device.
vinfop This parameter is not currently used.
crp Points to the cred structure. This structure contains data that the file system can use to validate access permission.

Description

The vnop_open entry point is called to initiate a process access to a v-node and its underlying file system object. The operation of the vnop_open entry point varies between virtual file system (VFS) implementations. A successful vnop_open entry point must leave a v-node count of at least 1.

The logical file system ensures that the process is not requesting write access (with the FWRITE or FTRUNC mode) to a read-only file system.

Execution Environment

The vnop_open 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.