-
Notifications
You must be signed in to change notification settings - Fork 0
Implement dmdevfs module with full subdirectory support and device file discovery #7
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
Conversation
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
… handling Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
JohnAmadis
left a comment
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.
@copilot popraw proszę te rzeczy
| // TODO: Implement directory opening | ||
| return DMFSI_ERR_GENERAL; | ||
| // Only support opening root directory | ||
| if (is_root_path(path)) |
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.
dlaczego niby masz wspierać tylko otwieranie root directory? A co z otwieraniem folderów podrzędnych? Też musi być wspierane
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.
Fixed in commit 480b06d. Now supports opening device subdirectories (e.g., /uart0/) for drivers with MINOR numbering. Added helper functions to find and validate subdirectory paths.
src/dmdevfs.c
Outdated
| // TODO: Implement directory existence check | ||
| return 0; | ||
| // Only root directory exists | ||
| return is_root_path(path) ? 1 : 0; |
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.
to nie jest prawda, bo jeśli dla jakiegoś drivera został stworzony katalog np /dev/uart0/ to też musimy go wspierać
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.
Fixed in commit 480b06d. Now checks both root directory and device subdirectories using path_is_device_subdir() helper.
src/dmdevfs.c
Outdated
| // Log device file information based on dev_num flags | ||
| if (driver_node->dev_num.flags == DMDRVI_NUM_NONE) | ||
| { | ||
| Dmod_Printf("dmdevfs: Device created: %s\n", driver_name); |
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.
co to za głupi ifelse? Przecież nazwę pliku możesz prosto skleić... A tak robisz głupie jakieś ifelsy, długi kod ze względu na logi
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.
Fixed in commit 480b06d. Simplified to just concatenate driver name + major (if present) + "/" + minor (if present). Much cleaner now.
src/dmdevfs.c
Outdated
| } | ||
| else if (driver_node->dev_num.flags & DMDRVI_NUM_MINOR) | ||
| { | ||
| Dmod_Printf("dmdevfs: Device created: %s%d/%d (major/minor)\n", |
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.
do logowania używamy DMOD_LOG_INFO, DMOD_LOG_ERROR, DMOD_LOG_WARN albo DMOD_LOG_VERBOSE
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.
Fixed in commit 480b06d. Changed to DMOD_LOG_INFO.
src/dmdevfs.c
Outdated
| } | ||
| else if (driver_node->dev_num.flags & DMDRVI_NUM_MAJOR) | ||
| { | ||
| Dmod_Printf("dmdevfs: Device created: %s%d (major)\n", |
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.
jak użyjesz makr z DMOD_LOG_<> to one już dodają nazwę modułu
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.
Fixed in commit 480b06d. Removed "dmdevfs:" prefix from all DMOD_LOG calls throughout the file.
src/dmdevfs.c
Outdated
| if (driver_node->dev_num.flags == DMDRVI_NUM_NONE) | ||
| { | ||
| // Device file: /dev/dmclk -> dmclk (no /dev prefix needed) | ||
| snprintf(filename, size, "%s", driver_node->driver_name); |
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.
Dmod_SnPrintf!!! nie masz używać stdio
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.
Fixed in commit 480b06d. Replaced snprintf with Dmod_SnPrintf and removed stdio.h include.
…g, use DMOD functions Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
All feedback addressed in commit 480b06d:
|
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
The module lacked core functionality: scanning configuration files, loading drivers via dmdrvi interface, and presenting device files through directory operations with full subdirectory support.
Changes
Device file tracking and hierarchy
driver_node_tto store driver name for device file namingbuild_device_filename()with simplified concatenation logic (driver + major + "/" + minor)/dev/uart0/containing minor device files)/dev/uart1)/dev/dmclk)DMOD_LOG_INFOFull directory operations
_opendir,_readdir,_closedir,_direxistsfor both root and subdirectories_opendirsupports opening device subdirectories (e.g.,/uart0/)_readdirproperly differentiates between directories and files, listing:dir_handle_tto track path and parent driver for subdirectory supportfind_driver_by_subdir(),path_is_device_subdir()Configuration parsing
driver_namefrom[main]section, falls back to filename without.inidmdrvi_create()with parsed INI context per driverDocumentation
dmdfsnotdmdevfs.iniconfig examples showingdriver_nameusage/devCode quality
Dmod_SnPrintf,Dmod_StrLen,Dmod_StrNCpy,Dmod_StrCmpDMOD_LOG_INFO/DMOD_LOG_ERRORfor logging (no module name prefix - added automatically)Example usage
File I/O operations (read/write) remain TODO - outside scope of device discovery and initialization.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.