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

Method limit_range_file

block/src/qcow/mod.rs:1353–1358  ·  view source on GitHub ↗

Limits the range so that it doesn't exceed the virtual size of the file.

(&self, address: u64, count: usize)

Source from the content-addressed store, hash-verified

1351
1352 // Limits the range so that it doesn't exceed the virtual size of the file.
1353 fn limit_range_file(&self, address: u64, count: usize) -> usize {
1354 if address.checked_add(count as u64).is_none() || address > self.virtual_size() {
1355 return 0;
1356 }
1357 min(count as u64, self.virtual_size() - address) as usize
1358 }
1359
1360 // Limits the range so that it doesn't overflow the end of a cluster.
1361 fn limit_range_cluster(&self, address: u64, count: usize) -> usize {

Callers 3

deallocate_bytesMethod · 0.80
readMethod · 0.80
writeMethod · 0.80

Calls 1

virtual_sizeMethod · 0.45

Tested by

no test coverage detected