mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Implement Resizable trait for RawFileDiskAio
Add disk_file::Resizable trait implementation for RawFileDiskAio. Calls file.set_len(size) and wraps the I/O error in BlockError on failure. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
@@ -107,6 +107,14 @@ impl disk_file::SparseCapable for RawFileDiskAio {
|
||||
}
|
||||
}
|
||||
|
||||
impl disk_file::Resizable for RawFileDiskAio {
|
||||
fn resize(&mut self, size: u64) -> BlockResult<()> {
|
||||
self.file
|
||||
.set_len(size)
|
||||
.map_err(|e| BlockError::new(BlockErrorKind::Io, DiskFileError::ResizeError(e)))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RawFileAsyncAio {
|
||||
fd: RawFd,
|
||||
ctx: aio::IoContext,
|
||||
|
||||
Reference in New Issue
Block a user