Skip to content

Fix mount point visibility in directory listings#50

Merged
JohnAmadis merged 5 commits into
developfrom
copilot/fix-hidden-files-listing
Feb 8, 2026
Merged

Fix mount point visibility in directory listings#50
JohnAmadis merged 5 commits into
developfrom
copilot/fix-hidden-files-listing

Conversation

Copilot AI commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Directory listings (opendir/readdir) only returned entries from the underlying filesystem, omitting subdirectories that are mount points. Mounting ramfs at / and dmffs at /configs would list files in / but not show the configs directory.

Changes

Core Implementation

  • Added dir_handle_t wrapper structure to track directory state and mount point injection
  • Modified dmvfs_readdir to inject mount points as DMFSI_ATTR_DIRECTORY entries after filesystem entries exhausted
  • Modified dmvfs_opendir/dmvfs_closedir to create/cleanup wrappers

Helper Functions

  • is_direct_child_mount(dir_path, mount_path): Returns true if mount point is exactly one level below directory
  • get_basename(path, buffer, size): Extracts final path component for mount point names

Bug Fixes

  • Fixed double-free of abs_path in dmvfs_opendir
  • Fixed DMVFS_VERSION format string compilation error

Example

dmvfs_mount_fs("ramfs", "/", NULL);
dmvfs_mount_fs("dmffs", "/configs", NULL);

void* dp;
dmvfs_opendir(&dp, "/");

dmfsi_dir_entry_t entry;
while (dmvfs_readdir(dp, &entry) == 0) {
    printf("%s\n", entry.name);
    // Now includes "configs" directory entry
}

Mount points appear as directories with DMFSI_ATTR_DIRECTORY set. The wrapper is transparent to callers; existing code works unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>Ukryte pliki z listowania</issue_title>
<issue_description>Jeśli zrobimy tak:

  • W ścieżce / zamontujemy system plików np ramfs
  • W ścieżce /configs zamontujemy inny system plików np dmffs
  • I następnie zawołamy opendir na / to dostaniemy katalogi tylko z ramfs, a nie zobaczymy zamontowanego /configs - powinniśmy również go otrzymać</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 8, 2026 10:49
- Add dir_handle_t structure to wrap directory handles
- Track both filesystem entries and mount point entries
- Inject mount points as directory entries during readdir
- Add helper functions to identify child mount points
- Fix DMVFS_VERSION logging format string issue

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
- Remove duplicate Dmod_Free call for abs_path
- Add test_helpers.c for unit testing helper functions
- Add test executables to .gitignore

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
- Rename 'basename' variable to 'mount_name' to avoid conflict with POSIX basename()
- Use sizeof(entry->name) instead of magic number for buffer size
- Improve error handling in closedir to return error after cleanup
- Remove stub test files

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
- Add IMPLEMENTATION_NOTES.md with detailed explanation of the fix
- Document problem, solution, implementation details, and testing
- Include examples and compatibility notes

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
@JohnAmadis JohnAmadis marked this pull request as ready for review February 8, 2026 10:55
Copilot AI changed the title [WIP] Fix hidden files from listing in mounted file systems Fix mount point visibility in directory listings Feb 8, 2026
Copilot AI requested a review from JohnAmadis February 8, 2026 10:55
@JohnAmadis JohnAmadis merged commit 39a6ead into develop Feb 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ukryte pliki z listowania

2 participants