HP-UX Reference (11i v2 03/08) - 4 File Formats (vol 8)
d
dir(4) dir(4)
NAME
dir - format of directories on short-name HFS file systems
SYNOPSIS
#include <sys/types.h>
#include <sys/dir.h>
Remarks
This entry describes the System V-compatible directory format for the HFS file system. It is provided
strictly for backward compatibility and compatibility with applications expecting a System V file system
environment. It is not compatible with the similar but more general HFS directory format in
<dirent.h>, which describes a format identical to that used in an HFS file system supporting long file
names up to 255 bytes in length.
The
dirent structure defined in <dirent.h>
should be used in conjunction with the directory (3C)
routines for portability to other industry UNIX implementations.
DESCRIPTION
A directory behaves exactly like an ordinary file, except that no user can write into a directory. The
structure of a directory entry as given in the
<sys/dir.h> header file is:
#define DIRSIZ 14
#define DIRSIZ_CONSTANT 14
#define DIR_PADSIZE 10
#define MAXNAMLEN 255
struct direct {
u_long d_ino; /* inode number of entry */
u_short d_reclen; /* length of this record */
u_short d_namlen; /* length of string in d_name */
char d_name[DIRSIZ_CONSTANT];
char d_pad[DIR_PADSIZE];
};
/*
* DIRSTRCTSIZ is the number of bytes in the structure
* representing a System V-compatible (14-character
* maximum file name length) HFS directory entry.
*/
#define DIRSTRCTSIZ 32 /* sizeof(struct direct) */
By convention, the first two entries in each directory are for . and .. (‘‘dot’’ and ‘‘dot dot’’). The first is
an entry for the directory itself. The second is for the parent directory. The meaning of
.. is modified
for the root directory of the master file system; there is no parent, so
..
and . have the same meaning.
AUTHOR
dir was developed by AT&T and HP.
SEE ALSO
directory(3C).
HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 4−−39