diff --git a/arch/sim/src/up_hostfs.c b/arch/sim/src/up_hostfs.c index 9a4a0ed433..aeb566d5ae 100644 --- a/arch/sim/src/up_hostfs.c +++ b/arch/sim/src/up_hostfs.c @@ -195,12 +195,11 @@ void *host_opendir(const char *name) int host_readdir(void* dirp, struct nuttx_dirent_s* entry) { - struct dirent *ent; + struct dirent *ent; /* Call the host's readdir routine */ ent = readdir(dirp); - if (ent != NULL) { /* Copy the entry name */ @@ -226,10 +225,7 @@ int host_readdir(void* dirp, struct nuttx_dirent_s* entry) { entry->d_type = NUTTX_DTYPE_DIRECTORY; } - } - if (ent) - { return 0; } @@ -240,7 +236,7 @@ int host_readdir(void* dirp, struct nuttx_dirent_s* entry) * Public Functions ****************************************************************************/ -void host_rewinddir(void* dirp) +void host_rewinddir(void *dirp) { /* Just call the rewinddir routine */ @@ -251,7 +247,7 @@ void host_rewinddir(void* dirp) * Public Functions ****************************************************************************/ -int host_closedir(void* dirp) +int host_closedir(void *dirp) { return closedir(dirp); } diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c index afd3f9f125..afee46afd4 100644 --- a/fs/hostfs/hostfs.c +++ b/fs/hostfs/hostfs.c @@ -734,7 +734,6 @@ static int hostfs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir) { FAR struct hostfs_mountpt_s *fs; - struct dirent entry; int ret; /* Sanity checks */ @@ -751,7 +750,7 @@ static int hostfs_readdir(FAR struct inode *mountpt, /* Call the host OS's readdir function */ - ret = host_readdir(dir->u.hostfs.fs_dir, &entry); + ret = host_readdir(dir->u.hostfs.fs_dir, &dir->fd_dir); hostfs_semgive(fs); return ret; diff --git a/include/nuttx/fs/hostfs.h b/include/nuttx/fs/hostfs.h index e82d0a3af5..66cc304ee6 100644 --- a/include/nuttx/fs/hostfs.h +++ b/include/nuttx/fs/hostfs.h @@ -46,6 +46,8 @@ # include # include # include +#else +# include #endif /**************************************************************************** @@ -84,6 +86,10 @@ #define NUTTX_O_RDWR (NUTTX_O_RDONLY | NUTTX_O_WRONLY) +/* Should match definition in include/limits.h */ + +#define NUTTX_NAME_MAX 32 + #endif /* __SIM__ */ /**************************************************************************** @@ -109,7 +115,7 @@ typedef uint32_t nuttx_time_t; struct nuttx_dirent_s { uint8_t d_type; /* type of file */ - char d_name[NAME_MAX+1]; /* filename */ + char d_name[NUTTX_NAME_MAX+1]; /* filename */ }; /* These must exactly match the definition from include/sys/statfs.h: */