mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: Implement Resizable trait for RawFileDisk
Add disk_file::Resizable trait implementation for RawFileDisk. 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:
@@ -111,6 +111,14 @@ impl disk_file::SparseCapable for RawFileDisk {
|
||||
}
|
||||
}
|
||||
|
||||
impl disk_file::Resizable for RawFileDisk {
|
||||
fn resize(&mut self, size: u64) -> BlockResult<()> {
|
||||
self.file
|
||||
.set_len(size)
|
||||
.map_err(|e| BlockError::new(BlockErrorKind::Io, DiskFileError::ResizeError(e)))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RawFileAsync {
|
||||
fd: RawFd,
|
||||
io_uring: IoUring,
|
||||
|
||||
Reference in New Issue
Block a user