jingfei195887 opened a new pull request, #21890:
URL: https://github.com/apache/nuttx/pull/21890
## Summary
- **inode:use inode_addref API instead of atomic API.**
The open paths of named events (`event_open.c`), message queues
(`mq_open.c`), named semaphores (`sem_open.c`) and shared memory objects
(`shm_open.c`) took the reference on the inode they just created with an
open-coded `atomic_add(&inode->i_crefs, 1)`. Use `inode_addref()`, the
helper the rest of the VFS uses for this, so all inode references go
through one function.
## Impact
- New feature / API change: NO.
- Behavior: no functional change. `inode_addref()` does the same
`atomic_add()`; its extra NULL check never triggers here because each
call site has just created the inode.
- Build, hardware, documentation, security, compatibility: NO.
## Testing
Host: Ubuntu x86_64, gcc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, master
4bf334e462.
- `sim:nsh` with `CONFIG_FS_NAMED_EVENTS`, `CONFIG_FS_NAMED_SEMAPHORES` and
`CONFIG_FS_SHMFS` (all four changed files built; message queues are on
by default): Make and CMake builds pass with no new warnings, `ostest`
(named semaphore, message queue tests included) exits with status 0.
- `./tools/checkpatch.sh -g master..HEAD`: all checks pass.
- Verified on sim only.
## PR verification Self-Check
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing Guidelines and Documentation (git commit
title and message, coding standard, etc).
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
--
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]