{"id":42154980,"url":"https://github.com/choco-technologies/dmvfs","last_synced_at":"2026-01-26T19:06:04.613Z","repository":{"id":318929724,"uuid":"1076978231","full_name":"choco-technologies/dmvfs","owner":"choco-technologies","description":"DMOD Virtual File System","archived":false,"fork":false,"pushed_at":"2025-11-25T19:43:49.000Z","size":401,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-11-28T18:33:38.624Z","etag":null,"topics":["dmfsi","dmod","staticlibrary"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/choco-technologies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-15T15:49:52.000Z","updated_at":"2025-11-25T19:43:53.000Z","dependencies_parsed_at":"2025-10-17T08:26:41.925Z","dependency_job_id":"19997502-baa6-4f09-82f3-aa4b5a185253","html_url":"https://github.com/choco-technologies/dmvfs","commit_stats":null,"previous_names":["choco-technologies/dmod-vfs","choco-technologies/dmvfs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/choco-technologies/dmvfs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choco-technologies%2Fdmvfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choco-technologies%2Fdmvfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choco-technologies%2Fdmvfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choco-technologies%2Fdmvfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/choco-technologies","download_url":"https://codeload.github.com/choco-technologies/dmvfs/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choco-technologies%2Fdmvfs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28785172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dmfsi","dmod","staticlibrary"],"created_at":"2026-01-26T19:02:41.575Z","updated_at":"2026-01-26T19:06:04.542Z","avatar_url":"https://github.com/choco-technologies.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DMVFS - DMOD Virtual File System\n\n\nDMVFS is a Virtual File System (VFS) layer for DMOD-based embedded systems. It provides a unified interface for managing multiple file systems simultaneously, allowing applications to work with different file system implementations through a single, consistent API.\n\n## Overview\n\nDMVFS acts as a virtual file system layer that sits on top of various file system implementations (such as FatFS, RamFS, FlashFS, etc.). It allows multiple file systems to be mounted at different mount points in a unified directory tree, similar to how traditional operating systems handle multiple partitions and storage devices.\n\nThe key advantage of DMVFS is that it leverages the **DMOD (Dynamic Modules)** system to dynamically load file system implementations at runtime, providing flexibility and modularity for embedded applications.\n\n## Key Features\n\n- **Multi-Mount Point Support**: Mount multiple file systems at different locations in a unified directory tree\n- **Dynamic Module Loading**: Load file system implementations dynamically at runtime using DMOD\n- **POSIX-like API**: Familiar file operations (open, read, write, seek, etc.)\n- **Process-Based File Management**: Track open files per process ID\n- **Thread-Safe Operations**: Built-in mutex protection for concurrent access\n- **Path Resolution**: Automatic conversion between relative and absolute paths\n- **Comprehensive File Operations**: Support for files, directories, and metadata operations\n- **Modular Architecture**: Clean separation between VFS layer and file system implementations\n\n## Architecture\n\nDMVFS is built on top of two key DMOD components:\n\n### 1. DMOD (Dynamic Modules)\nThe foundation that provides:\n- Dynamic loading and unloading of modules at runtime\n- Inter-module communication through a common API\n- Resource management and dependency handling\n- Module lifecycle management\n\n[Learn more about DMOD](https://github.com/choco-technologies/dmod)\n\n### 2. DMFSI (DMOD File System Interface)\nA standardized interface specification that:\n- Defines a comprehensive set of file system operations\n- Provides POSIX-like semantics for file and directory operations\n- Enables different file system implementations to work interchangeably\n- Ensures compatibility between VFS and underlying file systems\n\n[Learn more about DMFSI](https://github.com/choco-technologies/dmfsi)\n\n### How It Works\n\n```\n┌─────────────────────────────────────────────────┐\n│           Application Layer                      │\n│   (Uses DMVFS API for file operations)         │\n└─────────────────────────────────────────────────┘\n                      │\n                      ▼\n┌─────────────────────────────────────────────────┐\n│              DMVFS (This Project)                │\n│  • Path resolution \u0026 mount point management     │\n│  • File descriptor management                   │\n│  • Process-based file tracking                  │\n│  • Thread-safe operations                       │\n└─────────────────────────────────────────────────┘\n                      │\n                      ▼\n┌─────────────────────────────────────────────────┐\n│         DMFSI (File System Interface)           │\n│  • Standardized FS operation signatures        │\n│  • POSIX-like API definition                    │\n└─────────────────────────────────────────────────┘\n                      │\n                      ▼\n┌─────────────────────────────────────────────────┐\n│       File System Implementations                │\n│  (FatFS, RamFS, FlashFS, etc. - loaded via DMOD)│\n└─────────────────────────────────────────────────┘\n                      │\n                      ▼\n┌─────────────────────────────────────────────────┐\n│           Storage Hardware                       │\n│  (SD Card, Flash Memory, RAM, etc.)             │\n└─────────────────────────────────────────────────┘\n```\n\n## Prerequisites\n\n- **Compiler**: GCC or compatible C compiler\n- **Build System**: CMake 3.10 or higher\n- **Dependencies**:\n  - DMOD library (automatically fetched via CMake)\n  - DMFSI interface (automatically fetched via CMake)\n- **Dynamic Memory**: Your system must support dynamic memory allocation\n\n## Building\n\n### Using CMake (Recommended)\n\nDMVFS uses CMake with FetchContent to automatically download and build dependencies:\n\n```bash\n# Create build directory\nmkdir build\ncd build\n\n# Configure the project\ncmake -DCMAKE_BUILD_TYPE=Release ..\n\n# Build the library\ncmake --build .\n```\n\nThe build process will:\n1. Fetch and build the DMOD library from GitHub\n2. Fetch and build the DMFSI interface from GitHub\n3. Build the DMVFS static library (`libdmvfs.a`)\n4. Build the test suite\n\n### Build Outputs\n\nAfter building, you'll find:\n- `build/libdmvfs.a` - The DMVFS static library\n- `build/tests/fs_tester` - Test executable for file system validation\n\n## Usage\n\n### Basic Example\n\nHere's a simple example of using DMVFS in your application:\n\n```c\n#include \"dmvfs.h\"\n#include \"dmod.h\"\n\nint main(void) {\n    // Initialize DMVFS with 16 mount points and 32 max open files\n    if (!dmvfs_init(16, 32)) {\n        printf(\"Failed to initialize DMVFS\\n\");\n        return -1;\n    }\n\n    // Mount a file system at /mnt\n    // \"fatfs\" is the name of a DMOD module implementing DMFSI\n    if (!dmvfs_mount_fs(\"fatfs\", \"/mnt\", \"device=/dev/sda1\")) {\n        printf(\"Failed to mount file system\\n\");\n        dmvfs_deinit();\n        return -1;\n    }\n\n    // Open a file for writing\n    void* fp = NULL;\n    if (dmvfs_fopen(\u0026fp, \"/mnt/test.txt\", DMFSI_O_CREAT | DMFSI_O_WRONLY, 0, 0) == 0) {\n        const char* data = \"Hello, DMVFS!\";\n        size_t written = 0;\n        dmvfs_fwrite(fp, data, strlen(data), \u0026written);\n        dmvfs_fclose(fp);\n    }\n\n    // Read the file back\n    if (dmvfs_fopen(\u0026fp, \"/mnt/test.txt\", DMFSI_O_RDONLY, 0, 0) == 0) {\n        char buffer[256] = {0};\n        size_t read_bytes = 0;\n        dmvfs_fread(fp, buffer, sizeof(buffer), \u0026read_bytes);\n        printf(\"Read: %s\\n\", buffer);\n        dmvfs_fclose(fp);\n    }\n\n    // Unmount and cleanup\n    dmvfs_unmount_fs(\"/mnt\");\n    dmvfs_deinit();\n    \n    return 0;\n}\n```\n\n### API Overview\n\n#### Initialization\n- `dmvfs_init(max_mount_points, max_open_files)` - Initialize the VFS\n- `dmvfs_deinit()` - Clean up and deinitialize\n\n#### Mount Management\n- `dmvfs_mount_fs(fs_name, mount_point, config)` - Mount a file system\n- `dmvfs_unmount_fs(mount_point)` - Unmount a file system\n\n#### File Operations\n- `dmvfs_fopen(fp, path, mode, attr, pid)` - Open a file\n- `dmvfs_fclose(fp)` - Close a file\n- `dmvfs_fread(fp, buffer, size, read_bytes)` - Read from a file\n- `dmvfs_fwrite(fp, buffer, size, written_bytes)` - Write to a file\n- `dmvfs_lseek(fp, offset, whence)` - Seek to a position\n- `dmvfs_ftell(fp)` - Get current position\n- `dmvfs_feof(fp)` - Check for end-of-file\n- `dmvfs_fflush(fp)` - Flush file buffers\n\n#### Directory Operations\n- `dmvfs_mkdir(path, mode)` - Create a directory\n- `dmvfs_rmdir(path)` - Remove a directory\n- `dmvfs_opendir(dp, path)` - Open a directory\n- `dmvfs_readdir(dp, entry)` - Read directory entry\n- `dmvfs_closedir(dp)` - Close a directory\n- `dmvfs_chdir(path)` - Change current directory\n- `dmvfs_getcwd(buffer, size)` - Get current working directory\n\n#### File Management\n- `dmvfs_stat(path, stat)` - Get file/directory information\n- `dmvfs_rename(oldpath, newpath)` - Rename a file\n- `dmvfs_unlink(path)` - Delete a file\n- `dmvfs_chmod(path, mode)` - Change file permissions\n- `dmvfs_utime(path, atime, mtime)` - Update file timestamps\n\nFor complete API documentation, see `inc/dmvfs.h`.\n\n## Testing\n\nDMVFS includes a comprehensive test suite that validates file system implementations.\n\n### Building and Running Tests\n\n```bash\n# Build the project (if not already done)\ncd build\ncmake --build .\n\n# Build the test file system module\ncd ../tests/testfs/build\ncmake .. -DDMOD_MODE=DMOD_MODULE -DDMOD_DIR=../../../build/_deps/dmod-src\ncmake --build .\n\n# Run the test suite\ncd ../../../build\n./tests/fs_tester ../tests/testfs/build/dmf/testfs.dmf\n```\n\n### Test Modes\n\nThe test suite supports different modes:\n\n#### Read-Write Mode (Default)\nTests all file system operations including creation, modification, and deletion:\n```bash\n./tests/fs_tester path/to/filesystem.dmf\n```\n\n#### Read-Only Mode\nTests only read operations on existing files and directories:\n```bash\n./tests/fs_tester --read-only-fs \\\n  --test-file /mnt/existing_file.txt \\\n  --test-dir /mnt/existing_directory \\\n  path/to/filesystem.dmf\n```\n\n## Integration into Your Project\n\n### Using CMake\n\nAdd DMVFS as a subdirectory or use FetchContent:\n\n```cmake\ninclude(FetchContent)\n\nFetchContent_Declare(\n    dmvfs\n    GIT_REPOSITORY https://github.com/choco-technologies/dmvfs.git\n    GIT_TAG        master\n)\n\nFetchContent_MakeAvailable(dmvfs)\n\n# Link to your target\ntarget_link_libraries(your_target PRIVATE dmvfs)\n```\n\n### Manual Integration\n\n1. Include the `inc/` directory in your include path\n2. Link against `libdmvfs.a`\n3. Ensure DMOD and DMFSI are also linked\n\n## Project Structure\n\n```\ndmvfs/\n├── inc/                    # Public header files\n│   └── dmvfs.h            # Main DMVFS API\n├── src/                    # Source files\n│   └── dmvfs.c            # DMVFS implementation\n├── tests/                  # Test suite\n│   ├── main.c             # Test runner\n│   └── testfs/            # Example test file system\n├── CMakeLists.txt         # Build configuration\n├── LICENSE                # MIT License\n└── README.md              # This file\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues, fork the repository, and create pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Related Projects\n\n- **[DMOD](https://github.com/choco-technologies/dmod)** - Dynamic module system for embedded systems\n- **[DMFSI](https://github.com/choco-technologies/dmfsi)** - File system interface specification\n\n## Authors\n\n- Patryk Kubiak\n- Choco-Technologies Team\n\n## Support\n\nFor questions, issues, or feature requests, please open an issue on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoco-technologies%2Fdmvfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchoco-technologies%2Fdmvfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoco-technologies%2Fdmvfs/lists"}