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

Method new

block/src/qcow_async.rs:57–83  ·  view source on GitHub ↗
(
        metadata: Arc<QcowMetadata>,
        data_file: QcowRawFile,
        backing_file: Option<Arc<dyn BackingRead>>,
        sparse: bool,
        ring_depth: u32,
    )

Source from the content-addressed store, hash-verified

55
56impl QcowAsync {
57 pub(crate) fn new(
58 metadata: Arc<QcowMetadata>,
59 data_file: QcowRawFile,
60 backing_file: Option<Arc<dyn BackingRead>>,
61 sparse: bool,
62 ring_depth: u32,
63 ) -> io::Result<Self> {
64 let alignment = data_file.file().alignment();
65 let io_alignment = max(alignment as u64, SECTOR_SIZE);
66 let io_uring = IoUring::new(ring_depth)?;
67 let eventfd = EventFd::new(libc::EFD_NONBLOCK)?;
68 io_uring.submitter().register_eventfd(eventfd.as_raw_fd())?;
69
70 Ok(QcowAsync {
71 cluster_size: metadata.cluster_size(),
72 decoder: metadata.decoder(),
73 metadata,
74 data_file,
75 backing_file,
76 sparse,
77 alignment,
78 io_alignment,
79 io_uring,
80 eventfd,
81 completion_list: VecDeque::new(),
82 })
83 }
84
85 fn apply_dealloc_action(&mut self, action: &DeallocAction) {
86 match action {

Callers

nothing calls this directly

Calls 6

newFunction · 0.85
fileMethod · 0.80
decoderMethod · 0.80
alignmentMethod · 0.45
as_raw_fdMethod · 0.45
cluster_sizeMethod · 0.45

Tested by

no test coverage detected