misc: devices: 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:18 +02:00
committed by Rob Bradford
parent 5f66a26b2e
commit e39174ac51
18 changed files with 22 additions and 11 deletions

View File

@@ -9,6 +9,7 @@ use std::thread;
use std::time::Instant;
use acpi_tables::{Aml, AmlSink, aml};
use log::{error, info, warn};
use vm_device::BusDevice;
use vm_device::interrupt::InterruptSourceGroup;
use vm_memory::GuestAddress;

View File

@@ -3,8 +3,6 @@
//
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
use super::interrupt_controller::{Error, InterruptController};
extern crate arch;
use std::result;
use std::sync::{Arc, Mutex};
@@ -19,6 +17,8 @@ use vm_memory::address::Address;
use vm_migration::{Migratable, Pausable, Snapshottable, Transportable};
use vmm_sys_util::eventfd::EventFd;
use super::interrupt_controller::{Error, InterruptController};
type Result<T> = result::Result<T, Error>;
// Reserve 32 IRQs for legacy devices.

View File

@@ -9,6 +9,7 @@ use std::io;
use std::io::Write;
use std::sync::{Arc, Barrier};
use log::error;
use vm_device::BusDevice;
use vm_migration::{Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable};

View File

@@ -2,8 +2,6 @@
//
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
use super::interrupt_controller::{Error, InterruptController};
extern crate arch;
use std::result;
use std::sync::{Arc, Mutex};
@@ -19,6 +17,8 @@ use vm_memory::address::Address;
use vm_migration::{Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable};
use vmm_sys_util::eventfd::EventFd;
use super::interrupt_controller::{Error, InterruptController};
type Result<T> = result::Result<T, Error>;
// Reserve 32 IRQs for legacy devices.

View File

@@ -13,6 +13,7 @@ use std::result;
use std::sync::{Arc, Barrier};
use byteorder::{ByteOrder, LittleEndian};
use log::{debug, error, trace, warn};
use serde::{Deserialize, Serialize};
use vm_device::BusDevice;
use vm_device::interrupt::{

View File

@@ -11,6 +11,7 @@ use std::sync::{Arc, Barrier, Mutex};
use anyhow::anyhow;
use byteorder::{ByteOrder, LittleEndian};
use log::{debug, error, warn};
use pci::{
BarReprogrammingParams, PCI_CONFIGURATION_ID, PciBarConfiguration, PciBarPrefetchable,
PciBarRegionType, PciClassCode, PciConfiguration, PciDevice, PciDeviceError, PciHeaderType,

View File

@@ -13,6 +13,7 @@ use std::{mem, thread};
#[cfg_attr(target_env = "musl", allow(deprecated))]
use libc::time_t;
use libc::{CLOCK_REALTIME, clock_gettime, gmtime_r, timespec, tm};
use log::{info, warn};
use vm_device::BusDevice;
use vmm_sys_util::eventfd::EventFd;

View File

@@ -6,6 +6,7 @@
use std::fmt;
use std::time::Instant;
use log::{error, warn};
use vm_device::BusDevice;
/// Debug I/O port, see:

View File

@@ -35,6 +35,7 @@ use bitfield_struct::bitfield;
use linux_loader::bootparam::boot_params;
#[cfg(target_arch = "aarch64")]
use linux_loader::loader::pe::arm64_image_header as boot_params;
use log::{debug, error};
use vm_device::BusDevice;
use vm_memory::bitmap::AtomicBitmap;
use vm_memory::{

View File

@@ -9,6 +9,7 @@
use std::sync::{Arc, Barrier};
use log::error;
use vm_device::BusDevice;
/// Provides firmware debug output via I/O port controls

View File

@@ -10,6 +10,7 @@
use std::sync::{Arc, Barrier};
use std::{io, result};
use log::warn;
use serde::{Deserialize, Serialize};
use thiserror::Error;
use vm_device::BusDevice;

View File

@@ -8,6 +8,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Barrier};
use std::thread;
use log::{error, info};
use vm_device::BusDevice;
use vmm_sys_util::eventfd::EventFd;

View File

@@ -15,6 +15,7 @@ use std::result;
use std::sync::{Arc, Barrier};
use std::time::Instant;
use log::warn;
use thiserror::Error;
use vm_device::BusDevice;

View File

@@ -11,6 +11,7 @@ use std::sync::{Arc, Barrier};
use std::time::Instant;
use std::{io, result};
use log::{debug, warn};
use serde::{Deserialize, Serialize};
use thiserror::Error;
use vm_device::BusDevice;

View File

@@ -7,13 +7,6 @@
//! Emulates virtual and hardware devices.
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate event_monitor;
#[macro_use]
extern crate log;
pub mod acpi;
#[cfg(target_arch = "riscv64")]
pub mod aia;
@@ -34,6 +27,8 @@ pub mod pvpanic;
#[cfg(not(target_arch = "riscv64"))]
pub mod tpm;
use bitflags::bitflags;
pub use self::acpi::{AcpiGedDevice, AcpiPmTimerDevice, AcpiShutdownDevice};
#[cfg(feature = "ivshmem")]
pub use self::ivshmem::IvshmemDevice;

View File

@@ -8,6 +8,7 @@ use std::ffi::CString;
use std::sync::{Arc, Barrier, Mutex, RwLock};
use std::{io, result};
use log::{debug, warn};
use num_enum::TryFromPrimitive;
use pci::{
BarReprogrammingParams, PciBarConfiguration, PciBarPrefetchable, PciBarRegionType,

View File

@@ -8,6 +8,8 @@ use std::result;
use std::sync::{Arc, Barrier, Mutex};
use anyhow::anyhow;
use event_monitor::event;
use log::{debug, info};
use pci::{
BarReprogrammingParams, PCI_CONFIGURATION_ID, PciBarConfiguration, PciBarPrefetchable,
PciBarRegionType, PciClassCode, PciConfiguration, PciDevice, PciDeviceError, PciHeaderType,

View File

@@ -11,6 +11,7 @@ use anyhow::anyhow;
use arch::aarch64::layout::{TPM_SIZE, TPM_START};
#[cfg(target_arch = "x86_64")]
use arch::x86_64::layout::{TPM_SIZE, TPM_START};
use log::{debug, error, warn};
use thiserror::Error;
use tpm::TPM_CRB_BUFFER_MAX;
use tpm::emulator::{BackendCmd, Emulator};