vnop_seek Entry Point

Purpose

Validates file offsets.

Syntax

int vnop_seek (vp, offsetp, crp)
struct vnode * vp;
offset_t * offp;
struct ucred * crp;

Parameters

Item Description
vp Points to the virtual node (vnode) of the file.
offp Points to the location of the new offset to validate.
crp Points to the user's credential.

Description

The vnop_seek entry point is called by the logical file system to validate a new offset that is computed by the lseek, llseek, and lseek64 subroutines. The file system implementation must check the offset that is pointed to by the offp parameter and, if it is acceptable for the file, return zero. If the offset is not acceptable, the routine must return a non-zero value. EINVAL is the suggested error value for invalid offsets.

File system that do not want to do offset validation can simply return 0. File system that do not provide the vnop_seek entry point has a maximum offset of OFF_MAX (2 gigabytes minus 1) enforced by the logical file system.

Execution Environment

The vnop_seek entry point is to be called from the process environment only.

Return Values

Item Description
0 Indicates success.
Non-zero Return values are returned the /usr/include/sys/errno.h file to indicate failure.