Skip to content

feat: implement Dmod_ReadDirEx in dmvfs SAL layer#54

Merged
JohnAmadis merged 3 commits into
developfrom
copilot/add-dmod-readdir-ex-interface
May 26, 2026
Merged

feat: implement Dmod_ReadDirEx in dmvfs SAL layer#54
JohnAmadis merged 3 commits into
developfrom
copilot/add-dmod-readdir-ex-interface

Conversation

Copilot AI commented May 25, 2026

Copy link
Copy Markdown
Contributor

Dmod_ReadDirEx was declared in dmod_sal.h and had a weak POSIX fallback in DMOD, but dmvfs never provided its own override — leaving the interface unsupported when using the dmvfs SAL.

Changes

  • src/dmod_sal.c — Adds _ReadDirEx implementation that:
    • Calls dmvfs_readdir to retrieve the next dmfsi_dir_entry_t
    • Maps DMFSI_ATTR_DIRECTORYDmod_DirEntryType_Dir, otherwise Dmod_DirEntryType_File
    • Returns a pointer to a file-scoped static Dmod_DirEntry_t (same lifetime contract as _ReadDir)
    • Reuses g_last_dir_entry_name buffer shared with _ReadDir
    • Promotes g_last_dir_entry to file scope alongside g_last_dir_entry_name, with unified thread-safety docs covering both functions
void* dir = Dmod_OpenDir("/mnt/");
const Dmod_DirEntry_t* entry;
while ((entry = Dmod_ReadDirEx(dir)) != NULL) {
    printf("%s (%s)\n", entry->name,
           entry->type == Dmod_DirEntryType_Dir ? "dir" : "file");
}
Dmod_CloseDir(dir);

Copilot AI linked an issue May 25, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 25, 2026 20:06
Copilot AI changed the title [WIP] Add Dmod_ReadDirEx interface to SAL feat: implement Dmod_ReadDirEx in dmvfs SAL layer May 25, 2026
Copilot AI requested a review from JohnAmadis May 25, 2026 20:11
@JohnAmadis JohnAmadis marked this pull request as ready for review May 26, 2026 07:03
@JohnAmadis JohnAmadis merged commit a61a0f8 into develop May 26, 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.

brakuje Dmod_ReadDirEx

2 participants