| 23 | |
| 24 | impl FixedVhdDisk { |
| 25 | pub fn new(file: File, use_io_uring: bool) -> BlockResult<Self> { |
| 26 | #[cfg(not(feature = "io_uring"))] |
| 27 | if use_io_uring { |
| 28 | return Err(BlockError::new( |
| 29 | BlockErrorKind::UnsupportedFeature, |
| 30 | DiskFileError::NewAsyncIo(io::Error::other( |
| 31 | "io_uring requested but feature is not enabled", |
| 32 | )), |
| 33 | )); |
| 34 | } |
| 35 | |
| 36 | Ok(Self { |
| 37 | inner: FixedVhd::new(file).map_err(|e| BlockError::from(e).with_op(ErrorOp::Open))?, |
| 38 | use_io_uring, |
| 39 | }) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | impl disk_file::DiskSize for FixedVhdDisk { |