Implements sys_fs_disk_free

This commit is contained in:
RipleyTom 2017-06-25 11:31:50 +02:00 committed by Ivan
parent dda274afb0
commit d793f8ad78
3 changed files with 24 additions and 1 deletions

View file

@ -746,7 +746,7 @@ const std::array<ppu_function_t, 1024> s_ppu_syscall_table
null_func,//BIND_FUNC(sys_fs_mount), //837 (0x345)
null_func,//BIND_FUNC(sys_fs_unmount), //838 (0x346)
null_func,//BIND_FUNC(sys_fs_sync), //839 (0x347)
null_func,//BIND_FUNC(sys_fs_disk_free), //840 (0x348)
BIND_FUNC(sys_fs_disk_free), //840 (0x348)
null_func,//BIND_FUNC(sys_fs_get_mount_info_size), //841 (0x349)
null_func,//BIND_FUNC(sys_fs_get_mount_info), //842 (0x34A)
null_func,//BIND_FUNC(sys_fs_get_fs_info_size), //843 (0x34B)

View file

@ -1166,6 +1166,28 @@ error_code sys_fs_chown(vm::cptr<char> path, s32 uid, s32 gid)
return CELL_OK;
}
error_code sys_fs_disk_free(vm::ps3::cptr<char> path, vm::ptr<u64> total_free, vm::ptr<u64> avail_free)
{
sys_fs.warning("sys_fs_disk_free(path=%s total_free=*0x%x avail_free=*0x%x)", path, total_free, avail_free);
fs::device_stat info;
if (!fs::statfs(vfs::get(path.get_ptr()), info))
{
switch (auto error = fs::g_tls_error)
{
case fs::error::noent: return CELL_ENOENT;
default: sys_fs.error("sys_fs_disk_free(): unknown error %s", error);
}
return CELL_EIO; // ???
}
*total_free = info.total_free;
*avail_free = info.avail_free; //Only value used by cellFsGetFreeSize
return CELL_OK;
}
error_code sys_fs_utime(vm::ps3::cptr<char> path, vm::ps3::cptr<CellFsUtimbuf> timep)
{
sys_fs.warning("sys_fs_utime(path=%s, timep=*0x%x)", path, timep);

View file

@ -368,6 +368,7 @@ error_code sys_fs_ftruncate(u32 fd, u64 size);
error_code sys_fs_symbolic_link(vm::ps3::cptr<char> target, vm::ps3::cptr<char> linkpath);
error_code sys_fs_chmod(vm::ps3::cptr<char> path, s32 mode);
error_code sys_fs_chown(vm::ps3::cptr<char> path, s32 uid, s32 gid);
error_code sys_fs_disk_free(vm::ps3::cptr<char> path, vm::ps3::ptr<u64> total_free, vm::ps3::ptr<u64> avail_free);
error_code sys_fs_utime(vm::ps3::cptr<char> path, vm::ps3::cptr<CellFsUtimbuf> timep);
error_code sys_fs_acl_read(vm::ps3::cptr<char> path, vm::ps3::ptr<void>);
error_code sys_fs_acl_write(vm::ps3::cptr<char> path, vm::ps3::ptr<void>);