From 31142bcdec9b67c4d2df79eeb38dbdae97019067 Mon Sep 17 00:00:00 2001 From: xieyangrun Date: Wed, 30 Nov 2022 12:13:37 +0800 Subject: [PATCH] add struct stat st_ino default value. --- components/dfs/src/dfs_file.c | 5 +++++ components/dfs/src/dfs_posix.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index 2be7552d89..79e8a8c0c6 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -578,6 +578,11 @@ int dfs_file_stat(const char *path, struct stat *buf) return -ENOENT; } + dfs_fm_lock(); + /* FIXME */ + buf->st_ino = (size_t)dfs_fnode_find(fullpath, NULL); + dfs_fm_unlock(); + if ((fullpath[0] == '/' && fullpath[1] == '\0') || (dfs_subdir(fs->path, fullpath) == NULL)) { diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c index 96d8ecc3c9..dc81f3d516 100644 --- a/components/dfs/src/dfs_posix.c +++ b/components/dfs/src/dfs_posix.c @@ -339,6 +339,8 @@ int fstat(int fildes, struct stat *buf) /* it's the root directory */ buf->st_dev = 0; + /* FIXME */ + buf->st_ino = (size_t)d->fnode; buf->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH; -- Gitee