* 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. */
| 773 | * @return 0 on successful, others on failed. |
| 774 | */ |
| 775 | int 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 | } |
| 802 | RTM_EXPORT(fstatfs); |
| 803 | |
| 804 | /** |
nothing calls this directly
no test coverage detected