MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / fstatfs

Function fstatfs

components/dfs/dfs_v2/src/dfs_posix.c:775–801  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

773 * @return 0 on successful, others on failed.
774 */
775int fstatfs(int fildes, struct statfs *buf)
776{
777 int ret = -1;
778 struct dfs_file *file;
779
780 if (buf == NULL)
781 {
782 rt_set_errno(-EBADF);
783 return -1;
784 }
785
786 /* get the fd */
787 file = fd_get(fildes);
788 if (file == NULL)
789 {
790 rt_set_errno(-EBADF);
791
792 return -1;
793 }
794
795 if (dfs_is_mounted(file->dentry->mnt) == 0)
796 {
797 ret = file->dentry->mnt->fs_ops->statfs(file->dentry->mnt, buf);
798 }
799
800 return ret;
801}
802RTM_EXPORT(fstatfs);
803
804/**

Callers

nothing calls this directly

Calls 3

rt_set_errnoFunction · 0.85
dfs_is_mountedFunction · 0.85
fd_getFunction · 0.70

Tested by

no test coverage detected