Swatantra-66 opened a new pull request, #21047:
URL: https://github.com/apache/nuttx/pull/21047
## Summary
Follow-up to #20820 (`fs/vfs: Add FS_UIO to option out vector I/O`).
PR #20820 added `CONFIG_FS_UIO` to conditionally compile vector I/O
implementations (`readv()` and `writev()`), but the callback pointers (`readv`
and `writev`) in `struct file_operations` and `struct mountpt_operations`
remained unconditional. Additionally, call sites checking these operations in
`fs_inode.c`, `fs_fstat.c`, `fs_stat.c`, and `fs_truncate.c` accessed them
unconditionally.
This PR
1. Wraps the `readv` and `writev` members in both `struct file_operations`
and `struct mountpt_operations` in `include/nuttx/fs/fs.h` with `#ifdef
CONFIG_FS_UIO`
2. Guards the `->readv` and `->writev` checks in:
`fs/inode/fs_inode.c`: `inode_checkopenperm()`
`fs/vfs/fs_fstat.c`: `proxy_fstat()`
`fs/vfs/fs_stat.c`: `inode_stat()`
`fs/vfs/fs_truncate.c`: `file_truncate()`
3. Eliminates unused function pointer slots in operations tables when vector
I/O is disabled
## Impact
**Is new feature added?** No (footprint optimization / cleanup).
**User impact:** None.
**Build impact:** Clean compilation with both `CONFIG_FS_UIO=y` and
`CONFIG_FS_UIO=n`.
**Memory footprint:** Saves 2 pointer slots per operations structure
instance when vector I/O is disabled.
**Compatibility:** Struct layout alignment between `file_operations` and
`mountpt_operations` is preserved.
## Testing
**Host:** Ubuntu 22.04 / WSL2 (x86_64)
**Target:** sim:nsh
### 1. Build test with `CONFIG_FS_UIO=y` (default)
```bash
$ ./tools/configure.sh sim:nsh
$ make -j
...
LD: nuttx
CP: nuttx.hex
Done
```
### 2. Build test with `CONFIG_FS_UIO=n` (vector I/O disabled)
```bash
$ kconfig-tweak --disable CONFIG_FS_UIO
$ make -j
...
LD: nuttx
CP: nuttx.hex
Done
```
### 3. Code style verification (`nxstyle`)
```bash
$ ./tools/nxstyle -r 350,25 fs/inode/fs_inode.c
$ ./tools/nxstyle -r 110,25 fs/vfs/fs_fstat.c
$ ./tools/nxstyle -r 410,25 fs/vfs/fs_stat.c
$ ./tools/nxstyle -r 80,20 fs/vfs/fs_truncate.c
$ ./tools/nxstyle -r 240,15 include/nuttx/fs/fs.h
$ ./tools/nxstyle -r 315,15 include/nuttx/fs/fs.h
# All files passed with 0 errors
--
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]