crafcat7 opened a new pull request, #14844: URL: https://github.com/apache/nuttx/pull/14844
## Summary This PR is mainly from the discussion of https://github.com/apache/nuttx/pull/14479 In the current littlefs for NuttX, because the attr function is introduced, we can get/set file attributes through the interface `lfs_file_getattr` / `lfs_file_setattr` . But this requires that the mkfs tool also needs to write the file attributes when creating the file, otherwise the fstat interface will return -2 **Changes** Therefore, in littlefs_fstat we ignore the error message for -ENOENT, and when it returns we assume that it is a file with no attributes set. At the same time, a new macro `CONFIG_FS_LITTLEFS_ATTR_UPDATE` is introduced to determine whether to write the file attributes each time the file is created, which depends on `FS_LITTLEFS_ATTR_MAX` > 0 ## Impact **Is a new feature added?:** NO **Impact on build:** NO **Impact on hardware:** NO, this change does not specifically target any particular hardware architectures or boards. **Impact on documentation:** NO,This patch does not introduce any new features **Impact on compatibility:** This implementation aims to be backward compatible. No existing functionality is expected to be broken. ## Testing Build Host(s): Linux x86 Target(s): sim/nsh If we fstat a file without write attributes, it will not return -2. The result is as follows ``` nsh> cd test nsh> hello File size: 5 bytes File permissions: 777 Last access time: 0 Last modification time: 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]
