Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 96cd2e3

Browse files
committedDec 2, 2024·
dirent.h: Add d_ino member to struct dirent
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.
1 parent 12fd5ec commit 96cd2e3

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
 

‎include/dirent.h

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112

113113
struct dirent
114114
{
115+
ino_t d_ino; /* file number */
115116
uint8_t d_type; /* Type of file */
116117
char d_name[NAME_MAX + 1]; /* File name */
117118
};

‎include/nuttx/fs/hostfs.h

+1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ struct nuttx_timespec
152152

153153
struct nuttx_dirent_s
154154
{
155+
ino_t d_ino; /* file number */
155156
uint8_t d_type; /* type of file */
156157
char d_name[CONFIG_NAME_MAX + 1]; /* filename */
157158
};

0 commit comments

Comments
 (0)
Please sign in to comment.