jingfei195887 opened a new pull request, #22119:
URL: https://github.com/apache/nuttx/pull/22119
## Summary
- **fs/driver: unify proxy temp-name generation.**
`block_proxy()` (`fs_blockproxy.c`) and `mtd_proxy()` (`fs_mtdproxy.c`)
each carried a near-identical `unique_chardev()` / `unique_blkdev()`
helper with its own `g_devno` counter and lock, differing only in the
`/dev` name prefix. Both are folded into one `unique_devname(prefix, ...)`
in the new `fs/driver/fs_uniquedevname.c`, which Make and CMake build
whenever either proxy is built.
## Impact
- No functional change: the temporary names stay `/dev/tmpc*` (BCH
character proxy) and `/dev/tmpb*` (FTL block proxy). The two proxies now
share one counter, so a number is never reused by the other prefix.
- New internal function `unique_devname()` in `fs/driver/driver.h`; no
public API change.
- Build, hardware, documentation, security, compatibility: NO.
## Testing
Host: Ubuntu 22.04 x86_64, gcc 13.1.0. Base: master debb89e1aa9.
`sim:nsh` with `CONFIG_BOARDCTL_MKRD`, `CONFIG_BCH`, `CONFIG_MTD`,
`CONFIG_RAMMTD`, `CONFIG_FS_MTD_PROXY`, `CONFIG_FS_FAT`. Both proxy paths
are exercised: `dd` from a RAM disk opens it through `block_proxy()`, and
mounting FAT on `/dev/rammtd` goes through `mtd_proxy()`. Same output
before and after the change:
```
BLOCKPROXY_RC=0
MKFATFS_MTD_RC=0
MOUNT_MTD_RC=0
hello
```
Build matrix (Make), no warnings in the changed files, and
`fs_uniquedevname.c` is built exactly when a proxy is:
| config | proxies built |
|---|---|
| `sim:nsh` default | block |
| + `BCH`, `MTD`, `FS_MTD_PROXY` | block, mtd |
| `BCH` + `DISABLE_PSEUDOFS_OPERATIONS`, no `MTD` | none |
- `./tools/checkpatch.sh -g master..HEAD`: all checks pass.
- Make and CMake builds pass; `ostest` exits with status 0.
- 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]