Each Nachos file has an associated FileHeader structure. The FileHeader is similar to a Unix inode in that it contains all the essential information about a file, such as the file's current size and pointers to its physical disk blocks. Specifically, a Nachos' FileHeader contains the current size of the file in bytes, the number of sectors that have been allocated to the file and an array of sector numbers identifying the specific disk sector numbers where the file's data blocks are located. Recall that when a file is initially created, the caller specifies the size of the file. At file creation time, Nachos allocates enough sectors to match the requested size. Thus, as data is appended to the file, no sectors need be allocated. The current size field indicates how much of the file currently contains meaningful data.
Note that a FileHeader contains only ``direct'' pointers to the file's data blocks, limiting the maximum size of a Nachos file to just under 4K bytes.
The following FileHeader operations are supported:
Because a FileHeader fits into a single sector, the sector number containing a FileHeader uniquely identifies that file. We will use fnode (for FileheaderNODE) to refer to a sector that contains a FileHeader.