Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dir(5) — SunOS 0.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fs(5)

DIR(5)  —  System Interface Manual — File Formats

NAME

dir − format of directories

SYNOPSIS

#include <sys/types.h>
#include <sys/dir.h>

DESCRIPTION

A directory behaves exactly like an ordinary file, save that no user may write into a directory.  The fact that a file is a directory is indicated by a bit in the flag word of its i-node entry; see fs(5). The structure of a directory entry as given in the include file is:

/∗
 ∗ This sets the "page size" for directories.
 ∗ Requirements are DEV_BSIZE <= DIRBLKSIZ <= MINBSIZE with
 ∗ DIRBLKSIZ a power of two.
 ∗ Dennis Ritchie feels that directory pages should be atomic
 ∗ operations to the disk, so we use DEV_BSIZE.
 ∗/
#ifdef KERNEL
#define DIRBLKSIZ DEV_BSIZE
#else
#defineDIRBLKSIZ 512
#endif
 /∗
 ∗ This limits the directory name length. Its main constraint
 ∗ is that it appears twice in the user structure. (u. area)
 ∗/
#define MAXNAMLEN 255
 structdirect {
u_longd_ino;
shortd_reclen;
shortd_namlen;
chard_name[MAXNAMLEN + 1];
/∗ typically shorter ∗/
};
 struct _dirdesc {
intdd_fd;
longdd_loc;
longdd_size;
chardd_buf[DIRBLKSIZ];
};

By convention, the first two entries in each directory are for ‘.’ and ‘..’.  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 (“/”), where ‘..’ has the same meaning as ‘.’. 

SEE ALSO

fs(5)

Sun System Release 0.3  —  30 March 1983

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026