diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c index 354c603b706..f71425df330 100644 --- a/fs/romfs/fs_romfs.c +++ b/fs/romfs/fs_romfs.c @@ -256,6 +256,7 @@ static int romfs_open(FAR struct file *filep, FAR const char *relpath, */ rf->rf_size = dirinfo.rd_size; + rf->rf_type = (uint8_t)(dirinfo.rd_next & RFNEXT_ALLMODEMASK); /* Get the start of the file data */ @@ -737,7 +738,7 @@ static int romfs_fstat(FAR const struct file *filep, FAR struct stat *buf) { /* Return information about the directory entry */ - ret = romfs_stat_common(RFNEXT_FILE, rf->rf_size, + ret = romfs_stat_common(rf->rf_type, rf->rf_size, rm->rm_hwsectorsize, buf); } diff --git a/fs/romfs/fs_romfs.h b/fs/romfs/fs_romfs.h index 12ab8d88239..336e0efaf65 100644 --- a/fs/romfs/fs_romfs.h +++ b/fs/romfs/fs_romfs.h @@ -158,11 +158,12 @@ struct romfs_mountpt_s struct romfs_file_s { - struct romfs_file_s *rf_next; /* Retained in a singly linked list */ + FAR struct romfs_file_s *rf_next; /* Retained in a singly linked list */ uint32_t rf_startoffset; /* Offset to the start of the file data */ uint32_t rf_size; /* Size of the file in bytes */ uint32_t rf_cachesector; /* Current sector in the rf_buffer */ uint8_t *rf_buffer; /* File sector buffer, allocated if rm_xipbase==0 */ + uint8_t rf_type; /* File type (for fstat()) */ }; /* This structure is used internally for describing the result of