1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/vfs: Add vfs_dstatvfs

This commit is contained in:
chrysn 2022-02-15 11:56:15 +01:00
parent ff1f81aac8
commit 599eade495
2 changed files with 25 additions and 0 deletions

View File

@ -715,6 +715,17 @@ int vfs_fstat(int fd, struct stat *buf);
*/
int vfs_fstatvfs(int fd, struct statvfs *buf);
/**
* @brief Get file system status of the file system containing an open directory
*
* @param[in] dirp pointer to open directory
* @param[out] buf pointer to statvfs struct to fill
*
* @return 0 on success
* @return <0 on error
*/
int vfs_dstatvfs(vfs_DIR *dirp, struct statvfs *buf);
/**
* @brief Seek to position in file
*

View File

@ -223,6 +223,20 @@ int vfs_fstatvfs(int fd, struct statvfs *buf)
return filp->mp->fs->fs_op->statvfs(filp->mp, "/", buf);
}
int vfs_dstatvfs(vfs_DIR *dirp, struct statvfs *buf)
{
DEBUG("vfs_dstatvfs: %p, %p\n", (void*)dirp, (void *)buf);
if (buf == NULL) {
return -EFAULT;
}
memset(buf, 0, sizeof(*buf));
if (dirp->mp->fs->fs_op->statvfs == NULL) {
/* file system driver does not implement statvfs() */
return -EINVAL;
}
return dirp->mp->fs->fs_op->statvfs(dirp->mp, "/", buf);
}
off_t vfs_lseek(int fd, off_t off, int whence)
{
DEBUG("vfs_lseek: %d, %ld, %d\n", fd, (long)off, whence);