resyfer opened a new pull request, #14604: URL: https://github.com/apache/nuttx/pull/14604
## Summary This PR fixes: - Renamed `struct mfs_fsdirent` to `struct mfs_fsdirent_s` to follow the C Contributing Guidelines for styling. - Update `mnemofs_open` return value to `-ENOTDIR` when ancestor is a file. - Update `mnemofs_rmdir` return value to `-ENOTDIR` when path is not a directory. - Better logs for file and dir operations including `mnemofs_open`, `mnemofs_close`, `mnemofs_read`, `mnemofs_write`, `mnemofs_seek`, `mnemofs_opendir`, `mnemofs_readdir`, `mnemofs_rewinddir`, `mnemofs_mkdir`, `mnemofs_rmdir`, `mnemofs_stat`. - Renamed `mfs_lru_updatedinfo` to `mfs_lru_getupdatedinfo` to make it easier to understand. The change is necessary to ensure proper return values of various file system operations and to improve readability of code through better logs and better identifiers. ## Impact - Proper return value of various file system operations. - Better logs for file and dir operations. - Better readability of code. ## Testing I confirm that changes are verified on local setup and works as intended: - Build Host(s): OS (Linux), CPU(Intel), compiler(GCC 13). - Target(s): arch(sim), sim:mnemofs. Logs before: ``` nsh> custom_hello binfs_stat: Entry mnemofs_open: Mnemofs open on path "a.txt" with flags 7 and mode 50810. mnemofs_open: Lock Acquired. ... mnemofs_write: Lock acquired. mnemofs_write: Mnemofs write 20 bytes at offset 0 lru_nodesearch: Node search ended without match. ... mnemofs_write: Offset updated to 20 and size to 20 mnemofs_write: Lock released. mnemofs_write: Mnemofs write exited with 20. mnemofs_seek: Mnemofs seek. mnemofs_seek: Lock acquired. mnemofs_seek: Mnemofs seek from 20 offset to 4294967295 using whence 1. mnemofs_seek: Final position 19. mnemofs_seek: Lock released. mnemofs_write: Mnemofs write. mnemofs_write: Lock acquired. ... mnemofs_close: Mnemofs close. mnemofs_close: Lock Acquired. mnemofs_close: Original refcount is 1. ... mnemofs_close: File entry removed from the open files list. mnemofs_close: Lock Released. mnemofs_close: Mnemofs close exited with 0. ``` Logs after: ``` nsh> custom_hello binfs_stat: Entry mnemofs_open: [mnemofs | OPEN] Entry. mnemofs_open: [mnemofs | OPEN] Requested path is a.txt. mnemofs_open: [mnemofs | OPEN] Flags set as 0x7. mnemofs_open: [mnemofs | OPEN] Mode set as 0x50810. mnemofs_open: [mnemofs | OPEN] Mutex acquired. mnemofs_open: [mnemofs | OPEN] Allocated file structure at 0x503000000250. mnemofs_open: [mnemofs | OPEN] Allocated common file structure at 0x503000000280. ... mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Looking at depth 1 mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Current String is "a.txt" (0x50137f24) mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Name length is 5 mfs_get_patharr: [mnemofs | MFS_GET_PATHARR] Next String is "" ... mnemofs_write: [mnemofs | WRITE] Mutex released. mnemofs_write: [mnemofs | WRITE] Exit | Return: 2. mnemofs_seek: [mnemofs | SEEK] Entry. mnemofs_seek: [mnemofs | SEEK] Offset: 0, Whence: 0 mnemofs_seek: [mnemofs | SEEK] Mutex acquired. mnemofs_seek: [mnemofs | SEEK] File offset: 21, Command offset: 0, Whence 0. mnemofs_seek: [mnemofs | SEEK] Proposed final position: 0 mnemofs_seek: [mnemofs | SEEK] Final position: 0 ... MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] File structure details. MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] List details. MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Previous node 0x512000000150. MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Next node 0x512000000150. MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Common structure details. MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Depth: 2 MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] New Entry: true. MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Offset: 21 MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Flags: 0x7. MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Reference Counter: 0 MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] File Size: 21 MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Path details. MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Offset: 0 MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] Size: 0 MFS_EXTRA_LOG_F: [mnemofs | EXTRA_LOG_F] CTZ (0, 432). ... mnemofs_close: [mnemofs | CLOSE] Mutex released. mnemofs_close: [mnemofs | CLOSE] Exit | Return: 0. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
