Implement fs::file::write_gather (Vectored I/O)

This commit is contained in:
Nekotekina 2019-06-03 22:57:59 +03:00
parent 31994dd3b2
commit 447029a700
3 changed files with 64 additions and 6 deletions

View file

@ -65,6 +65,13 @@ namespace fs
s64 ctime;
};
// Helper, layout is equal to iovec struct
struct iovec_clone
{
const void* iov_base;
std::size_t iov_len;
};
// File handle base
struct file_base
{
@ -78,6 +85,7 @@ namespace fs
virtual u64 seek(s64 offset, seek_mode whence) = 0;
virtual u64 size() = 0;
virtual native_handle get_handle();
virtual u64 write_gather(const iovec_clone* buffers, u64 buf_count);
};
// Directory entry (TODO)
@ -362,6 +370,13 @@ namespace fs
// Get native handle if available
native_handle get_handle() const;
// Gathered write
u64 write_gather(const iovec_clone* buffers, u64 buf_count) const
{
if (!m_file) xnull();
return m_file->write_gather(buffers, buf_count);
}
#ifdef _WIN32
// Windows-specific function
bool set_delete(bool autodelete = true) const;