DMOD Driver File System - A driver-based file system module for embedded systems.
dmdevfs (DMOD Driver File System) is a file system implementation that provides an interface to access files through hardware drivers or external storage. It is built on the DMOD (Dynamic Modules) framework and implements the DMFSI (DMOD File System Interface), making it compatible with DMVFS (DMOD Virtual File System) and other DMOD-based applications.
- Driver-Based: Interfaces with hardware drivers for storage access
- DMFSI Compatible: Implements the standard DMOD file system interface
- DMVFS Integration: Can be mounted as a file system in DMVFS
- Modular Design: Built on DMOD framework for easy integration
DMDEVFS is part of a modular embedded file system architecture built on DMOD:
┌─────────────────────────────────────────────────────────────┐
│ Application Layer │
│ (Your embedded application code) │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ DMVFS (Virtual File System) │
│ • Unified file system interface │
│ • Multiple mount points │
│ • Path resolution │
│ https://github.com/choco-technologies/dmvfs │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ DMFSI (DMOD File System Interface) │
│ • Standardized POSIX-like API │
│ • Common interface for all file systems │
│ https://github.com/choco-technologies/dmfsi │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────┼─────────────────┐
▼ ▼ ▼
┌────────────────┐ ┌─────────────┐ ┌─────────────┐
│ DMDEVFS (Driver│ │ DMFFS (Flash│ │ DMRAMFS (RAM│
│ Driver-based │ │ Read-only │ │ Temporary │
│ (This Project) │ │ │ │ │
└────────────────┘ └─────────────┘ └─────────────┘
│ │ │
▼ ▼ ▼
┌────────────────┐ ┌─────────────┐ ┌─────────────┐
│ Hardware Driver│ │ Flash Memory│ │ RAM │
└────────────────┘ └─────────────┘ └─────────────┘
- DMOD: The foundation providing dynamic module loading, inter-module communication, and resource management
- DMFSI: Defines the standard file system interface that DMDEVFS implements
- DMVFS: Virtual file system layer that can mount DMDEVFS at any path in a unified directory tree
- DMDEVFS: This project - implements DMFSI to provide access to driver-based storage
mkdir build
cd build
cmake .. -DDMOD_MODE=DMOD_MODULE
cmake --build .The module can be loaded and mounted using DMVFS:
#include "dmvfs.h"
// Initialize DMVFS
dmvfs_init(16, 32);
// Mount the driver filesystem at /mnt
dmvfs_mount_fs("dmdevfs", "/mnt", NULL);
// Use standard file operations
void* fp;
dmvfs_fopen(&fp, "/mnt/file.txt", DMFSI_O_RDONLY, 0, 0);
// ... use file ...
dmvfs_fclose(fp);
// Unmount when done
dmvfs_unmount_fs("/mnt");
dmvfs_deinit();The module implements the full DMFSI interface:
_fopen- Open a file_fclose- Close a file_fread- Read from a file_fwrite- Write to a file_lseek- Seek to a position_tell- Get current position_eof- Check for end of file_size- Get file size_getc- Read a single character_putc- Write a single character_sync- Sync file_fflush- Flush buffers
_mkdir- Create a directory_opendir- Open a directory for reading_readdir- Read directory entries_closedir- Close a directory_direxists- Check if directory exists
_stat- Get file/directory statistics_unlink- Delete a file_rename- Rename a file
dmdevfs/
├── include/
│ └── dmdevfs.h # Public header
├── src/
│ └── dmdevfs.c # Main DMDEVFS implementation
├── CMakeLists.txt # CMake build configuration
├── manifest.dmm # DMOD manifest file
├── README.md # This file
└── LICENSE # License file
Note: This is an initial implementation with the basic structure in place. The actual driver integration and file operations are marked with TODO comments and need to be implemented based on specific hardware driver requirements.
include(FetchContent)
# Fetch DMDEVFS
FetchContent_Declare(
dmdevfs
GIT_REPOSITORY https://github.com/choco-technologies/dmdfs.git
GIT_TAG main
)
# Set DMOD mode
set(DMOD_MODE "DMOD_MODULE" CACHE STRING "DMOD build mode")
FetchContent_MakeAvailable(dmdevfs)
# Link to your target
target_link_libraries(your_target PRIVATE dmdevfs)- Clone the repository:
git clone https://github.com/choco-technologies/dmdfs.git - Add as subdirectory:
add_subdirectory(dmdevfs) - Link library:
target_link_libraries(your_target dmdevfs)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
- DMOD - Dynamic module system
- DMFSI - File system interface specification
- DMVFS - Virtual file system implementation
- DMFFS - Flash file system implementation
- DMRAMFS - RAM file system implementation
See LICENSE file for details.
Patryk Kubiak
For questions, issues, or feature requests, please open an issue on GitHub: https://github.com/choco-technologies/dmdfs/issues