diff --git a/fs/vfs/fs_stat.c b/fs/vfs/fs_stat.c index 91e8631b875..74b11e94028 100644 --- a/fs/vfs/fs_stat.c +++ b/fs/vfs/fs_stat.c @@ -46,6 +46,8 @@ #include #include "inode/inode.h" +#include +#include /**************************************************************************** * Pre-processor Definitions @@ -303,6 +305,14 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf) buf->st_mode = S_IFMTD; buf->st_mode |= S_IROTH | S_IRGRP | S_IRUSR; buf->st_mode |= S_IWOTH | S_IWGRP | S_IWUSR; + + struct mtd_geometry_s mtdgeo; + if (inode->u.i_mtd + && MTD_IOCTL(inode->u.i_mtd, MTDIOC_GEOMETRY, + (unsigned long)((uintptr_t)&mtdgeo)) >= 0) + { + buf->st_size = mtdgeo.neraseblocks * mtdgeo.erasesize; + } } else #endif