7 | | TBD... |
| 7 | As most POSIX compliant operating systems, ALMOS-MKH sees the external storage device as an array of clusters, where each clusters can store one page of 4 Kbytes. Each cluster occupies eight 512 bytes physical sectors, and is indexed by a cluster identifier, calledd ''cluster_id''. |
| 8 | |
| 9 | To support various File System types, ALMOS-MKH defines a generic Virtual File System API defined in the |
| 10 | [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/fs/vfs.c almos-mkh/kernel/fs/vfs.c] et [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/fs/vfs.h almos-mkh/kernel/fs/vfs.h] files. |
| 11 | |
| 12 | All supported fille systems are supposed to have a hierarchical tree_based structure, where some special ''directory'' files contain ''links'' to other files that can be ''directory'' files, or ''terminal'' files. Therefore, any file X in the file system can be unambiguously defined by a ''pathname'' describing the path from the VFS root to the X file. A ''directory'' file has only on single path name, but a ''terminal'' file can have several ''parent'' directories, defining several path names for one single file. |
| 13 | |
| 14 | The ''directory'' file format is specific for each file system type. |
| 15 | |
| 16 | Any ''cluster_id'' can be allocated to any file (terminal or directory), and for all supported file systems, the ordered set of clusters allocated to a given file is registered in a structure called ''File Allocation Table'' (FAT). |
| 17 | |
| 18 | The ''FAT'' format is specific for each file system type. |
| 19 | |
| 20 | Any file system stores three types of informations: |
| 21 | 1. some clusters are used to store the '''terminal files''', |
| 22 | 1. other clusters are used to store the '''directory files''', |
| 23 | 1. specific clusters are used to store the ''FAT''. |
| 24 | |
| 25 | As all UNIX or Microsoft operating systems ALMOS-MKH implements a File System Cache, that is a partial copy, in kernel memory, of the file system on device. The VFS is actually the implementation of this generic File System Cache. |
| 26 | |
| 27 | The file systems currently supported by ALMOS-MKH are |
| 28 | * the '''FATFS''' respects the Microsoft FAT32 format, |
| 29 | * the '''DEVFS''' describes all peripheral devices available in the hardware architecture, |
| 30 | * the '''RAMFS''' isentirely implemented in physical memory, and does not require any access to an external block device. |
| 31 | |
| 32 | == B) __VFS implementation__ == |
| 33 | |
| 34 | To reduce the memory footprint of this File System Cache, ALMOS-MKH uses two methods: |
| 35 | * For the '''directory''' files, only a subset or the directory entries contained is copied in the File System Cache. |
| 36 | * For the '''terminal'' files, only the pages that have been actually accessed are copied in the File System Cache. |
| 37 | This File System Cache is therefore dynamically extended by the OS to satisfy the user processes requests. |
| 38 | The physical memory allocated to this cache is only released when a file is removed from the file system on device. |
| 39 | |
| 40 | === B.1 Inodes Tree === |
| 41 | |
| 42 | |
| 43 | === B.2 File Mapper === |
| 44 | |
| 45 | |
| 46 | === B.3 FIle Descriptor === |
| 47 | |
| 48 | |