Directories

A directory is simply a file that has special meaning to the filesystem; the file contains a collection of directory entries.

Figure 1. A directory entry.

The bits in the i_status field indicate the type of the directory entry:

QNX4FS_FILE_LINK QNX4FS_FILE_USED Entry type
0 0 Unused directory entry
0 1 Normal, used directory entry
1 0 Link to an entry in /.inodes (which should be used)
1 1 Invalid

The first directory entry is always for the . ("dot") link and includes a directory signature ("I♥QNX"). The hexadecimal equivalent of the ♥ character is 0x03. This entry refers to the directory itself by pointing to the entry within the parent directory that describes this directory.

The second entry is always for the .. ("dot dot") link. This entry refers to the parent directory by pointing to the first block of the parent directory.

Every directory entry either defines a file or points to an entry within the /.inodes file. Inode entries are used when the filename exceeds 16 characters or when two or more names are linked to a single file. If you've enabled support for long filenames, the root directory of the filesystem also includes the .longfilenames file, which stores information about files whose names are longer than 48 characters.

The first extent (if any) of a file is described in the directory/inode entry. Additional file extents require a linked list of extent blocks whose header is also in the directory/inode entry. Each extent block can hold location information for up to 60 extents.