Skip to content

Commit 7fb8f61

Browse files
xqyjljGuozhanxin
authored andcommitted
✨ feat(components/dfs/filesystems/devfs/devfs.c): add statfs support
1 parent cd1e0a7 commit 7fb8f61

File tree

1 file changed

+11
-1
lines changed
  • components/dfs/filesystems/devfs

1 file changed

+11
-1
lines changed

components/dfs/filesystems/devfs/devfs.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ int dfs_device_fs_mount(struct dfs_filesystem *fs, unsigned long rwflag, const v
2929
return RT_EOK;
3030
}
3131

32+
int dfs_device_fs_statfs(struct dfs_filesystem *fs, struct statfs *buf)
33+
{
34+
buf->f_bsize = 512;
35+
buf->f_blocks = 2048 * 64; // 64M
36+
buf->f_bfree = buf->f_blocks;
37+
buf->f_bavail = buf->f_bfree;
38+
39+
return RT_EOK;
40+
}
41+
3242
int dfs_device_fs_ioctl(struct dfs_fd *file, int cmd, void *args)
3343
{
3444
rt_err_t result;
@@ -391,7 +401,7 @@ static const struct dfs_filesystem_ops _device_fs =
391401
dfs_device_fs_mount,
392402
RT_NULL, /*unmount*/
393403
RT_NULL, /*mkfs*/
394-
RT_NULL, /*statfs*/
404+
dfs_device_fs_statfs,
395405
dfs_device_fs_unlink,
396406
dfs_device_fs_stat,
397407
RT_NULL, /*rename*/

0 commit comments

Comments
 (0)