Open System Services System Calls Reference Manual (G06.25+, H06.03+)

Files dir(4)
NAME
dir - Describes the format of directories
SYNOPSIS
#include <sys/types.h>
#include <dirent.h>
DESCRIPTION
A directory is a le that contains directory entries. The fact that a le is a directory is indicated
by a bit in the ag word of the inode entry for the le.
Users cannot write a directory. Users can read directory entries by making calls to the readdir()
function after opening the directory le by calling the opendir( ) function.
Directory entries are returned in directory entry structures, which are of variable length. Each
directory entry has a dirent structure at the beginning, containing its inode number, the length of
the entry, and the length of the lename contained in the entry. These structure components are
followed by the lename, padded to a 4-byte boundary with null bytes. All names are guaranteed
null-terminated. The maximum permitted length of a name in a directory can be obtained by cal-
ling the pathconf() function.
By convention, the rst two entries in each directory are for . (dot) and ..(dot-dot). The . (dot)
entry is for the directory itself. The ..(dot-dot) entry is for the parent directory. The meaning of
..(dot-dot) is modied for the / (root) directory of the OSS le system, where ..(dot-dot) has the
same meaning as . (dot).
Guardian directories (that is, directories within the /G le system) behave the same as OSS direc-
tories, with the following exceptions:
The mkdir() function successfully creates a directory within /G only when all of the fol-
lowing are true:
The directory is exactly three directories under the root (for example,
/G/vol/subvol).
The lenames in the directory pathname use correct Guardian naming syntax
(otherwise, errno is set to [EINVAL]).
The directory corresponds to a Guardian subvolume.
The mkdir() function succeeds on a directory that is an existing Guardian subvolume
(for example, /G/vol/subvol) only when the Guardian subvolume is empty. If the Guar-
dian subvolume is not empty, the mkdir() function fails and errno is set to the value
[EEXIST].
RELATED INFORMATION
Functions: chdir(2), closedir(3), mkdir(2), opendir(3), readdir(3), rewinddir(3), rmdir(2).
527186-003 Hewlett-Packard Company 117