-
Notifications
You must be signed in to change notification settings - Fork 0
Complete dmramfs implementation and update CI for RAM filesystem #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f2acbec
Initial plan
Copilot 0896e4a
Complete dmramfs implementation and update CI/release workflows
Copilot 0e272cb
Fix code review comments: add string.h include and improve error hand…
Copilot b942d3f
Final: Complete dmramfs implementation with CI updates
Copilot f78cd47
Remove codeql build artifacts and update gitignore
Copilot 27e80e9
Fix segfault: correct dmlist_insert return value check and handle emp…
Copilot 73a3d16
Add dmlist dependency info and document known fclose error messages i…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,106 @@ | ||
| # dmramfs | ||
| DMOD Ram FS | ||
|
|
||
| DMOD RAM File System - an in-memory file system module for the DMOD framework. | ||
|
|
||
| ## Overview | ||
|
|
||
| `dmramfs` is a RAM-based file system implementation that provides a fully featured, transient file system stored entirely in memory. It implements the DMOD File System Interface (DMFSI) and can be used with the DMOD Virtual File System (DMVFS). | ||
|
|
||
| ## Features | ||
|
|
||
| - **In-Memory Storage**: All files and directories are stored in RAM for fast access | ||
| - **Full File Operations**: Support for read, write, seek, truncate, and append operations | ||
| - **Directory Support**: Create, list, and navigate directories | ||
| - **File Management**: Rename, delete, and get file statistics | ||
| - **DMFSI Compliant**: Implements the standard DMOD file system interface | ||
|
|
||
| ## Dependencies | ||
|
|
||
| This module requires the following system libraries: | ||
| - **dmlist** - DMOD linked list library (fetched automatically via CMake FetchContent) | ||
|
|
||
| ## Building | ||
|
|
||
| ```bash | ||
| mkdir build | ||
| cd build | ||
| cmake .. -DDMOD_MODE=DMOD_MODULE | ||
| cmake --build . | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| The module can be loaded and mounted using DMVFS: | ||
|
|
||
| ```c | ||
| #include "dmvfs.h" | ||
|
|
||
| // Initialize DMVFS | ||
| dmvfs_init(16, 32); | ||
|
|
||
| // Mount the RAM filesystem at /mnt | ||
| dmvfs_mount_fs("dmramfs", "/mnt", NULL); | ||
|
|
||
| // Use standard file operations | ||
| void* fp; | ||
| dmvfs_fopen(&fp, "/mnt/test.txt", DMFSI_O_CREAT | DMFSI_O_RDWR, 0, 0); | ||
| dmvfs_fwrite(fp, "Hello, World!", 13, NULL); | ||
| dmvfs_fclose(fp); | ||
|
|
||
| // Unmount when done | ||
| dmvfs_unmount_fs("/mnt"); | ||
| dmvfs_deinit(); | ||
| ``` | ||
|
|
||
| ## API | ||
|
|
||
| The module implements the full DMFSI interface: | ||
|
|
||
| ### File Operations | ||
| - `_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 (no-op for RAM FS) | ||
| - `_fflush` - Flush buffers (no-op for RAM FS) | ||
|
|
||
| ### Directory Operations | ||
| - `_mkdir` - Create a directory | ||
| - `_opendir` - Open a directory for reading | ||
| - `_readdir` - Read directory entries | ||
| - `_closedir` - Close a directory | ||
| - `_direxists` - Check if directory exists | ||
|
|
||
| ### File Management | ||
| - `_stat` - Get file/directory statistics | ||
| - `_unlink` - Delete a file | ||
| - `_rename` - Rename a file | ||
|
|
||
| ## Testing | ||
|
|
||
| Tests are run using the `fs_tester` tool from the dmvfs repository: | ||
|
|
||
| ```bash | ||
| # Build dmvfs with tests | ||
| cd /path/to/dmvfs | ||
| mkdir build && cd build | ||
| cmake .. -DDMOD_MODE=DMOD_SYSTEM -DDMVFS_BUILD_TESTS=ON | ||
| cmake --build . | ||
|
|
||
| # Run tests against dmramfs | ||
| ./tests/fs_tester /path/to/dmramfs.dmf | ||
| ``` | ||
|
|
||
| ## Known Issues | ||
|
|
||
| When running `fs_tester`, you may see `[ERROR] Failed to close file` messages even though tests pass. This is due to a return value convention mismatch in the dmvfs layer (which expects boolean success/failure) versus the DMFSI interface convention (which uses 0 for success). The actual file operations work correctly despite these messages. | ||
|
|
||
| ## License | ||
|
|
||
| See [LICENSE](LICENSE) file for details. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dodaj jeszcze informacje, że moduł ten wymaga biblioteki systemowej
dmlistOraz sprawdź czy to normalne że fs_tester pomimo przechodzenia testów drukuje błąd o problemach z zamknięciem pliku
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the
dmlistdependency information in commit73a3d16.Regarding the fclose errors: they appear because dmvfs checks
if (!fclose_func(...))expecting boolean (non-zero = success), but DMFSI convention uses 0 (DMFSI_OK) for success. This is a mismatch in dmvfs, not dmramfs. The file operations work correctly - tests pass because the actual cleanup still happens. I documented this in the "Known Issues" section.