misc: hypervisor: drop extern crate, use modern rust

This commit is part of a series of similar commits.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster 2025-09-05 09:20:33 +02:00 committed by Rob Bradford
parent e39174ac51
commit b3f929432e
10 changed files with 20 additions and 12 deletions

View file

@ -4,6 +4,7 @@
// SPDX-License-Identifier: Apache-2.0
//
use anyhow::anyhow;
use iced_x86::*;
use crate::arch::emulator::{EmulationError, PlatformEmulator, PlatformError};

View file

@ -10,6 +10,8 @@
// MOVS - Move Data from String to String
//
use anyhow::anyhow;
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::regs::DF;

View file

@ -10,6 +10,8 @@
// STOS - Store String
//
use anyhow::anyhow;
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::regs::DF;

View file

@ -4,8 +4,9 @@
// SPDX-License-Identifier: Apache-2.0
//
use anyhow::Context;
use anyhow::{Context, anyhow};
use iced_x86::*;
use log::debug;
use crate::StandardRegisters;
use crate::arch::emulator::{EmulationError, EmulationResult, PlatformEmulator, PlatformError};

View file

@ -12,7 +12,7 @@
use thiserror::Error;
#[cfg(not(target_arch = "riscv64"))]
use vm_memory::GuestAddress;
use {anyhow::anyhow, vm_memory::GuestAddress};
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
use crate::RegList;

View file

@ -25,7 +25,10 @@ use std::sync::Mutex;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, RwLock};
use anyhow::anyhow;
use kvm_ioctls::{NoDatamatch, VcpuFd, VmFd};
#[cfg(target_arch = "x86_64")]
use log::warn;
use vmm_sys_util::eventfd::EventFd;
#[cfg(target_arch = "aarch64")]

View file

@ -21,12 +21,6 @@
//! - riscv64 (experimental)
//!
#[macro_use]
extern crate anyhow;
#[allow(unused_imports)]
#[macro_use]
extern crate log;
/// Architecture specific definitions
#[macro_use]
pub mod arch;
@ -53,6 +47,7 @@ mod device;
use std::sync::Arc;
use anyhow::anyhow;
use concat_idents::concat_idents;
#[cfg(target_arch = "x86_64")]
pub use cpu::CpuVendor;

View file

@ -3,6 +3,8 @@
// Copyright © 2025, Microsoft Corporation
//
use anyhow::anyhow;
use crate::arch::aarch64::regs::{EsrEl2, ExceptionClass, IssDataAbort};
use crate::arch::emulator::PlatformError;
use crate::cpu::Vcpu;

View file

@ -9,8 +9,8 @@ use std::collections::HashMap;
use std::num::NonZeroUsize;
use std::sync::{Arc, RwLock};
#[cfg(feature = "sev_snp")]
use arc_swap::ArcSwap;
use anyhow::anyhow;
use log::{debug, warn};
use mshv_bindings::*;
#[cfg(target_arch = "x86_64")]
use mshv_ioctls::InterruptRequest;
@ -19,6 +19,8 @@ use vfio_ioctls::VfioDeviceFd;
use vm::DataMatch;
#[cfg(feature = "sev_snp")]
use vm_memory::bitmap::AtomicBitmap;
#[cfg(feature = "sev_snp")]
use {arc_swap::ArcSwap, log::info};
#[cfg(target_arch = "aarch64")]
use crate::arch::aarch64::regs::{
@ -271,7 +273,6 @@ impl hypervisor::Hypervisor for MshvHypervisor {
/// # Examples
///
/// ```
/// # extern crate hypervisor;
/// use hypervisor::mshv::MshvHypervisor;
/// use hypervisor::mshv::MshvVm;
/// use hypervisor::HypervisorVmConfig;
@ -1700,7 +1701,6 @@ impl MshvVm {
/// # Examples
///
/// ```
/// extern crate hypervisor;
/// use hypervisor::mshv::MshvHypervisor;
/// use hypervisor::HypervisorVmConfig;
/// use std::sync::Arc;

View file

@ -3,7 +3,9 @@
// Copyright © 2024, Microsoft Corporation
//
use anyhow::anyhow;
use iced_x86::Register;
use log::debug;
use mshv_bindings::*;
use crate::arch::emulator::{PlatformEmulator, PlatformError};