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

Method new

virtio-devices/src/balloon.rs:108–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106
107impl PartiallyBalloonedPage {
108 fn new() -> Self {
109 let page_size = get_page_size();
110 let len = (page_size >> VIRTIO_BALLOON_PFN_SHIFT).div_ceil(64);
111 // Initial each padding bit as 1 in bitmap.
112 let mut bitmap = vec![0_u64; len as usize];
113 let pad_num = len * 64 - (page_size >> VIRTIO_BALLOON_PFN_SHIFT);
114 bitmap[(len - 1) as usize] = !((1 << (64 - pad_num)) - 1);
115 Self {
116 addr: 0,
117 bitmap,
118 page_size,
119 }
120 }
121
122 fn pfn_match(&self, addr: u64) -> bool {
123 self.addr == addr & !(self.page_size - 1)

Callers

nothing calls this directly

Calls 3

get_page_sizeFunction · 0.85
newFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected