diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-07-01 23:11:14 +0200 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-07-01 23:11:14 +0200 |
commit | 9f025e829ab6ed468cfb51d72ac105624afc3851 (patch) | |
tree | 2aaa2efdd2aced5ace9fedd8e04c020e1a96d575 /src/cap.rs | |
parent | 4e1887f91c3f763fc8cd0797e8d96901139daf60 (diff) | |
download | mini-kvm-rs-9f025e829ab6ed468cfb51d72ac105624afc3851.tar.gz mini-kvm-rs-9f025e829ab6ed468cfb51d72ac105624afc3851.zip |
added support to query caps on kvm fd + few caps
Diffstat (limited to 'src/cap.rs')
-rw-r--r-- | src/cap.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cap.rs b/src/cap.rs new file mode 100644 index 0000000..672ca75 --- /dev/null +++ b/src/cap.rs @@ -0,0 +1,34 @@ +//! Definitions of KVM capabilities. + +use crate::kvm_sys; +use std::convert::Into; + +/// Definition of capabilities that return a bool value indicating whether the capability is +/// supported or not. +#[repr(u64)] +pub enum CapBool { + /// Check if capabilities can be queried on VM fds (`KVM_CAP_CHECK_EXTENSION_VM`). + CheckExtensionVm = kvm_sys::KVM_CAP_CHECK_EXTENSION_VM, +} + +impl Into<u64> for CapBool { + fn into(self) -> u64 { + self as u64 + } +} + +/// Definition of capabilities that return an integer value indicating the amount of the queried +/// capability. +#[repr(u64)] +pub enum CapInt { + /// Get the recommended max VPCUs (`KVM_CAP_NR_VCPUS`). + NrVcpus = kvm_sys::KVM_CAP_NR_VCPUS, + /// Get the possible max VPCUs (`KVM_CAP_MAX_VCPUS`). + MaxVcpus = kvm_sys::KVM_CAP_MAX_VCPUS, +} + +impl Into<u64> for CapInt { + fn into(self) -> u64 { + self as u64 + } +} |