TENEX file system layout
Data is stored in files. The file data pages are located by looking them up in an index block, which has a lot in common with a TENEX page table. An index block occupies exactly one page, and each word holds a linear disk address. A short file has only one index block. A long file has an extra level of indirection: a top-level index block points to another layer of index blocks. A file can thus store a maximum of 512 × 512 pages, or 134217728 words.
Files are organized in directories. The data for all directories are inside a long file called <SYSTEM>DIRECTORY. Each directory is associated with a directory number, which is used as a index into the DIRECTORY file. A directory has eight (later sixteen) pages of data. The low end of this data area has meta data such as the protection of the directory, and the start and end of a symbol table. The middle is organized as blocks of various kinds, such as strings used to name files, and file descriptor blocks. At the top end is the symbol table, which is a sequence of words. Each word has a pointer to a string in the left half, and a pointer do a file descriptor block in the right half. These are the files stored in the directory.
Another important file is called <SYSTEM>INDEX. The index block for this file also has the disk addresses for two special directories (number -1 and -2), called subindices, used to map directory names to directory numbers. This is how to find the on-disk location of <SYSTEM>, and thus also <SYSTEM>DIRECTORY>. The location of the <SYSTEM>INDEX index block is the entry point for all other data structures. However, there is no way to locate this block from information on the disk (other than scanning all sectors and make an educated guess). The disk address of the block is built into the monitor as the value of the symbol DIDSC0.
The <SYSTEM>INDEX file is only one page long. Thus the index block only points to one data page in word 0. However, the index block also points to the two subindices. Words 10-17 point to subindex -1, and words 20-27 point to subindex -2. All other words in the page is 0.
Words 15-16 of the INDEX file points to a hash table used to map from a directory number to a directory descriptor block.
Word 17 is the linear address of the indirect index block for <SYSTEM>DIRECTORY.
Words 32-63 holds a subindex dispatch table, used to map a directory name to a subindex. The table is 128 7-bit bytes, indexed by the first character of the directory name. The byte is the positive value of the subindex number.
The DSKBTTBL file has one bit for each disk page to record whether it's free or not. It's organized in blocks which each describe the allocation of a cylinder on the disks.