au-ts / lionsos

A secure, fast, and adaptable OS based on the seL4 microkernel
https://lionsos.org
BSD 2-Clause "Simplified" License
84 stars 7 forks source link

FAT (File Allocation Table) file system for Lions OS #60

Closed Cheng-Li1 closed 1 week ago

Cheng-Li1 commented 3 months ago

The FAT (File Allocation Table) file system for Lions OS is an asynchronous file system built upon Elm-Chan's FatFs - Generic FAT Filesystem Module (FatFs website). The FatFs for Lions OS supports the FAT12, FAT16, FAT32, and exFAT file system formats.

This implementation is compatible with the current protocol of MicroPython to NFS, allowing us to switch out NFS and replace it with FatFs while maintaining system functionality.

The transition from a synchronous file system to an asynchronous one is achieved using coroutine libraries, specifically FiberFlow and FiberPool I implemented. FiberFlow is a modified version of libco that resolves stack corruption errors and adds argument passing functionality. FiberPool is a library that implements a coroutine pool (similar to a thread pool) for easy management of multiple coroutines.

The file system operates as follows: The main coroutine is responsible for receiving and delegating requests and responses to worker coroutines, which in turn invoke the actual file system functionalities, with yielding to other coroutines when encountering blocking operation.

Some basic functionalities of an older version of this implementation have been tested and are working correctly, providing basic validation of the implementation. However, the current version is heavily modified to fit into the Lions OS infrastructure and has not yet been built and tested. My next steps will focus on finishing the build script and testing. I will keep updating the FatFs branch accordingly.

This draft pull request is intended to receive feedback on the current implementation of the file system.