mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vmm: fix warnings when KVM is not enabled
Some imports are only used by KVM. Some variables and code become dead or unused when KVM is not enabled. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
15bf61c6aa
commit
218ec563fc
@ -57,13 +57,13 @@ use std::fs::{File, OpenOptions};
|
|||||||
use std::io::{self, sink, stdout, Seek, SeekFrom};
|
use std::io::{self, sink, stdout, Seek, SeekFrom};
|
||||||
use std::num::Wrapping;
|
use std::num::Wrapping;
|
||||||
use std::os::unix::fs::OpenOptionsExt;
|
use std::os::unix::fs::OpenOptionsExt;
|
||||||
#[cfg(feature = "pci_support")]
|
#[cfg(all(feature = "pci_support", feature = "kvm"))]
|
||||||
use std::os::unix::io::FromRawFd;
|
use std::os::unix::io::FromRawFd;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::result;
|
use std::result;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
#[cfg(feature = "pci_support")]
|
#[cfg(all(feature = "pci_support", feature = "kvm"))]
|
||||||
use vfio_ioctls::{VfioContainer, VfioDevice, VfioDmaMapping};
|
use vfio_ioctls::{VfioContainer, VfioDevice, VfioDmaMapping};
|
||||||
#[cfg(feature = "pci_support")]
|
#[cfg(feature = "pci_support")]
|
||||||
use virtio_devices::transport::VirtioPciDevice;
|
use virtio_devices::transport::VirtioPciDevice;
|
||||||
@ -92,7 +92,7 @@ use vmm_sys_util::eventfd::EventFd;
|
|||||||
#[cfg(any(feature = "mmio_support", target_arch = "aarch64"))]
|
#[cfg(any(feature = "mmio_support", target_arch = "aarch64"))]
|
||||||
const MMIO_LEN: u64 = 0x1000;
|
const MMIO_LEN: u64 = 0x1000;
|
||||||
|
|
||||||
#[cfg(feature = "pci_support")]
|
#[cfg(all(feature = "pci_support", feature = "kvm"))]
|
||||||
const VFIO_DEVICE_NAME_PREFIX: &str = "_vfio";
|
const VFIO_DEVICE_NAME_PREFIX: &str = "_vfio";
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
@ -2406,6 +2406,7 @@ impl DeviceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "pci_support")]
|
#[cfg(feature = "pci_support")]
|
||||||
|
#[cfg_attr(not(feature = "kvm"), allow(unused_variables))]
|
||||||
fn add_passthrough_device(
|
fn add_passthrough_device(
|
||||||
&mut self,
|
&mut self,
|
||||||
pci: &mut PciBus,
|
pci: &mut PciBus,
|
||||||
|
@ -251,6 +251,7 @@ pub struct Vm {
|
|||||||
cpu_manager: Arc<Mutex<cpu::CpuManager>>,
|
cpu_manager: Arc<Mutex<cpu::CpuManager>>,
|
||||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
#[cfg_attr(not(feature = "kvm"), allow(dead_code))]
|
||||||
// The hypervisor abstracted virtual machine.
|
// The hypervisor abstracted virtual machine.
|
||||||
vm: Arc<dyn hypervisor::Vm>,
|
vm: Arc<dyn hypervisor::Vm>,
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user