mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: Make vm module private
And thus only export what is necessary through a `pub use`. This is consistent with some of the other modules and makes it easier to understand what the external interface of the hypervisor crate is. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
8e1ba99e8d
commit
d3f66f8702
@@ -34,7 +34,7 @@ use hypervisor::kvm::kvm_bindings;
|
||||
use hypervisor::x86_64::{SpecialRegisters, StandardRegisters};
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use hypervisor::CpuId;
|
||||
use hypervisor::{vm::VmOps, CpuState, HypervisorCpuError, VmExit};
|
||||
use hypervisor::{CpuState, HypervisorCpuError, VmExit, VmOps};
|
||||
#[cfg(feature = "tdx")]
|
||||
use hypervisor::{TdxExitDetails, TdxExitStatus};
|
||||
use libc::{c_void, siginfo_t};
|
||||
|
||||
@@ -53,7 +53,7 @@ use devices::legacy::Serial;
|
||||
use devices::{
|
||||
interrupt_controller, interrupt_controller::InterruptController, AcpiNotificationFlags,
|
||||
};
|
||||
use hypervisor::{DeviceFd, IoEventAddress};
|
||||
use hypervisor::{DeviceFd, HypervisorVmError, IoEventAddress};
|
||||
use libc::{
|
||||
cfmakeraw, isatty, tcgetattr, tcsetattr, termios, MAP_NORESERVE, MAP_PRIVATE, MAP_SHARED,
|
||||
O_TMPFILE, PROT_READ, PROT_WRITE, TCSANOW,
|
||||
@@ -468,7 +468,7 @@ pub enum DeviceManagerError {
|
||||
InvalidIommuHotplug,
|
||||
|
||||
/// Failed to create UEFI flash
|
||||
CreateUefiFlash(hypervisor::vm::HypervisorVmError),
|
||||
CreateUefiFlash(HypervisorVmError),
|
||||
|
||||
/// Invalid identifier as it is not unique.
|
||||
IdentifierNotUnique(String),
|
||||
|
||||
@@ -49,7 +49,7 @@ use devices::interrupt_controller::{self, InterruptController};
|
||||
use devices::AcpiNotificationFlags;
|
||||
#[cfg(all(target_arch = "x86_64", feature = "gdb"))]
|
||||
use gdbstub_arch::x86::reg::X86_64CoreRegs;
|
||||
use hypervisor::vm::{HypervisorVmError, VmOps};
|
||||
use hypervisor::{HypervisorVmError, VmOps};
|
||||
use linux_loader::cmdline::Cmdline;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use linux_loader::loader::elf::PvhBootCapability::PvhEntryPresent;
|
||||
@@ -353,28 +353,28 @@ struct VmOpsHandler {
|
||||
}
|
||||
|
||||
impl VmOps for VmOpsHandler {
|
||||
fn guest_mem_write(&self, gpa: u64, buf: &[u8]) -> hypervisor::vm::Result<usize> {
|
||||
fn guest_mem_write(&self, gpa: u64, buf: &[u8]) -> result::Result<usize, HypervisorVmError> {
|
||||
self.memory
|
||||
.memory()
|
||||
.write(buf, GuestAddress(gpa))
|
||||
.map_err(|e| HypervisorVmError::GuestMemWrite(e.into()))
|
||||
}
|
||||
|
||||
fn guest_mem_read(&self, gpa: u64, buf: &mut [u8]) -> hypervisor::vm::Result<usize> {
|
||||
fn guest_mem_read(&self, gpa: u64, buf: &mut [u8]) -> result::Result<usize, HypervisorVmError> {
|
||||
self.memory
|
||||
.memory()
|
||||
.read(buf, GuestAddress(gpa))
|
||||
.map_err(|e| HypervisorVmError::GuestMemRead(e.into()))
|
||||
}
|
||||
|
||||
fn mmio_read(&self, gpa: u64, data: &mut [u8]) -> hypervisor::vm::Result<()> {
|
||||
fn mmio_read(&self, gpa: u64, data: &mut [u8]) -> result::Result<(), HypervisorVmError> {
|
||||
if let Err(vm_device::BusError::MissingAddressRange) = self.mmio_bus.read(gpa, data) {
|
||||
warn!("Guest MMIO read to unregistered address 0x{:x}", gpa);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn mmio_write(&self, gpa: u64, data: &[u8]) -> hypervisor::vm::Result<()> {
|
||||
fn mmio_write(&self, gpa: u64, data: &[u8]) -> result::Result<(), HypervisorVmError> {
|
||||
match self.mmio_bus.write(gpa, data) {
|
||||
Err(vm_device::BusError::MissingAddressRange) => {
|
||||
warn!("Guest MMIO write to unregistered address 0x{:x}", gpa);
|
||||
@@ -390,7 +390,7 @@ impl VmOps for VmOpsHandler {
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn pio_read(&self, port: u64, data: &mut [u8]) -> hypervisor::vm::Result<()> {
|
||||
fn pio_read(&self, port: u64, data: &mut [u8]) -> result::Result<(), HypervisorVmError> {
|
||||
use pci::{PCI_CONFIG_IO_PORT, PCI_CONFIG_IO_PORT_SIZE};
|
||||
|
||||
if (PCI_CONFIG_IO_PORT..(PCI_CONFIG_IO_PORT + PCI_CONFIG_IO_PORT_SIZE)).contains(&port) {
|
||||
@@ -409,7 +409,7 @@ impl VmOps for VmOpsHandler {
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn pio_write(&self, port: u64, data: &[u8]) -> hypervisor::vm::Result<()> {
|
||||
fn pio_write(&self, port: u64, data: &[u8]) -> result::Result<(), HypervisorVmError> {
|
||||
use pci::{PCI_CONFIG_IO_PORT, PCI_CONFIG_IO_PORT_SIZE};
|
||||
|
||||
if (PCI_CONFIG_IO_PORT..(PCI_CONFIG_IO_PORT + PCI_CONFIG_IO_PORT_SIZE)).contains(&port) {
|
||||
|
||||
Reference in New Issue
Block a user