xiaoxiang781216 opened a new pull request, #3554:
URL: https://github.com/apache/nuttx-apps/pull/3554
## Summary
The `userfs` example initialized each `g_rootdir[]` entry's
`struct dirent` member positionally as `{ DTYPE_FILE, "FileN" }`, which
assumes `d_type` is the first field of `struct dirent`.
apache/nuttx PR #19179 ("fs: widen ino_t to uint32_t and add d_ino to
struct dirent") adds the POSIX `d_ino` member as the first field of
`struct dirent`. With that change the positional initializer assigns the
file-name string to `d_type` (a `uint8_t`), producing
`-Wint-conversion` warnings and an
`error: initializer element is not computable at load time`, which broke
the CI build.
This change converts the three initializers to designated initializers
(`.d_type` / `.d_name`) so the table is robust against the field order of
`struct dirent`.
## Impact
* `examples/userfs` only. No functional change; the same `d_type`/`d_name`
values are assigned. `d_ino` is left zero-initialized, which is fine for
this in-memory test filesystem.
## Testing
* `checkpatch.sh -f examples/userfs/userfs_main.c` → all checks pass.
* A standalone host program reproducing the table against a `d_ino`-first
`struct dirent` compiles cleanly with `-Wall -Wextra -Werror` and assigns
`d_type=DTYPE_FILE`, `d_name="File1"` as expected.
## Related
* Companion to apache/nuttx#19179. That PR's CI build fails on the current
positional initializer; this PR fixes it. They should be merged together.
--
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]