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

Method new

block/src/qcow/raw_file.rs:50–67  ·  view source on GitHub ↗
(file: File, direct_io: bool)

Source from the content-addressed store, hash-verified

48
49impl RawFile {
50 pub fn new(file: File, direct_io: bool) -> Self {
51 // Assume no alignment restrictions if we aren't using O_DIRECT.
52 let mut alignment = 0;
53 if direct_io {
54 for align in &BLK_ALIGNMENTS {
55 if is_valid_alignment(file.as_raw_fd(), *align) {
56 alignment = *align;
57 break;
58 }
59 }
60 }
61 RawFile {
62 file,
63 alignment,
64 position: 0,
65 direct_io,
66 }
67 }
68
69 fn round_up(&self, offset: u64) -> u64 {
70 let align: u64 = self.alignment.try_into().unwrap();

Callers

nothing calls this directly

Calls 2

is_valid_alignmentFunction · 0.85
as_raw_fdMethod · 0.45

Tested by

no test coverage detected