The memory of the card is divided into base blocks (size is currently 32 bytes). This is the smallest element that my file system operates on. The size of everything in this file system is a multiple of those basic block's size.
At the beginning of the memory an informational table describing the file system itself can be found (CTSuperBlock).
Directly behind this super block is the block allocation table. Others would call it a FAT (file allocation table). The size of this FAT is fixed to 256 bytes. Each entry of the FAT is one byte wide and it corresponds to one data block (the size of a data block depends on the capacity of the card, but it is a multiple of a basic block's size). Each entry holds one of the following:
-
number of the next block in this chain (see below, 0-253)
-
special value to flag that the end of a chain is reached
-
special value to flag that this block is free
-
special value to flag that a block is reserved
When allocating a data block the FAT is scanned for an entry flagging a free block (see above). If one is found then it will be set with the special value flagging that this block is the last block of a chain. When the next block is to be allocated, then additionally the previous block (which now is not at the end anymore) receives the number of the following block. The number of the first block is stored in the file's directory entry, thus creating a block chain.
The older ones among you may recognize this scheme. That's the way MSDOS managed floppies and hard discs with their old FAT (before NTFS or FAT32 came ;-)
Each file and folder is represented by a special table (CTDirEntry). This entry holds information about the file or folder. If a folder contains sub folders, then their entries are stored within the data area of the parent directory.
Generated on Sat Feb 11 15:20:28 2006 for libchipcard by
1.4.2