Commit 0c963449d6, 'fs/vfs: Added support for checking if a descriptor is a socket in fstat().', changed sys/stat.h in way that breaks smartfs file-type stat flags. CROMFS is similarly broken, as tools/gencromfs.c was not updated to match the sys/stat.h changes. This commit fixes both issues. It probably is not a good idea to use NuttX sys/stat.h bit-field values directly in stored structure of filesystem.

This commit is contained in:
Jussi Kivilinna 2018-06-28 07:40:35 -06:00 committed by Gregory Nutt
parent 044d538da3
commit 214e9d923e
2 changed files with 8 additions and 3 deletions

View File

@ -1931,7 +1931,12 @@ static void smartfs_stat_common(FAR struct smartfs_mountpt_s *fs,
}
else
{
buf->st_mode = entry->flags & 0xFFF;
/* Mask out the file type */
buf->st_mode = entry->flags & ~S_IFMT;
/* Add the file type based on the SmartFS entry flags */
if ((entry->flags & SMARTFS_DIRENT_TYPE) == SMARTFS_DIRENT_TYPE_DIR)
{
buf->st_mode |= S_IFDIR;

View File

@ -100,8 +100,8 @@
#define NUTTX_IRXUSR (NUTTX_IRUSR | NUTTX_IXUSR)
#define NUTTX_IFDIR (2 << 12)
#define NUTTX_IFREG (4 << 12)
#define NUTTX_IFDIR (2 << 11)
#define NUTTX_IFREG (4 << 11)
#define NUTTX_IFLNK (1 << 15) /* Bit 15: Symbolic link */