= Distributed File System = [[PageOutline]] == __A) General principles__ == 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''. To support various File System types, ALMOS-MKH defines a generic Virtual File System API defined in the [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. 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. The ''directory'' file format is specific for each file system type. 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). The ''FAT'' format is specific for each file system type. Any file system stores three types of informations: 1. some clusters are used to store the '''terminal files''', 1. other clusters are used to store the '''directory files''', 1. specific clusters are used to store the ''FAT''. 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. The file systems currently supported by ALMOS-MKH are * the '''FATFS''' respects the Microsoft FAT32 format, * the '''DEVFS''' describes all peripheral devices available in the hardware architecture, * the '''RAMFS''' isentirely implemented in physical memory, and does not require any access to an external block device. == B) __VFS implementation__ == To reduce the memory footprint of this File System Cache, ALMOS-MKH uses two methods: * For the '''directory''' files, only a subset or the directory entries contained is copied in the File System Cache. * For the '''terminal'' files, only the pages that have been actually accessed are copied in the File System Cache. This File System Cache is therefore dynamically extended by the OS to satisfy the user processes requests. The physical memory allocated to this cache is only released when a file is removed from the file system on device. === B.1 Inodes Tree === === B.2 File Mapper === === B.3 FIle Descriptor ===