-File system specs:
--Max 4,294,967,295 Blocks
--Max volume size: 4,398,046,510,080 bytes (4 TB)
--Max file size: 4,398,046,510,080 bytes (4 TB)
--Max filename length: 127 characters
-Blocks are 1 KB
-Each block has a BN (Block Number)
-The volume starts at BN 0
-BN 0 is always the Boot Block
-All other blocks can be moved around
-Blocks:
--Boot Block: First 512 bytes contain boot record, second half contains other misc info
--Master Directory Blocks (MDB): Top of B-Tree for a directory
--Slave Directory Blocks (SDB): Leaves of the B-Tree for a directory
--Master File Blocks (MFB): Top of B+Tree for a file
--Slave File Blocks (sFB): Leaves of the B+Tree for a file
--Block Usage Bitmap
Boot Block:
510 bytes Boot record
2 bytes Bootable signuature (0x55AA)
4 bytes "ZKFS" file system id (ASCII)
8 bytes "1.0 " file system version (ASCII, space padded)
40 bytes Volume label (Unicode-20 characters)
4 bytes Pointer to root directory MDB (BN)
4 bytes Pointer to beginning of swap space (BN)
4 bytes Length of swap space (in blocks)
4 bytes Pointer to beginning of block usage bitmap (BN)
4 bytes Length of block usage bitmap (in blocks)
4 bytes Pointer to beginning of bad block bitmap (BN)
4 bytes Pointer to beginning of directory band (BN)
4 bytes Length of directory band
Swap Space blocks:
marked as used
used as swap space
Block usage bitmap:
every bit maps one block, 1 if used, 0 if not
bad blacks are marked as used
all special blocks are marked as used (boot block, MFBs, SFBs, etc.)
Bad block bitmap:
8 bytes Signature: 'BBB', 0x00, 'ZKFS'
4 bytes Pointer to next bad block bitmap if this on runs out (if any) 0x00000000 if not used
?? bytes Entries in the form:
4 bytes Pointer to BN of bad block
Master File Block:
8 bytes Signature: 'MFB', 0x00, 'ZKFS'
1 byte Full filename length (in bytes)
30 bytes First 15 characters of file name (in unicode)
1 byte Attributes (need to include at all? it's in the Directory Block)
Bit 0: compressed
Bit 1: encrypted
Bit 2: entry is a symbolic link (possible to make inifite loop with symlinks??? bad for searching hard drives)
Bit 3: entry is a shortcut (redirects to target; don't mirror it; can be used with URLs)
Bit 4: MFB contains the entire file
Bit 5: MFB contains pointers directly to Data Blocks
Bit 6: MFB contains pointers to SFBs
Bit 7: unused
4 bytes Pointer to BN of parent directory MDB
8 bytes file size
2 bytes offset of first free byte in the last data block of the file
2 bytes ACL length (in bytes)
45 bytes First 45 bytes of ACLs
4 bytes Pointer to a block with the rest of the ACLs (if longer than 45 bytes)
?? bytes If bits 2 or 3 are set, this contains the path (in unicode)
if bit 4 is set, this contains the entire file
If bit 5 is set, this contains entries in the following format
4 bytes block number into the file (starts at 0 at beginning of file)
4 bytes BN of start of extent
4 bytes number of blocks in extent
If bit 6 is set, this contains entries in the following format
4 bytes block number into the file (starts at 0 at beginning of file)
4 bytes BN of SFB
4 bytes number of blocks mapped by this SFB
Slave File Block:
8 bytes Signature: 'SFB', 0x00, 'ZKFS'
4 bytes Pointer to BN of MFB
4 bytes Pointer to BN of parent SFB (if any)
4 bytes Attributes:
Bit 0: contains pointers to Data blocks
Bit 1: contains pointers to SFBs
Bits 2-30: unused
?? bytes if bit 0 is set then contains entries in the following format
4 bytes block number into the file (starts at 0 at beginning of file)
4 bytes BN of start of extent
4 bytes number of blocks in extent
if bit 1 is set then contains entries in the following format
4 bytes block number into the file (starts at 0 at beginning of file)
4 bytes BN of SFB
4 bytes number of blocks mapped by this SFB
Directory Block: (2 blocks per DirBlock, 2 KB) 14
8 bytes Signature: 'MDB', 0x00, 'ZKFS' if MDB
Signature: 'SDB', 0x00, 'ZKFS' if SDB
4 bytes Pointer to BN of parent directory MDB if MDB
Pointer to BN of parent MDB/SDB if SDB
2 bytes Offset to first free entry in MDB
1 byte Full filename length (in bytes)
30 bytes First 15 characters of file name (in unicode)
File/Directory entry: 28+filenamesize
2 bytes Entry size (always multiple of 4)
1 byte Flags
Bit 0: Encrypted
Bit 1: Compressed
Bit 2: Directory
Bit 3: Has a B-tree down-pointer
Bit 4: Has an ACL
Bit 5: Entry is a dummy end record
Bit 6: Entry is a symbolic link
Bit 7: Unused
4 bytes Down-pointer BN
4 bytes Pointer to MFB (BN)
4 bytes Time last modified
4 bytes Time last accessed
4 bytes Time created
8 bytes File size
1 byte Name Length (in bytes)
? bytes Name (unicode) (max 127 characters, 254 bytes)
End entry:
2 bytes Entry size (4 if no down-pointer, 8 if down pointer)
1 byte Flags:
Bit 0-2: unused
Bit 3: Has a B-tree down-pointer
Bit 4: unused
Bit 5: Always 1
Bit 6-7: unused
1 byte padding
4 bytes Down-pointer BN
.. directory entry always points to parent directory MDB!