Processes can read directories as regular files. However, the kernel reserves the right to write directories. For this reason, directories are created and maintained by a set of subroutines unique to them. The file name field is null-terminated and padded to 4 bytes. File names can be up to 255 bytes long.
Directory entries are variable-length to allow file names the greatest flexibility.
However, all directory space is allocated at all times. See the JFS Directory Record Space Allocation figure for an illustration. No directory entry is allowed to span 512-byte sections of a directory. When a directory requires more than 512 bytes, another 512-byte record is appended to the original record. When a file is removed, the space the file occupied in the directory structure is added to the preceding directory entry.