A directory behaves like an ordinary file,
except that no user may write into a directory.
The fact that a file is a directory is indicated by
a field in its inode (see
filesystem(FP)).
The structure of a directory is given in the include file
corresponding to each supported filesystem:
File
Filesystem architecture
dtdir.h
DTFS (Desktop Filesystem, a compression filesystem)
hsdir.h
HS (High Sierra), ISO9660 and
RCKRDG (Rock Ridge)
htdir.h
S51K (UNIX filesystem),
HTFS (High Throughput Filesystem),
EAFS (Enhanced ACER Fast Filesystem)
and AFS (ACER Fast Filesystem)
dosdir.h
DOS
xxinode.h
XENIX
Due to the diversity of filesystem types (and hence directory
structures), do not read the directory as a
file using
open(S)
and
read(S).
Instead the
opendir(S)
and
readdir(S)
system calls should be used.
These are provided to allow directories to
be read in a way that is independent of filesystem structure.
By convention, the first two entries in each directory
are``dot'' (.) and ``dotdot'' (..).
The first is an entry for the directory itself.
The second is for the parent directory.
The meaning of dotdot is modified for the root directory
of the master file system;
there is no parent, so dotdot has the same meaning as dot.
When versioning is enabled under HTFS/DTFS
and a directory is being
read that has versioning enabled, the use of
opendir( )
and
readdir( )
may return entries for the versioned copies of files that have been
modified. These are only returned if the SHOWVERSIONS environment
variable has the value
1.
The returned entries take the form
filename;version.
See
undelete(C)
for more details.