jingfei195887 opened a new pull request, #21763:
URL: https://github.com/apache/nuttx/pull/21763
## Summary
With `CONFIG_PSEUDOFS_ATTRIBUTES`, pseudo file system directories never
update their times after creation.
- **fs/inode: update the parent directory times when a node is added.**
`inode_reserve()` links a new node into a directory without touching the
directory's `st_mtime`/`st_ctime`. POSIX marks both for update when an
entry is added.
- **fs/inode: update the parent and link target times on unlink.**
`inode_unlink()` leaves the directory times unchanged when an entry is
removed, and removing a hard link leaves the target's `st_ctime` unchanged
although its link count drops.
## Impact
Only with `CONFIG_PSEUDOFS_ATTRIBUTES`: `stat()` of a pseudo directory now
reports the time of the last change to its entries, and of a hard link
target the time of the last link removal.
## Testing
Host: Ubuntu x86_64, gcc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, master
512dee8309 (rebased onto 512dee8309; no new
commit touches these files), `sim:nsh` with `CONFIG_PSEUDOFS_ATTRIBUTES`,
`CONFIG_PSEUDOFS_FILE` and `CONFIG_FS_LINKS`. A small test program compares
the times before and after each step, with a 2 second sleep in between:
| step | master | this PR |
|---|---|---|
| `mkdir()` in a pseudo directory: directory mtime | unchanged | updated |
| `rmdir()` of that child: directory mtime | unchanged | updated |
| `unlink()` of a hard link: target ctime | unchanged | updated |
- `./tools/checkpatch.sh -g master..HEAD`: all checks pass.
- Make and CMake builds pass; `ostest` exits with status 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]