Struct kvm::Kvm

source ·
pub struct Kvm {
    pub(crate) kvm: File,
}
Expand description

A wrapper around opening and using /dev/kvm.

Useful for querying extensions and basic values from the KVM backend. A Kvm is required to create a Vm object.

Fields§

§kvm: File

Implementations§

source§

impl Kvm

source

pub fn new() -> Result<Kvm>

Opens /dev/kvm/ and returns a Kvm object on success.

source

pub fn new_with_path(device_path: &Path) -> Result<Kvm>

Opens a KVM device at device_path and returns a Kvm object on success.

source

pub(crate) fn check_extension_int(&self, c: Cap) -> i32

source

pub fn check_extension(&self, c: Cap) -> bool

Checks if a particular Cap is available.

source

pub fn get_vcpu_mmap_size(&self) -> Result<usize>

Gets the size of the mmap required to use vcpu’s kvm_run structure.

source

pub(crate) fn get_cpuid(&self, kind: IoctlNr) -> Result<CpuId>

source

pub fn get_supported_cpuid(&self) -> Result<CpuId>

X86 specific call to get the system supported CPUID values

source

pub fn get_emulated_cpuid(&self) -> Result<CpuId>

X86 specific call to get the system emulated CPUID values

source

pub fn get_msr_index_list(&self) -> Result<Vec<u32>>

X86 specific call to get list of supported MSRS

See the documentation for KVM_GET_MSR_INDEX_LIST.

source

pub fn get_vm_type(&self) -> c_ulong

Trait Implementations§

source§

impl AsRawDescriptor for Kvm

source§

fn as_raw_descriptor(&self) -> RawDescriptor

Returns the underlying raw descriptor. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Kvm

§

impl Send for Kvm

§

impl Sync for Kvm

§

impl Unpin for Kvm

§

impl UnwindSafe for Kvm

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsRawDescriptors for Twhere T: AsRawDescriptor,

§

fn as_raw_descriptors(&self) -> Vec<i32, Global>

Returns the underlying raw descriptors. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.