vm-virtio: Define AccessPlatform trait

Moving the whole codebase to rely on the AccessPlatform definition from
vm-virtio so that we can fully remove it from virtio-queue crate.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2022-01-26 17:33:36 +01:00
committed by Rob Bradford
parent 8759c3db3e
commit 8eed276d14
16 changed files with 36 additions and 16 deletions

View File

@@ -10,7 +10,7 @@
//! Implements virtio queues
use std::fmt;
use std::fmt::{self, Debug};
pub mod queue;
pub use queue::*;
@@ -87,3 +87,10 @@ impl fmt::Display for VirtioDeviceType {
write!(f, "{}", output)
}
}
/// Trait for devices with access to data in memory being limited and/or
/// translated.
pub trait AccessPlatform: Send + Sync + Debug {
/// Provide a way to translate address ranges.
fn translate(&self, base: u64, size: u64) -> std::result::Result<u64, std::io::Error>;
}