Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions arch/sim/src/sim/posix/sim_hostfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ int host_readdir(void *dirp, struct nuttx_dirent_s *entry)
strncpy(entry->d_name, ent->d_name, sizeof(entry->d_name) - 1);
entry->d_name[sizeof(entry->d_name) - 1] = 0;

entry->d_ino = ent->d_ino;

/* Map the type */

if (ent->d_type == DT_REG)
Expand Down
6 changes: 3 additions & 3 deletions fs/rpmsgfs/rpmsgfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ begin_packed_struct struct rpmsgfs_stat_priv_s
uint32_t dev; /* Device ID of device containing file */
uint32_t mode; /* File type, attributes, and access mode bits */
uint32_t rdev; /* Device ID (if file is character or block special) */
uint16_t ino; /* File serial number */
uint16_t nlink; /* Number of hard links to the file */
uint32_t ino; /* File serial number */
int64_t size; /* Size of file/directory, in bytes */
int64_t atim_sec; /* Time of last access, seconds */
int64_t atim_nsec; /* Time of last access, nanoseconds */
Expand All @@ -136,7 +135,7 @@ begin_packed_struct struct rpmsgfs_stat_priv_s
int16_t uid; /* User ID of file */
int16_t gid; /* Group ID of file */
int16_t blksize; /* Block size used for filesystem I/O */
uint16_t reserved; /* Reserved space */
uint16_t nlink; /* Number of hard links to the file */
} end_packed_struct;

begin_packed_struct struct rpmsgfs_fstat_s
Expand Down Expand Up @@ -167,6 +166,7 @@ begin_packed_struct struct rpmsgfs_readdir_s
{
struct rpmsgfs_header_s header;
int32_t fd;
uint32_t ino;
uint32_t type;
char name[0];
} end_packed_struct;
Expand Down
1 change: 1 addition & 0 deletions fs/rpmsgfs/rpmsgfs_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ static int rpmsgfs_readdir_handler(FAR struct rpmsg_endpoint *ept,
{
strlcpy(entry->d_name, rsp->name, sizeof(entry->d_name));
entry->d_type = rsp->type;
entry->d_ino = rsp->ino;
}

rpmsg_post(ept, &cookie->sem);
Expand Down
1 change: 1 addition & 0 deletions fs/rpmsgfs/rpmsgfs_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ static int rpmsgfs_readdir_handler(FAR struct rpmsg_endpoint *ept,
size = MIN(size - len, strlen(entry->d_name) + 1);
msg->type = entry->d_type;
strlcpy(msg->name, entry->d_name, size);
msg->ino = entry->d_ino;
len += size;
ret = 0;
}
Expand Down
2 changes: 2 additions & 0 deletions fs/vfs/fs_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ static int read_pseudodir(FAR struct fs_dirent_s *dir,
entry->d_type = DTYPE_DIRECTORY;
}

entry->d_ino = pdir->next->i_ino;

/* Now get the inode to visit next time that readdir() is called */

inode_lock();
Expand Down
3 changes: 2 additions & 1 deletion include/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@
* of char containing at least {NAME_MAX} plus one elements.
*
* POSIX also requires the field d_ino (type ino_t) that provides the file
* serial number. This functionality is not implemented in NuttX.
* serial number.
*/

struct dirent
{
ino_t d_ino; /* File serial number */
uint8_t d_type; /* Type of file */
char d_name[NAME_MAX + 1]; /* File name */
};
Expand Down
13 changes: 8 additions & 5 deletions include/nuttx/fs/hostfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,29 @@
/* These must match the definitions in include/sys/types.h */

typedef int16_t nuttx_blksize_t;

# ifdef CONFIG_SMALL_MEMORY
typedef int16_t nuttx_gid_t;
typedef int16_t nuttx_uid_t;
typedef uint16_t nuttx_size_t;
typedef int16_t nuttx_ssize_t;
# else /* CONFIG_SMALL_MEMORY */
typedef unsigned int nuttx_gid_t;
typedef unsigned int nuttx_uid_t;
typedef uintptr_t nuttx_size_t;
typedef intptr_t nuttx_ssize_t;
# endif /* CONFIG_SMALL_MEMORY */

typedef unsigned int nuttx_gid_t;
typedef unsigned int nuttx_uid_t;
typedef uint32_t nuttx_dev_t;
typedef uint16_t nuttx_ino_t;
typedef uint32_t nuttx_ino_t;
typedef uint16_t nuttx_nlink_t;

# ifdef CONFIG_FS_LARGEFILE
typedef int64_t nuttx_off_t;
typedef uint64_t nuttx_blkcnt_t;
# else
typedef int32_t nuttx_off_t;
typedef uint32_t nuttx_blkcnt_t;
# endif

typedef unsigned int nuttx_mode_t;
typedef int nuttx_fsid_t[2];

Expand All @@ -148,6 +150,7 @@ struct nuttx_timespec

struct nuttx_dirent_s
{
nuttx_ino_t d_ino;
uint8_t d_type; /* type of file */
char d_name[CONFIG_NAME_MAX + 1]; /* filename */
};
Expand Down
13 changes: 3 additions & 10 deletions include/sys/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,35 +123,28 @@ typedef uint16_t size_t;
typedef int16_t ssize_t;
typedef uint16_t rsize_t;

/* uid_t is used for user IDs
* gid_t is used for group IDs.
*/

typedef int16_t uid_t;
typedef int16_t gid_t;

#else /* CONFIG_SMALL_MEMORY */

typedef _size_t size_t;
typedef _ssize_t ssize_t;
typedef _size_t rsize_t;

#endif /* CONFIG_SMALL_MEMORY */

/* uid_t is used for user IDs
* gid_t is used for group IDs.
*/

typedef unsigned int uid_t;
typedef unsigned int gid_t;

#endif /* CONFIG_SMALL_MEMORY */

/* dev_t is used for device IDs */

typedef uint32_t dev_t;

/* ino_t is used for file serial numbers */

typedef uint16_t ino_t;
typedef uint32_t ino_t;

/* nlink_t is used for link counts */

Expand Down