devices: trim qualified paths

Import the modules used in the crate instead of spelling the
fully-qualified paths at every use site, and collapse Result<T,
io::Error> into io::Result<T>. This covers the feature-gated modules
(fw_cfg, ivshmem, pvmemcontrol) as well, leaving the whole crate free
of clippy::absolute_paths warnings.

Signed-off-by: Henry Hrvoje Tonkovac <htonkovac@gmail.com>
Assisted-by: Claude:Opus-4.8
This commit is contained in:
Henry Hrvoje Tonkovac
2026-06-11 12:09:05 +02:00
committed by Rob Bradford
parent 9eff92fb4b
commit 181d29ee90
14 changed files with 79 additions and 69 deletions
+7 -7
View File
@@ -5,9 +5,9 @@
use std::any::Any;
use std::path::PathBuf;
use std::result;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::{Arc, Barrier, Mutex};
use std::{io, result};
use anyhow::anyhow;
use log::{debug, error, warn};
@@ -220,7 +220,7 @@ impl PciDevice for IvshmemDevice {
mmio32_allocator: &mut AddressAllocator,
mmio64_allocator: &mut AddressAllocator,
resources: Option<Vec<Resource>>,
) -> std::result::Result<Vec<PciBarConfiguration>, PciDeviceError> {
) -> result::Result<Vec<PciBarConfiguration>, PciDeviceError> {
let mut bars = Vec::new();
let mut bar0_addr = None;
let mut bar2_addr = None;
@@ -301,7 +301,7 @@ impl PciDevice for IvshmemDevice {
_allocator: &mut SystemAllocator,
_mmio32_allocator: &mut AddressAllocator,
_mmio64_allocator: &mut AddressAllocator,
) -> std::result::Result<(), PciDeviceError> {
) -> result::Result<(), PciDeviceError> {
unimplemented!("Device hotplug and remove are not supported for ivshmem");
}
@@ -351,14 +351,14 @@ impl PciDevice for IvshmemDevice {
None
}
fn move_bar(&mut self, old_base: u64, new_base: u64) -> result::Result<(), std::io::Error> {
fn move_bar(&mut self, old_base: u64, new_base: u64) -> io::Result<()> {
if new_base == self.data_bar_addr() {
if let Some(old_mapping) = self.userspace_mapping.take() {
self.ivshmem_ops
.lock()
.unwrap()
.unmap_ram_region(old_mapping)
.map_err(std::io::Error::other)?;
.map_err(io::Error::other)?;
}
let (region, new_mapping) = self
.ivshmem_ops
@@ -369,7 +369,7 @@ impl PciDevice for IvshmemDevice {
self.region_size as usize,
self.backend_file.clone(),
)
.map_err(std::io::Error::other)?;
.map_err(io::Error::other)?;
self.set_region(region, new_mapping);
}
for bar in self.bar_regions.iter_mut() {
@@ -403,7 +403,7 @@ impl Snapshottable for IvshmemDevice {
// The snapshot/restore (also live migration) support only work for ivshmem-plain mode.
// Additional work is needed for supporting ivshmem-doorbell.
fn snapshot(&mut self) -> std::result::Result<Snapshot, MigratableError> {
fn snapshot(&mut self) -> result::Result<Snapshot, MigratableError> {
let mut snapshot = Snapshot::new_from_state(&self.state())?;
// Snapshot PciConfiguration