OS File System Based on libfuse.
基于libfuse实现的类UFS文件系统
If you find it helpful, please consider giving it a star 😉
- Utilizes the libfuse framework to create a UFS-like file system, managing the file system using inodes.
- Manages free blocks and free inodes using bitmaps, employs direct and indirect indexing for file data blocks, supports multi-level directories.
- Reduces file I/O operations intentionally, caching in memory and writing changes to files only at the end, making file operations quicker and more efficient.
- Uses hash tables for file and directory operations, providing higher efficiency compared to conventional sequential storage.
- Clear and uniform function and variable names, aiming for code clarity even without extensive comments; the function names, purpose, and return values are standardized with default 0 return for success. Examples can be found in (FileOper.h).
- Code style mimics C++ exception handling, facilitating error traceback. Strict memory management is enforced to prevent memory leaks.
- Utilizes shell scripts for dependency installation, enabling easy installation with a single command, eliminating complex environment setups.
- Includes CMakeList.txt for generating makefiles using cmake, offering simplicity, efficiency, and strong cross-platform capabilities.
- Employs the gtest framework for unit testing, enhancing code robustness and reliability.
- doc => stores development documents
- develop_log.md => development log
- include => header files
- src => source code
- assets => resource files
- build => compiled files
- example => example files
- out => stores disk files
- test => test code
- CMakeLists.txt => CMake configuration file
- build.sh => build script
- README.md => documentation
Linux
- cmake
- gcc
- libfuse
- gtest (for unit testing)
- lldb (for debugging)
cd ~
git clone https://github.com/Skeeser/GanshinFUSE.git
sudo chmod +x ~/GanshinFUSE/build.sh && ~/GanshinFUSE/build.sh
8MB in size
dd bs=1M count=8 if=/dev/zero of=~/GanshinFUSE/out/diskimg
Modify ~/GanshinFUSE/include/config.h
:
#define DISK_PATH "/home/keeser/GanshinFUSE/out/diskimg"
Set the absolute path for your disk
Modify CMakeList.txt:
option(USE_DEBUG "Build with debug flags" ON)
debug version--ON
release version--OFF
Note: Setting release version won't compile gtest code. If gtest installation is needed, refer to development document
cd ~/GanshinFUSE/
mkdir build
cd build
cmake ..
make
cd build/
./GanshinInit
You should see the logo of this project
Create a folder to mount the file system, can be any location Here, create the folder inside the build folder
cd build/
mkdir mountdir
Start GanshinFS
# File system runs in the background by default
./GanshinFS ./mountdir
# Force the file system to run in the foreground
./GanshinFS -f ./mountdir
# Run the file system in debug mode
./GanshinFS -d ./mountdir
fusermount -u mountdir
./GanshinTest
LLDB For detailed usage, refer to development document
- Ensure all dependencies are installed
If you come across this project and want to improve it Strongly suggest reading the following documents
keeser
- Understand the development plan first
- Develop GanshinInit
- Develop GanshinFS
- See if single unit tests can be done
- Try integrating the written GanshinFuse with buildroot to burn it on an embedded board
- Organize the open source repository after passing the test
- Write experimental report
MPL 2.0