Skip to content

Skeeser/GanshinFUSE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LOGO

GanshinFUSE


C
platform
license commit stars

简体中文 | English

OS File System Based on libfuse.
基于libfuse实现的类UFS文件系统
If you find it helpful, please consider giving it a star 😉​



Features

  • 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.

File Structure

  • 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

System Architecture

Linux


Dependency Check

  • cmake
  • gcc
  • libfuse
  • gtest (for unit testing)
  • lldb (for debugging)

Build

Download this project

cd ~
git clone https://github.com/Skeeser/GanshinFUSE.git

One-line script for building

sudo chmod +x ~/GanshinFUSE/build.sh && ~/GanshinFUSE/build.sh

Create disk file

8MB in size

dd bs=1M count=8 if=/dev/zero of=~/GanshinFUSE/out/diskimg

Set disk address

Modify ~/GanshinFUSE/include/config.h:

#define DISK_PATH "/home/keeser/GanshinFUSE/out/diskimg"

Set the absolute path for your disk


Compilation

Set debug or release version

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


Execute compilation

cd ~/GanshinFUSE/
mkdir build
cd build
cmake .. 
make

Execution

In the build folder

cd build/

Initialization

./GanshinInit

You should see the logo of this project

logo2

Create a mount directory

Create a folder to mount the file system, can be any location Here, create the folder inside the build folder

cd build/
mkdir mountdir

Mount the file system

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

Unmount the file system

fusermount -u mountdir

Run tests

./GanshinTest

Debugging Tools

LLDB For detailed usage, refer to development document


User Guide

  • Ensure all dependencies are installed

How to Contribute

If you come across this project and want to improve it Strongly suggest reading the following documents


About the Author

keeser


TODO

  • 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

License

MPL 2.0