casaroli opened a new pull request, #20525:
URL: https://github.com/apache/nuttx/pull/20525

   ## Summary
   
   Two v9fs fixes, and one style-only commit for an nxstyle error in `v9fs.c`.
   
   * `readdir()` ended every directory with `errno` set to `EIO`. At the end of 
a directory the 9P server returns no entries, and `v9fs_client_convertdir()` 
returned `-EIO`. `v9fs_vfs_readdir()` now returns `-ENOENT`, which the VFS 
treats as the end of the directory. The bounds check for the fixed part of an 
entry now uses the bytes left after `head`, not the whole buffer.
   * `stat()` returned `st_ino` 0 and `readdir()` returned `d_ino` 0 for every 
file. Both now come from the qid path of the file, folded into `ino_t` the same 
way, and never 0. Programs that skip directory entries with `d_ino` 0, or 
compare `st_dev`/`st_ino`, then work on a v9fs mount.
   
   ## Impact
   
   v9fs only. No new options.
   
   ## Testing
   
   qemu-armv8a in QEMU 11 (TCG), kernel build with v9fs over virtio-9p (`-fsdev 
local,... -device virtio-9p-device,...`). A test program walks directories with 
`readdir()` and prints `d_ino`, `d_type` and `errno` at the end:
   
   ```
   nsh> dirprobe /mnt/proj/src /dev
   /mnt/proj/src: d_ino=163294653 d_type=8 a.in
   /mnt/proj/src: d_ino=163294657 d_type=8 c.in
   /mnt/proj/src: d_ino=163294655 d_type=8 b.in
   /mnt/proj/src: end, errno=0
   /dev: d_ino=3 d_type=2 console
   ...
   /dev: end, errno=0
   ```
   
   Before the change, a program that checks `errno` after `readdir()` reported 
`readdir .: I/O error` on the same mount, and a program that skips entries with 
`d_ino` 0 saw the directory as empty.
   
   Builds: `qemu-armv8a:netnsh` (v9fs enabled) and `qemu-armv8a:knsh`.
   


-- 
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]

Reply via email to