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

Method is_aligned

block/src/qcow/raw_file.rs:79–89  ·  view source on GitHub ↗
(&self, buf: &[u8])

Source from the content-addressed store, hash-verified

77 }
78
79 fn is_aligned(&self, buf: &[u8]) -> bool {
80 if self.alignment == 0 {
81 return true;
82 }
83
84 let align64: u64 = self.alignment.try_into().unwrap();
85
86 self.position.is_multiple_of(align64)
87 && (buf.as_ptr() as usize).is_multiple_of(self.alignment)
88 && buf.len().is_multiple_of(self.alignment)
89 }
90
91 pub fn set_len(&self, size: u64) -> std::io::Result<()> {
92 self.file.set_len(size)

Callers 2

readMethod · 0.80
writeMethod · 0.80

Calls 2

try_intoMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected