jingfei195887 opened a new pull request, #22056:
URL: https://github.com/apache/nuttx/pull/22056
## Summary
- **mtd/rpmsgmtd: propagate the remote result for ioctl and geometry.**
`rpmsgmtd_send_recv()` zeroes the cookie and returns `cookie.result`.
The erase, bread, read and write response handlers copy
`header->result` into the cookie, but `rpmsgmtd_geometry_handler()` and
`rpmsgmtd_ioctl_handler()` do not, so `rpmsgmtd_ioctl()` and
`rpmsgmtd_get_geometry()` always report success. A failed geometry
request then caches the fields the server leaves unset. Copy
`header->result` in both handlers, as the other handlers do.
## Impact
- New feature / API change: NO.
- Behavior: an ioctl or geometry request that fails on the server now
returns the server's error on the client instead of 0. Successful
requests are unchanged.
- Build, hardware, documentation, security, compatibility: NO.
## Testing
Host: Ubuntu 22.04 x86_64, gcc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0.
`sim:rpserver` exports its `/dev/rammtd` and `sim:rpproxy` registers it
through `rpmsgmtd_register()`. A small test app on the proxy opens the
remote MTD with `find_mtddriver()` and calls `MTDIOC_GEOMETRY` and then
`MTDIOC_PROTECT`, which `rammtd` does not implement (`-ENOTTY`).
Testing logs before change (master 26cf8bc84e5):
```
rpmsgmtd: GEOMETRY ret=0 blocksize=512
rpmsgmtd: PROTECT ret=0
```
Testing logs after change:
```
rpmsgmtd: GEOMETRY ret=0 blocksize=512
rpmsgmtd: PROTECT ret=-25
```
- `./tools/checkpatch.sh -g master..HEAD`: all checks pass.
- `sim:nsh` with `CONFIG_RPTUN`, `CONFIG_DEV_SIMPLE_ADDRENV`, `CONFIG_MTD`
and `CONFIG_RPMSGMTD`: Make and CMake builds pass with no warnings in
the changed file; `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]