mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: vhdx: impl AsyncDiskFile for VhdxDiskSync
try_clone() shares the Arc<Mutex<Vhdx>>. new_async_io() creates VhdxSync with a cloned Arc (no error path, infallible). Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
@@ -82,6 +82,18 @@ impl disk_file::Resizable for VhdxDiskSync {
|
|||||||
|
|
||||||
impl disk_file::DiskFile for VhdxDiskSync {}
|
impl disk_file::DiskFile for VhdxDiskSync {}
|
||||||
|
|
||||||
|
impl disk_file::AsyncDiskFile for VhdxDiskSync {
|
||||||
|
fn try_clone(&self) -> BlockResult<Box<dyn disk_file::AsyncDiskFile>> {
|
||||||
|
Ok(Box::new(VhdxDiskSync {
|
||||||
|
vhdx_file: Arc::clone(&self.vhdx_file),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_async_io(&self, _ring_depth: u32) -> BlockResult<Box<dyn AsyncIo>> {
|
||||||
|
Ok(Box::new(VhdxSync::new(Arc::clone(&self.vhdx_file))))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl DiskFile for VhdxDiskSync {
|
impl DiskFile for VhdxDiskSync {
|
||||||
fn logical_size(&mut self) -> DiskFileResult<u64> {
|
fn logical_size(&mut self) -> DiskFileResult<u64> {
|
||||||
Ok(self.vhdx_file.lock().unwrap().virtual_disk_size())
|
Ok(self.vhdx_file.lock().unwrap().virtual_disk_size())
|
||||||
|
|||||||
Reference in New Issue
Block a user