mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
sys_fs_fsync implemented
sys_fs_fdatasync implemented as equal function
This commit is contained in:
parent
19fd8c109e
commit
256dfc5729
@ -156,6 +156,16 @@ namespace fs
|
||||
{
|
||||
}
|
||||
|
||||
stat_t file_base::stat()
|
||||
{
|
||||
fmt::throw_exception("fs::file::stat() not supported for %s", typeid(*this).name());
|
||||
}
|
||||
|
||||
void file_base::sync()
|
||||
{
|
||||
// Do notning
|
||||
}
|
||||
|
||||
dir_base::~dir_base()
|
||||
{
|
||||
}
|
||||
@ -745,6 +755,11 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
||||
return info;
|
||||
}
|
||||
|
||||
void sync() override
|
||||
{
|
||||
verify("file::sync" HERE), FlushFileBuffers(m_handle);
|
||||
}
|
||||
|
||||
bool trunc(u64 length) override
|
||||
{
|
||||
LARGE_INTEGER old, pos;
|
||||
@ -870,6 +885,11 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
||||
return info;
|
||||
}
|
||||
|
||||
void sync() override
|
||||
{
|
||||
verify("file::sync" HERE), ::fsync(m_fd) == 0;
|
||||
}
|
||||
|
||||
bool trunc(u64 length) override
|
||||
{
|
||||
if (::ftruncate(m_fd, length) != 0)
|
||||
@ -945,11 +965,6 @@ fs::file::file(const void* ptr, std::size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
fs::stat_t stat() override
|
||||
{
|
||||
fmt::raw_error("fs::file::memory_stream::stat(): not supported");
|
||||
}
|
||||
|
||||
bool trunc(u64 length) override
|
||||
{
|
||||
return false;
|
||||
|
@ -60,7 +60,8 @@ namespace fs
|
||||
{
|
||||
virtual ~file_base();
|
||||
|
||||
virtual stat_t stat() = 0;
|
||||
virtual stat_t stat();
|
||||
virtual void sync();
|
||||
virtual bool trunc(u64 length) = 0;
|
||||
virtual u64 read(void* buffer, u64 size) = 0;
|
||||
virtual u64 write(const void* buffer, u64 size) = 0;
|
||||
@ -206,6 +207,13 @@ namespace fs
|
||||
return m_file->stat();
|
||||
}
|
||||
|
||||
// Sync file buffers
|
||||
void sync() const
|
||||
{
|
||||
if (!m_file) xnull();
|
||||
return m_file->sync();
|
||||
}
|
||||
|
||||
// Read the data from the file and return the amount of data written in buffer
|
||||
u64 read(void* buffer, u64 count) const
|
||||
{
|
||||
@ -488,11 +496,6 @@ namespace fs
|
||||
{
|
||||
}
|
||||
|
||||
stat_t stat() override
|
||||
{
|
||||
fmt::raw_error("fs::container_stream<>::stat(): not supported");
|
||||
}
|
||||
|
||||
bool trunc(u64 length) override
|
||||
{
|
||||
obj.resize(length);
|
||||
|
@ -163,11 +163,20 @@ s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<u64> pos)
|
||||
return sys_fs_lseek(fd, offset, whence, pos);
|
||||
}
|
||||
|
||||
s32 cellFsFdatasync(u32 fd)
|
||||
{
|
||||
cellFs.trace("cellFsFdatasync(fd=%d)", fd);
|
||||
|
||||
// Call the syscall
|
||||
return sys_fs_fdatasync(fd);
|
||||
}
|
||||
|
||||
s32 cellFsFsync(u32 fd)
|
||||
{
|
||||
cellFs.todo("cellFsFsync(fd=0x%x)", fd);
|
||||
cellFs.trace("cellFsFsync(fd=%d)", fd);
|
||||
|
||||
return CELL_OK;
|
||||
// Call the syscall
|
||||
return sys_fs_fsync(fd);
|
||||
}
|
||||
|
||||
s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
|
||||
@ -878,12 +887,6 @@ s32 cellFsFcntl()
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellFsFdatasync()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellFs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellFsLink()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellFs);
|
||||
|
@ -738,8 +738,8 @@ std::array<ppu_function_t, 1024> g_ppu_syscall_table
|
||||
null_func,//BIND_FUNC(sys_fs_access), //816 (0x330)
|
||||
BIND_FUNC(sys_fs_fcntl), //817 (0x331)
|
||||
BIND_FUNC(sys_fs_lseek), //818 (0x332)
|
||||
null_func,//BIND_FUNC(sys_fs_fdatasync), //819 (0x333)
|
||||
null_func,//BIND_FUNC(sys_fs_fsync), //820 (0x334)
|
||||
BIND_FUNC(sys_fs_fdatasync), //819 (0x333)
|
||||
BIND_FUNC(sys_fs_fsync), //820 (0x334)
|
||||
BIND_FUNC(sys_fs_fget_block_size), //821 (0x335)
|
||||
BIND_FUNC(sys_fs_get_block_size), //822 (0x336)
|
||||
null_func,//BIND_FUNC(sys_fs_acl_read), //823 (0x337)
|
||||
|
@ -775,6 +775,38 @@ error_code sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_fs_fdatasync(u32 fd)
|
||||
{
|
||||
sys_fs.trace("sys_fs_fdadasync(fd=%d)", fd);
|
||||
|
||||
const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
return CELL_EBADF;
|
||||
}
|
||||
|
||||
file->file.sync();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_fs_fsync(u32 fd)
|
||||
{
|
||||
sys_fs.trace("sys_fs_fsync(fd=%d)", fd);
|
||||
|
||||
const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
return CELL_EBADF;
|
||||
}
|
||||
|
||||
file->file.sync();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_fs_fget_block_size(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4, vm::ptr<u64> arg5)
|
||||
{
|
||||
sys_fs.todo("sys_fs_fget_block_size(fd=%d, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", fd, sector_size, block_size, arg4, arg5);
|
||||
|
@ -300,6 +300,8 @@ error_code sys_fs_rmdir(vm::ps3::cptr<char> path);
|
||||
error_code sys_fs_unlink(vm::ps3::cptr<char> path);
|
||||
error_code sys_fs_fcntl(u32 fd, u32 op, vm::ps3::ptr<void> arg, u32 size);
|
||||
error_code sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ps3::ptr<u64> pos);
|
||||
error_code sys_fs_fdatasync(u32 fd);
|
||||
error_code sys_fs_fsync(u32 fd);
|
||||
error_code sys_fs_fget_block_size(u32 fd, vm::ps3::ptr<u64> sector_size, vm::ps3::ptr<u64> block_size, vm::ps3::ptr<u64> arg4, vm::ps3::ptr<u64> arg5);
|
||||
error_code sys_fs_get_block_size(vm::ps3::cptr<char> path, vm::ps3::ptr<u64> sector_size, vm::ps3::ptr<u64> block_size, vm::ps3::ptr<u64> arg4);
|
||||
error_code sys_fs_truncate(vm::ps3::cptr<char> path, u64 size);
|
||||
|
Loading…
Reference in New Issue
Block a user