[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Files Reference

dir File

Purpose

Describes the format of a directory.

Syntax

#include <sys/dir.h>

Description

A directory is a file that contains information and structures necessary to define a file hierarchy. A file is interpreted as a directory by the system if it has the S_IFDIR file mode. All modifications to the structure of a directory must be performed under the control of the operating system.

The directory file format accommodates component names of up to 256 characters. This is accomplished through the use of a variable-length structure to describe individual directory entries. The structure of a directory entry follows.

Note
This structure is a file system-specific data structure. It is recommended that file system-independent application programs use the file system-independent direct structure and its associated library support routines.

struct direct {
         ino_t      d_ino;
         ushort     d_reclen;
         ushort     d_namelen;
         char       d_name[256];
  };

By convention, the first two entries in each directory are . (dot) and .. (dot dot). The . (dot) is an entry for the directory itself. The .. (dot dot) entry is for the parent directory. Within the root ( / ) directory the meaning of .. (dot dot) is modified; because there is no parent directory, the .. (dot dot) entry has the same meaning as the . (dot) entry.

The DIRSIZ (dp) macro gives the amount of space required to represent a directory entry. The dp argument is a pointer to a direct structure.

Related Information

The dirent.h file, filsys.h file, inode file.

The opendir, readdir, telldir, seekdir, rewindir, or closedir subroutine.

File Systems Overview in AIX 5L Version 5.2 System Management Concepts: Operating System and Devices.

Directory Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices.

Files Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]