mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 13:01:27 +12:00
fs::file: implement release_handle
cleanup
This commit is contained in:
parent
95d0cb18e4
commit
d766baef12
5 changed files with 48 additions and 24 deletions
|
@ -114,6 +114,9 @@ namespace fs
|
|||
virtual native_handle get_handle();
|
||||
virtual file_id get_id();
|
||||
virtual u64 write_gather(const iovec_clone* buffers, u64 buf_count);
|
||||
virtual void release()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// Directory entry (TODO)
|
||||
|
@ -251,11 +254,7 @@ namespace fs
|
|||
// Open file with specified mode
|
||||
explicit file(const std::string& path, bs_t<open_mode> mode = ::fs::read);
|
||||
|
||||
#ifdef _WIN32
|
||||
static file from_native_handle(void *handle);
|
||||
#else
|
||||
static file from_native_handle(int fd);
|
||||
#endif
|
||||
static file from_native_handle(native_handle handle);
|
||||
|
||||
// Open memory for read
|
||||
explicit file(const void* ptr, usz size);
|
||||
|
@ -286,9 +285,17 @@ namespace fs
|
|||
m_file = std::move(ptr);
|
||||
}
|
||||
|
||||
void release_handle()
|
||||
{
|
||||
if (m_file)
|
||||
{
|
||||
release()->release();
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<file_base> release()
|
||||
{
|
||||
return std::move(m_file);
|
||||
return std::exchange(m_file, nullptr);
|
||||
}
|
||||
|
||||
// Change file size (possibly appending zero bytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue