diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c index 36ef3fd90a7..e225d8e79dd 100644 --- a/fs/rpmsgfs/rpmsgfs.c +++ b/fs/rpmsgfs/rpmsgfs.c @@ -78,6 +78,7 @@ struct rpmsgfs_mountpt_s char fs_root[PATH_MAX]; void *handle; int timeout; /* Connect timeout */ + struct statfs statfs; }; /**************************************************************************** @@ -1232,12 +1233,21 @@ static int rpmsgfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) return ret; } + if (fs->statfs.f_type == RPMSGFS_MAGIC) + { + memcpy(buf, &fs->statfs, sizeof(struct statfs)); + rpmsgfs_semgive(fs); + return 0; + } + /* Call the host fs to perform the statfs */ memset(buf, 0, sizeof(struct statfs)); ret = rpmsgfs_client_statfs(fs->handle, fs->fs_root, buf); buf->f_type = RPMSGFS_MAGIC; + memcpy(&fs->statfs, buf, sizeof(struct statfs)); + rpmsgfs_semgive(fs); return ret; }