!212 littlefs stat 接口支持获取文件类型

Merge pull request !212 from LeonChan/little-stat
This commit is contained in:
openharmony_ci 2021-07-06 09:31:36 +00:00 committed by Gitee
commit 2e621bc323
1 changed files with 5 additions and 0 deletions

View File

@ -743,6 +743,11 @@ int LfsStat(const char *path, struct stat *buf)
ret = lfs_stat(&(fileOpInfo->lfsInfo), path, &info);
if (ret == 0) {
buf->st_size = info.size;
if (info.type == LFS_TYPE_REG) {
buf->st_mode = S_IFREG;
} else {
buf->st_mode = S_IFDIR;
}
} else {
errno = LittlefsErrno(ret);
ret = VFS_ERROR;