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

Function open_disk_image

block/src/lib.rs:621–627  ·  view source on GitHub ↗

Open a disk image file, returning a [`BlockError`] with path context on failure.

(path: &Path, options: &OpenOptions)

Source from the content-addressed store, hash-verified

619/// Open a disk image file, returning a [`BlockError`] with path context
620/// on failure.
621pub fn open_disk_image(path: &Path, options: &OpenOptions) -> BlockResult<File> {
622 options.open(path).map_err(|e| {
623 BlockError::new(BlockErrorKind::Io, e)
624 .with_op(ErrorOp::Open)
625 .with_path(path)
626 })
627}
628
629/// Determine image type through file parsing.
630pub fn detect_image_type(f: &mut File) -> BlockResult<ImageType> {

Callers 1

open_diskFunction · 0.85

Calls 4

newFunction · 0.85
openMethod · 0.80
with_pathMethod · 0.80
with_opMethod · 0.80

Tested by

no test coverage detected