[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Kernel and Subsystems Technical Reference, Volume 1

vn_readdir Entry Point

Purpose

Reads directory entries in standard format.

Syntax

int vn_readdir (vp, uiop, crp)
struct vnode *vp;
struct uio *uiop;
struct ucred *crp;

Parameters

vp Points to the virtual node (v-node) of the directory.
uiop Points to the uio structure that describes the data area into which to put the block of dirent structures. The starting directory offset is found in the uiop->uio_offset field and the size of the buffer area is found in the uiop->uio_resid field.
crp Points to the cred structure. This structure contains data that the file system can use to validate access permission.

Description

The vn_readdir entry point is used to access directory entries in a standard way. These directories should be returned as an array of dirent structures. The /usr/include/sys/dir.h file contains the definition of a dirent structure.

The vn_readdir entry point does the following:

The End-of-file character should be indicated by not reading any bytes (not by a partial read). This provides directories with the ability to have some hidden information in each block.

The virtual file system-specific implementation is also responsible for setting the uio_offset field to the offset of the next whole block to be read.

Execution Environment

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

Return Values

0 Indicates success.

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

Related Information

The readdir subroutine.

The uio structure.

Virtual File System Overview, Virtual File System Kernel Extensions Overview, Virtual File System Kernel Extensions Overview, Logical File System Overview, and Understanding Virtual Nodes (V-nodes) in AIX Kernel Extensions and Device Support Programming Concepts.

List of Virtual File System Operations.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]