summaryrefslogtreecommitdiff
path: root/components/dfs/src
diff options
context:
space:
mode:
authorxqyjlj <[email protected]>2023-03-29 11:54:25 +0800
committerguo <[email protected]>2023-03-31 10:56:37 +0800
commitcd1e0a790124c216c5df3d3eb448e98f37f22097 (patch)
tree8ae0d8b8805c6b98a7948f2b0d17759e39986775 /components/dfs/src
parente4bd8e00f0e7b56b181c810f73249eb6fc9b63f9 (diff)
✨ feat(components): add statfs, statfs64, fstatfs, fstatfs64 support
Diffstat (limited to 'components/dfs/src')
-rw-r--r--components/dfs/src/dfs_posix.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c
index aa9c48e329..ce1a3329d3 100644
--- a/components/dfs/src/dfs_posix.c
+++ b/components/dfs/src/dfs_posix.c
@@ -521,6 +521,32 @@ int statfs(const char *path, struct statfs *buf)
RTM_EXPORT(statfs);
/**
+ * this function is a POSIX compliant version, which will return the
+ * information about a mounted file system.
+ *
+ * @param fildes the file description.
+ * @param buf the buffer to save the returned information.
+ *
+ * @return 0 on successful, others on failed.
+ */
+int fstatfs(int fildes, struct statfs *buf)
+{
+ struct dfs_fd *d;
+
+ /* get the fd */
+ d = fd_get(fildes);
+ if (d == NULL)
+ {
+ rt_set_errno(-EBADF);
+
+ return -1;
+ }
+
+ return statfs(d->vnode->fullpath, buf);
+}
+RTM_EXPORT(fstatfs);
+
+/**
* this function is a POSIX compliant version, which will make a directory
*
* @param path the directory path to be made.