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

Method is_hardlink

vmm/src/memory_manager.rs:2507–2518  ·  view source on GitHub ↗
(f: &File)

Source from the content-addressed store, hash-verified

2505 }
2506
2507 pub fn is_hardlink(f: &File) -> bool {
2508 let mut stat = std::mem::MaybeUninit::<libc::stat>::uninit();
2509 // SAFETY: FFI call with correct arguments
2510 let ret = unsafe { libc::fstat(f.as_raw_fd(), stat.as_mut_ptr()) };
2511 if ret != 0 {
2512 error!("Couldn't fstat the backing file");
2513 return false;
2514 }
2515
2516 // SAFETY: stat is valid
2517 unsafe { (*stat.as_ptr()).st_nlink as usize > 0 }
2518 }
2519
2520 pub fn virtio_mem_plugged_size(&self) -> u64 {
2521 self.memory_zones

Callers

nothing calls this directly

Calls 2

as_mut_ptrMethod · 0.80
as_raw_fdMethod · 0.45

Tested by

no test coverage detected