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

Function new

hypervisor/src/lib.rs:75–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73}
74
75pub fn new() -> std::result::Result<Arc<dyn Hypervisor>, HypervisorError> {
76 #[cfg(feature = "kvm")]
77 if kvm::KvmHypervisor::is_available()? {
78 return kvm::KvmHypervisor::new();
79 }
80
81 #[cfg(feature = "mshv")]
82 if mshv::MshvHypervisor::is_available()? {
83 return mshv::MshvHypervisor::new();
84 }
85
86 Err(HypervisorError::HypervisorCreate(anyhow!(
87 "no supported hypervisor"
88 )))
89}
90
91// Returns a `Vec<T>` with a size in bytes at least as large as `size_in_bytes`.
92fn vec_with_size_in_bytes<T: Default>(size_in_bytes: usize) -> Vec<T> {

Callers 15

isa_string_from_hostFunction · 0.85
create_fdtFunction · 0.85
create_memory_nodeFunction · 0.85
create_aia_nodeFunction · 0.85
print_fdtFunction · 0.85
get_cache_sizeFunction · 0.85
get_cache_number_of_setsFunction · 0.85
get_cache_sharedFunction · 0.85
create_fdtFunction · 0.85
create_cpu_nodesFunction · 0.85
create_memory_nodeFunction · 0.85

Calls

no outgoing calls

Tested by 15

test_fdt_distance_mapFunction · 0.68
test_add_memmap_entryFunction · 0.68
test_option_parserFunction · 0.68
test_empty_inputFunction · 0.68
test_add_allFunction · 0.68
test_add_valuelessFunction · 0.68
test_convert_integerFunction · 0.68
test_toggleFunction · 0.68