dirent.h: Add d_ino member to struct dirent#15023
dirent.h: Add d_ino member to struct dirent#15023tmedicci wants to merge 1 commit intoapache:masterfrom
d_ino member to struct dirent#15023Conversation
This commit adds the `d_ino` member (`ino_t` type) to struct dirent to make it compatible with the POSIX definition of the structure. According to https://pubs.opengroup.org/onlinepubs/9799919799/, the structure `dirent` shall include the following members: ``` ino_t d_ino File serial number. char d_name[] Filename string of entry. ``` https://www.man7.org/linux/man-pages/man3/readdir.3.html also states that: " Only the fields d_name and (as an XSI extension) d_ino are specified in POSIX.1. Other than Linux, the d_type field is available mainly only on BSD systems. The remaining fields are available on many, but not all systems. " Although `d_ino` isn't being used by NuttX directly, the structure `dirent` may be used by third-party applications and it's important to have all the required members defined to avoid compatibility issues.
9259ddc to
96cd2e3
Compare
|
Just tested locally and the CI error at https://github.com/apache/nuttx/actions/runs/12126636460/job/33809240627?pr=15023#step:7:126 happens on master (3a4b8ed). It doesn't seem to be related to this PR... |
yamt
left a comment
There was a problem hiding this comment.
cf. #13556
if we add the field, i guess we should set a sane value.
at least it should be consistent with st_ino.
honestly speaking, i'm not sure if it's worth to implement d_ino for nuttx.
as the most filesystems here don't implement inode numbers at all,
applications using d_ino likely need modifications to deal with the situation anyway.
|
The |
|
some filesystem(nfs, hostfs, 9p etc) can really implement ino, so it make sense to add the basic support in vfs layer. |
if you think it's useful, i don't object. |
Yes, we should zero this field for the unsupported file system and implement it at least for hostfs. |
I proposed thir PR to enable building Python (apache/nuttx-apps#2879). I was able to make it work without it (same case of #13556), so this PR is not that necessary, although I might be able to work on it soon. |
Summary
d_inomember tostruct direntThis commit adds the
d_inomember (ino_ttype) to struct dirent to make it compatible with the POSIX definition of the structure.According to https://pubs.opengroup.org/onlinepubs/9799919799/, the structure
direntshall include the following members:https://www.man7.org/linux/man-pages/man3/readdir.3.html also states that:
"
Only the fields d_name and (as an XSI extension) d_ino are
specified in POSIX.1. Other than Linux, the d_type field is
available mainly only on BSD systems. The remaining fields are
available on many, but not all systems.
"
Although
d_inoisn't being used by NuttX directly, the structuredirentmay be used by third-party applications and it's importantto have all the required members defined to avoid compatibility issues.
Impact
No direct impact for NuttX usage, but allows third-party apps to refer to the
struct dirent's member correctly.Testing
Internal CI testing + NuttX CI