File system
File system tree
OZ file system (FS) is a RAM FS. The memory allocated for the filesystem depends on one permanent handle (NQ_Fmh) open for all slots, avoiding swap area (MM_MUL | MM_FIX option bits set).
The tree roots are stored in the first page of first bank, except internal slot : bank $21 (R21_BNK). They define the devices : :RAM.0, :RAM.-. Tree root of :RAM.1 is in bank $40, :RAM.2 in $80 and :RAM.3 in $C0.
The structure of the root is a minimal DOR containing father, brother, son, device major type and its name.
The son of the device is a node which structure is a file DOR. Its type is a minor type : file (Dn_Fil), directory (Dn_Dir), virtual file (Dn_Epr). Those nodes are linked each other according the file system tree using the father/brother/son pointers.
For the file type (Dn_Fil and Dn_Epr) the son points to a memory page allocated for the file system. The pointer is not an extended 24 bits pointer as usual, only 16 bits are used. Conversion from memory pointer (BHL) to file pointer (DE) is as follows :
B H L
dddddddd 00eeeeee ee000000
 Â
The file pointer points to the first sector. A sector is 62+2 bytes length. Two bytes for the link to the next followed by 62 bytes of data. When the sector is the last one, the first byte is zero followed by the sector length. Each page allocated to the file system holds up to 4 sectors (or 1 DOR and 3 sectors...).
RAM device
Each RAM device is tagged at address CR_TAG ($0000) with CT_RAM ($A55A) followed by the size in banks (1 byte).
The RAM device DOR is by by default at $0040.
For information, the first page of :RAM.0 contains other root DORs (RAM.- at $210020 and APPL at $210060).
In the root DOR, the father LSB represent the mounting status : 0 unmounted and -1 if mounted. RAM device are always mounted and cannot be unmounted.
The brother is always zero and the son points to the File DOR described below.
Notice that this rule applies for :EPR.x and :SDC.0 root devices located in low RAM.
File DOR
The file DOR length is up to 64 bytes. Its layout is fixed and should respect the specified order. It contains father, brother and son followed by file informations consisting of a key, data length, data.
Offset | Length | Name | Value | Description |
---|---|---|---|---|
$00 | 3 | pointer to father | ||
$03 | 3 | pointer to brother | ||
$06 | 3 | pointer to son | ||
$09 | 1 | DN_ | DOR minor type (DN_Fil, DN_Dir, DN_Epr) | |
$0A | 1 | $3F | file DOR length | |
$0B | 1 | DT_NAM | 'N' | name section descriptor |
$0C | 1 | $11 | filename length, fixed value | |
$0D | 17 | filename null terminated, cell filled with trailing zero. Includes dot and extension. | ||
$1E | 1 | DT_UPD | 'U' | update timestamp section descriptor |
$1F | 1 | $06 | update time length, fixed value | |
$20 | 6 | date and time of update in machine format | ||
$26 | 1 | DT_CRE | 'C' | creation timestamp section descriptor |
$27 | 1 | $06 | creation time length, fixed value | |
$28 | 6 | date and time of creation in machine format | ||
$2E | 1 | DT_EXT | 'X' | extent (size) |
$2F | 1 | $04 | extent length, fixed value | |
$30 | 4 | 32 bit value of filesize | ||
$34 | 1 | DT_EFS | 'E' | section descriptor |
$35 | 1 | $04 | section length, fixed value | |
$36 | 4 | 32 bit pointer to eprom file entry | ||
$3A | 1 | DT_ATR | 'A' | section descriptor |
$3B | 1 | $03 | section length, fixed value | |
$3C | 3 | 24 bit for file attribute flags |