fs/vfs/fs_stat.c: fill file size for block inode

This commit is contained in:
Oleg 2020-05-25 18:13:00 +03:00 committed by patacongo
parent 37685110cb
commit f6c3296f76
1 changed files with 11 additions and 0 deletions

View File

@ -384,6 +384,17 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf)
/* What is if also has child inodes? */
buf->st_mode |= S_IFBLK;
#ifndef CONFIG_DISABLE_MOUNTPOINT
if ((inode->u.i_bops != NULL) && (inode->u.i_bops->geometry))
{
struct geometry geo;
if (inode->u.i_bops->geometry(inode, &geo) >= 0 && geo.geo_available)
{
buf->st_size = geo.geo_nsectors * geo.geo_sectorsize;
}
}
#endif
}
else /* if (INODE_IS_DRIVER(inode)) */
{