MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / open_raw

Function open_raw

block/src/factory.rs:142–169  ·  view source on GitHub ↗
(
    file: fs::File,
    options: &DiskOpenOptions<'_>,
)

Source from the content-addressed store, hash-verified

140}
141
142fn open_raw(
143 file: fs::File,
144 options: &DiskOpenOptions<'_>,
145) -> BlockResult<Box<dyn AsyncFullDiskFile>> {
146 if !options.readonly && !options.sparse {
147 preallocate_disk(&file, options.path);
148 }
149
150 #[cfg(feature = "io_uring")]
151 if !options.disable_io_uring {
152 if io_uring_supported() {
153 info!("Opening RAW disk file with io_uring backend");
154 return Ok(Box::new(RawDisk::new(file, RawBackend::IoUring)));
155 }
156 info!("io_uring runtime probe failed for RAW, trying next backend");
157 }
158
159 if !options.disable_aio {
160 if aio_supported() {
161 info!("Opening RAW disk file with AIO backend");
162 return Ok(Box::new(RawDisk::new(file, RawBackend::Aio)));
163 }
164 info!("AIO runtime probe failed for RAW, using synchronous backend");
165 }
166
167 info!("Opening RAW disk file with synchronous backend");
168 Ok(Box::new(RawDisk::new(file, RawBackend::Sync)))
169}
170
171fn open_qcow2(
172 file: fs::File,

Callers 1

open_diskFunction · 0.85

Calls 4

preallocate_diskFunction · 0.85
io_uring_supportedFunction · 0.85
newFunction · 0.85
aio_supportedFunction · 0.85

Tested by

no test coverage detected